# HG changeset patch # User Steve Losh # Date 1279665794 14400 # Node ID fcdbab575d223047478ced3bfd37462b9ec6abc9 # Parent a9a6bf62224c3935e94a326e659bb5722b979f44 guts: show some initial feedback when cloning a review repo diff -r a9a6bf62224c -r fcdbab575d22 review/api.py --- a/review/api.py Tue Jul 20 18:27:53 2010 -0400 +++ b/review/api.py Tue Jul 20 18:43:14 2010 -0400 @@ -202,7 +202,8 @@ class ReviewDatastore(object): """The code review data for a particular repository.""" - def __init__(self, ui, repo, lpath=None, rpath=None, create=False): + def __init__(self, ui, repo, lpath=None, rpath=None, create=False, + clone_message=False): """Initialize a ReviewDatastore for a Mercurial repository. To get a ReviewDatastore for a repository that has already been @@ -254,6 +255,8 @@ try: hg.repository(ui, self.lpath) except error.RepoError: + if clone_message: + ui.write(messages.INIT_CLONE_MESSAGE % self.rpath) hg.clone(hg.remoteui(self.ui, {}), self.rpath, self.lpath) else: raise PreexistingDatastore(True) diff -r a9a6bf62224c -r fcdbab575d22 review/cli.py --- a/review/cli.py Tue Jul 20 18:27:53 2010 -0400 +++ b/review/cli.py Tue Jul 20 18:43:14 2010 -0400 @@ -85,8 +85,9 @@ ui.note(messages.INIT_START) try: - api.ReviewDatastore(ui, repo, rpath=opts.pop('remote_path'), create=True) - if '.hgreview' not in repo['tip'].manifest(): + api.ReviewDatastore(ui, repo, rpath=opts.pop('remote_path'), create=True, + clone_message=True) + if not any('.hgreview' in repo[h].manifest() for h in repo.heads()): ui.status(messages.INIT_SUCCESS_UNCOMMITTED) else: ui.status(messages.INIT_SUCCESS_CLONED) diff -r a9a6bf62224c -r fcdbab575d22 review/messages.py --- a/review/messages.py Tue Jul 20 18:27:53 2010 -0400 +++ b/review/messages.py Tue Jul 20 18:43:14 2010 -0400 @@ -14,6 +14,10 @@ initializing the code review data store and config """ +INIT_CLONE_MESSAGE = """\ +initializing review data from %s +""" + INIT_SUCCESS_UNCOMMITTED = """\ the review data has been initialized run "hg commit .hgreview -m 'initialize code review'" to record it permanently