fcdbab575d22

guts: show some initial feedback when cloning a review repo
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 20 Jul 2010 18:43:14 -0400
parents a9a6bf62224c
children a572f4405909
branches/tags (none)
files review/api.py review/cli.py review/messages.py

Changes

--- 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)
--- 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)
--- 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