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

login
register
mail settings
Submitter via Mercurial-devel
Date Feb. 14, 2017, 1:07 a.m.
Message ID <4c11837859ce08ad07d0.1487034440@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/18462/
State Superseded
Headers show

Comments

via Mercurial-devel - Feb. 14, 2017, 1:07 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1487015882 28800
#      Mon Feb 13 11:58:02 2017 -0800
# Node ID 4c11837859ce08ad07d09a544aa89e3e930499c3
# Parent  dcd80a611a62f29b5c2130fe258ee305f7f6cab0
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.

Patch

diff -r dcd80a611a62 -r 4c11837859ce 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
@@ -6548,9 +6548,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 dcd80a611a62 -r 4c11837859ce 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: