977f6adf3dab

cli: get rid of the import *
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 15 Jun 2010 18:24:23 -0400
parents b45f32cad5b8
children deb8a96475a5
branches/tags (none)
files review/extension_ui.py

Changes

--- a/review/extension_ui.py	Tue Jun 15 18:19:24 2010 -0400
+++ b/review/extension_ui.py	Tue Jun 15 18:24:23 2010 -0400
@@ -6,8 +6,7 @@
 """
 
 import re
-import helps, messages
-from api import *
+import api, helps, messages
 from mercurial import help, templatefilters, util
 from mercurial.node import short
 from mercurial import extensions
@@ -27,16 +26,16 @@
     ui.note(messages.INIT_START)
 
     try:
-        ReviewDatastore(ui, repo, rpath=opts.pop('remote_path'), create=True)
+        api.ReviewDatastore(ui, repo, rpath=opts.pop('remote_path'), create=True)
         if '.hgreview' not in repo['tip'].manifest():
             ui.status(messages.INIT_SUCCESS_UNCOMMITTED)
         else:
             ui.status(messages.INIT_SUCCESS_CLONED)
-    except RelativeRemotePath:
+    except api.RelativeRemotePath:
         raise util.Abort(messages.INIT_UNSUPPORTED_RELATIVE_RPATH)
-    except DatastoreRequiresRemotePath:
+    except api.DatastoreRequiresRemotePath:
         raise util.Abort(messages.INIT_REQUIRES_REMOTE_PATH)
-    except PreexistingDatastore, e:
+    except api.PreexistingDatastore, e:
         if e.committed:
             ui.note(messages.INIT_EXISTS)
         else:
@@ -47,7 +46,7 @@
     message = opts.pop('message')
     lines = opts.pop('lines')
 
-    rd = ReviewDatastore(ui, repo)
+    rd = api.ReviewDatastore(ui, repo)
     rcset = rd[rev]
 
     if lines and not len(fnames) == 1:
@@ -60,20 +59,20 @@
         lines=lines.split(',')
 
     if fnames:
-        fnames = map(lambda f: sanitize_path(f, repo), fnames)
+        fnames = map(lambda f: api.sanitize_path(f, repo), fnames)
     else:
         fnames = ['']
 
     for fn in fnames:
         try:
             rcset.add_comment(message=message, filename=fn, lines=lines)
-        except FileNotInChangeset:
+        except api.FileNotInChangeset:
             raise util.Abort(
                 messages.COMMENT_FILE_DOES_NOT_EXIST % (fn, repo[rev].rev())
             )
 
 def _signoff_command(ui, repo, **opts):
-    rd = ReviewDatastore(ui, repo)
+    rd = api.ReviewDatastore(ui, repo)
     rcset = rd[opts.pop('rev')]
     message = opts.pop('message')
 
@@ -88,11 +87,11 @@
     try:
         rcset.add_signoff(message=message, opinion=opinion,
             force=opts.pop('force'))
-    except SignoffExists:
+    except api.SignoffExists:
         raise util.Abort(messages.SIGNOFF_EXISTS)
 
 def _check_command(ui, repo, **opts):
-    rd = ReviewDatastore(ui, repo)
+    rd = api.ReviewDatastore(ui, repo)
     rcset = rd[opts.pop('rev')]
 
     if opts.pop('no_nos'):
@@ -116,8 +115,8 @@
     context = int(opts.pop('unified'))
 
     try:
-        rd = ReviewDatastore(ui, repo)
-    except UninitializedDatastore:
+        rd = api.ReviewDatastore(ui, repo)
+    except api.UninitializedDatastore:
         raise util.Abort(messages.NO_DATA_STORE)
     cset = repo[rev]
     rcset = rd[rev]
@@ -201,7 +200,7 @@
 
     if not fnames:
         fnames = rcset.files()
-    fnames = [sanitize_path(fname, repo) for fname in fnames]
+    fnames = [api.sanitize_path(fname, repo) for fname in fnames]
     fnames = [fname for fname in fnames if rcset.has_diff(fname)]
 
     for filename in fnames: