determine URL to start with in cli.run()

This commit is contained in:
Josh Holtrop 2016-06-22 14:26:47 -04:00
parent 610d69156e
commit 725e241984

View File

@ -1,4 +1,21 @@
import simplesvnbrowser import simplesvnbrowser
import re
def run(argv): def run(argv):
print(argv) url = None
wc_path = "."
if len(argv) >= 2:
if re.search(r'://', argv[1]):
url = argv[1]
else:
wc_path = argv[1]
if url is None:
url = determine_url_from_wc(wc_path)
# TODO: start with url
def determine_url_from_wc(path):
stdout, _ = simplesvnbrowser.run_svn(["info", path])
m = re.search(r'^URL: (.*)$', stdout, re.MULTILINE)
if m is not None:
return m.group(1)
return ""