# HG changeset patch # User Jeff Hammel # Date 1431480727 25200 # Node ID d17978d9697b9cde335791d31b6ef21cd4e1ccec # Parent 1877e2cb111842d895afafd5698cbabe126bccc9 make more robust diff -r 1877e2cb1118 -r d17978d9697b silvermirror/hg.py --- a/silvermirror/hg.py Sun Feb 15 18:02:43 2015 +0000 +++ b/silvermirror/hg.py Tue May 12 18:32:07 2015 -0700 @@ -18,20 +18,25 @@ pass +def clone(source, path): + print ('Cloning {} -> {}'.format(source, path)) + return hglib.clone(source, path) + def update(source, path): """ get changes from host on path """ + if not os.path.exists(path): + return clone(source, path) try: repo = hglib.open(path) - print ('Updating {}:'.format(path)) + print ('Updating {}'.format(path)) repo.pull(source, update=True, insecure=True) except ServerError: - print ('Cloning {} -> {}'.format(source, path)) repo = hglib.clone(source, path) - + return repo def repositories(url): """