mercurial/merge.py
changeset 21264 4e932dc5c113
parent 21261 6ca05c46aa95
child 21266 19d6fec60b81
--- a/mercurial/merge.py	Fri Apr 18 18:26:42 2014 -0700
+++ b/mercurial/merge.py	Fri Apr 18 19:08:32 2014 -0700
@@ -175,6 +175,18 @@
                 raise
         return records
 
+    def active(self):
+        """Whether mergestate is active.
+
+        Returns True if there appears to be mergestate. This is a rough proxy
+        for "is a merge in progress."
+        """
+        # Check local variables before looking at filesystem for performance
+        # reasons.
+        return bool(self._local) or bool(self._state) or \
+               self._repo.opener.exists(self.statepathv1) or \
+               self._repo.opener.exists(self.statepathv2)
+
     def commit(self):
         """Write current state on disk (if necessary)"""
         if self._dirty: