Mercurial > hg > silvermirror
changeset 38:d17978d9697b
make more robust
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Tue, 12 May 2015 18:32:07 -0700 |
parents | 1877e2cb1118 |
children | 9e21b4fbd8b3 |
files | silvermirror/hg.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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): """