[PATCH 3 of 6 V2] update: move check for dirty wdir into hg.updatetotally()

Martin von Zweigbergk martinvonz at google.com
Tue Feb 14 18:08:38 EST 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1487015882 28800
#      Mon Feb 13 11:58:02 2017 -0800
# Node ID 8a7b145ee159628a0ab5926ef5e4354df3f05ee0
# Parent  b5727b59c9bc3c6bc6779111b103517e00faf6b1
update: move check for dirty wdir into hg.updatetotally()

The function has a "check" parameter that's currently unused, and it
makes sense to me to have it honor it. That way other callers than
commands.update() could set it if they needed.

diff -r b5727b59c9bc -r 8a7b145ee159 mercurial/commands.py
--- a/mercurial/commands.py	Mon Feb 13 11:32:09 2017 -0800
+++ b/mercurial/commands.py	Mon Feb 13 11:58:02 2017 -0800
@@ -5990,9 +5990,6 @@
         brev = rev
         rev = scmutil.revsingle(repo, rev, rev).rev()
 
-        if check:
-            cmdutil.bailifchanged(repo, merge=False)
-
         repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
 
         return hg.updatetotally(ui, repo, rev, brev, clean=clean, check=check)
diff -r b5727b59c9bc -r 8a7b145ee159 mercurial/hg.py
--- a/mercurial/hg.py	Mon Feb 13 11:32:09 2017 -0800
+++ b/mercurial/hg.py	Mon Feb 13 11:58:02 2017 -0800
@@ -739,6 +739,8 @@
         if clean:
             ret = _clean(repo, checkout)
         else:
+            if check:
+                cmdutil.bailifchanged(repo, merge=False)
             ret = _update(repo, checkout)
 
         if not ret and movemarkfrom:


More information about the Mercurial-devel mailing list