Skip to content
Open
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
11 changes: 4 additions & 7 deletions svn2github.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ class Svn2GithubException(Exception):


def get_last_revision_from_svn(svn_url):
result = proc.run(["svn", "info", svn_url], check=True, stderr=DEVNULL, stdin=DEVNULL, stdout=PIPE)
result = proc.run(["svn", "info", svn_url, "--no-newline", "--show-item", "revision"], check=True, stderr=DEVNULL, stdin=DEVNULL, stdout=PIPE)

pattern = re.compile("^Revision: ([0-9]+)$".encode())

for line in result.stdout.split("\n".encode()):
m = pattern.match(line)
if m:
return int(m.group(1))
rev = int (result.stdout.decode().strip())
if rev:
return rev

return Svn2GithubException("svn info {} output did not specify the current revision".format(svn_url))

Expand Down