Patchwork [1,of,3] commit: refactor exact flag

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 15, 2015, 7:58 a.m.
Message ID <fc23e5a71acdde126168.1450166324@waste.org>
Download mbox | patch
Permalink /patch/12053/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 15, 2015, 7:58 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1450166041 0
#      Tue Dec 15 07:54:01 2015 +0000
# Node ID fc23e5a71acdde126168e3f00c7a5bbc96867c95
# Parent  944af8e2eb4cddf96ba5b8a96854528b40979715
commit: refactor exact flag

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4660,6 +4660,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'))
@@ -4671,10 +4672,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
@@ -4688,8 +4690,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()
@@ -4715,7 +4717,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]]