changeset 27388:4a921d66617f

import: refactor exact flag
author timeless <timeless@mozdev.org>
date Tue, 15 Dec 2015 07:54:01 +0000
parents dfab0afde928
children 7edd78690c57
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Dec 14 05:29:55 2015 +0000
+++ b/mercurial/commands.py	Tue Dec 15 07:54:01 2015 +0000
@@ -4665,6 +4665,7 @@
     if date:
         opts['date'] = util.parsedate(date)
 
+    exact = opts.get('exact')
     update = not opts.get('bypass')
     if not update and opts.get('no_commit'):
         raise error.Abort(_('cannot use --no-commit with --bypass'))
@@ -4676,10 +4677,11 @@
         raise error.Abort(_('similarity must be between 0 and 100'))
     if sim and not update:
         raise error.Abort(_('cannot use --similarity with --bypass'))
-    if opts.get('exact') and opts.get('edit'):
-        raise error.Abort(_('cannot use --exact with --edit'))
-    if opts.get('exact') and opts.get('prefix'):
-        raise error.Abort(_('cannot use --exact with --prefix'))
+    if exact:
+        if opts.get('edit'):
+            raise error.Abort(_('cannot use --exact with --edit'))
+        if opts.get('prefix'):
+            raise error.Abort(_('cannot use --exact with --prefix'))
 
     base = opts["base"]
     wlock = dsguard = lock = tr = None
@@ -4693,8 +4695,8 @@
 
             if update:
                 cmdutil.checkunfinished(repo)
-            if (opts.get('exact') or not opts.get('force')) and update:
-                cmdutil.bailifchanged(repo)
+                if (exact or not opts.get('force')):
+                    cmdutil.bailifchanged(repo)
 
             if not opts.get('no_commit'):
                 lock = repo.lock()
@@ -4720,7 +4722,7 @@
                     if msg:
                         haspatch = True
                         ui.note(msg + '\n')
-                    if update or opts.get('exact'):
+                    if update or exact:
                         parents = repo[None].parents()
                     else:
                         parents = [repo[node]]