diff mercurial/context.py @ 16491:bfe89d65d651 stable

update: make --check abort with dirty subrepos Aka "we could use dirty() but... yeah let's use it"
author Patrick Mezard <patrick@mezard.eu>
date Mon, 23 Apr 2012 12:12:04 +0200
parents 80b3d574881f
children 4b73f4ba27ca ac89a23ca814
line wrap: on
line diff
--- a/mercurial/context.py	Mon Apr 23 12:09:54 2012 +0200
+++ b/mercurial/context.py	Mon Apr 23 12:12:04 2012 +0200
@@ -940,14 +940,15 @@
         return sorted(self._repo.dirstate.walk(match, self.substate.keys(),
                                                True, False))
 
-    def dirty(self, missing=False):
+    def dirty(self, missing=False, merge=True, branch=True):
         "check whether a working directory is modified"
         # check subrepos first
         for s in self.substate:
             if self.sub(s).dirty():
                 return True
         # check current working dir
-        return (self.p2() or self.branch() != self.p1().branch() or
+        return ((merge and self.p2()) or
+                (branch and self.branch() != self.p1().branch()) or
                 self.modified() or self.added() or self.removed() or
                 (missing and self.deleted()))