subrepo: add basestate method
authorMatt Mackall <mpm@selenic.com>
Mon, 06 Feb 2012 15:00:08 -0600
changeset 16072 bcb973abcc0b
parent 16065 8af9e08a094f
child 16073 b254f827b7a6
subrepo: add basestate method This will allow us to sort out what's going on with state .hgsubstate files more precisely.
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Fri Feb 03 15:45:13 2012 -0600
+++ b/mercurial/subrepo.py	Mon Feb 06 15:00:08 2012 -0600
@@ -275,6 +275,11 @@
         """
         raise NotImplementedError
 
+    def basestate(self):
+        """current working directory base state, disregarding .hgsubstate
+        state and working directory modifications"""
+        raise NotImplementedError
+
     def checknested(self, path):
         """check if path is a subrepository within this repository"""
         return False
@@ -446,6 +451,9 @@
             return True
         return w.dirty() # working directory changed
 
+    def basestate(self):
+        return self._repo['.'].hex()
+
     def checknested(self, path):
         return self._repo._checknested(self._repo.wjoin(path))
 
@@ -666,6 +674,9 @@
                 return False
         return True
 
+    def basestate(self):
+        return self._wcrev()
+
     def commit(self, text, user, date):
         # user and date are out of our hands since svn is centralized
         changed, extchanged = self._wcchanged()
@@ -907,6 +918,9 @@
         out, code = self._gitdir(['diff-index', '--quiet', 'HEAD'])
         return code == 1
 
+    def basestate(self):
+        return self._gitstate()
+
     def get(self, state, overwrite=False):
         source, revision, kind = state
         if not revision: