changeset 30983:7beb3ec34443

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 13 Feb 2017 11:58:02 -0800
parents 11c253997b0e
children afaf3c2b129c
files mercurial/commands.py mercurial/hg.py
diffstat 2 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Feb 13 11:32:09 2017 -0800
+++ b/mercurial/commands.py	Mon Feb 13 11:58:02 2017 -0800
@@ -5363,9 +5363,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)
--- 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: