Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes url for list_recursive on win in remote #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "c:\\Users\\TGubs\\Code\\Python\\PySvn\\venv\\Scripts\\python.exe"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

You may want to add .vscode/ to your ~/.gitignore.

}
34 changes: 34 additions & 0 deletions svn/remote.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

import posixpath

import svn.constants
import svn.common

Expand All @@ -21,3 +24,34 @@ def checkout(self, path, revision=None):

def __repr__(self):
return '<SVN(REMOTE) %s>' % self.url

def list_recursive(self, rel_path=None, yield_dirs=False,
path_filter_cb=None):
q = [rel_path]
while q:
current_rel_path = q[0]
del q[0]

for entry in self.list(extended=True, rel_path=current_rel_path):
if entry['is_directory'] is True:
if current_rel_path is not None:
next_rel_path = \
posixpath.join(current_rel_path, entry['name'])
else:
next_rel_path = entry['name']

do_queue = True
if path_filter_cb is not None:
result = path_filter_cb(next_rel_path)
if result is False:
do_queue = False

if do_queue is True:
q.append(next_rel_path)

if entry['is_directory'] is False or yield_dirs is True:
current_rel_path_phrase = current_rel_path \
if current_rel_path is not None \
else ''

yield (current_rel_path_phrase, entry)