diff hgext/fetch.py @ 22676:a014fdc97154

fetch: use cmdutil.bailifchanged() Use the existing method cmdutil.bailifchanged() instead of implementing it again in fetch.py. An effect of this is that the error messages in case of uncommited changes will be different.
author Martin von Zweigbergk <martinvonz@gmail.com>
date Wed, 01 Oct 2014 14:48:42 -0700
parents 20fd00ee432e
children 6ea41d41aba1
line wrap: on
line diff
--- a/hgext/fetch.py	Thu Oct 02 18:00:05 2014 -0500
+++ b/hgext/fetch.py	Wed Oct 01 14:48:42 2014 -0700
@@ -8,7 +8,7 @@
 '''pull, update and merge in one command (DEPRECATED)'''
 
 from mercurial.i18n import _
-from mercurial.node import nullid, short
+from mercurial.node import short
 from mercurial import commands, cmdutil, hg, util, error
 from mercurial.lock import release
 
@@ -48,7 +48,7 @@
     if date:
         opts['date'] = util.parsedate(date)
 
-    parent, p2 = repo.dirstate.parents()
+    parent, _p2 = repo.dirstate.parents()
     branch = repo.dirstate.branch()
     try:
         branchnode = repo.branchtip(branch)
@@ -58,19 +58,13 @@
         raise util.Abort(_('working dir not at branch tip '
                            '(use "hg update" to check out branch tip)'))
 
-    if p2 != nullid:
-        raise util.Abort(_('outstanding uncommitted merge'))
-
     wlock = lock = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
-        mod, add, rem, del_ = repo.status()[:4]
 
-        if mod or add or rem:
-            raise util.Abort(_('outstanding uncommitted changes'))
-        if del_:
-            raise util.Abort(_('working directory is missing some files'))
+        cmdutil.bailifchanged(repo)
+
         bheads = repo.branchheads(branch)
         bheads = [head for head in bheads if len(repo[head].children()) == 0]
         if len(bheads) > 1: