From 5db4edab96d7caa9c64325b85677ae0cb1430dd8 Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Mon, 6 Feb 2012 15:00:08 -0600 Subject: [PATCH] subrepo: add basestate method This will allow us to sort out what's going on with state .hgsubstate files more precisely. --- mercurial/subrepo.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py index 9d0b730460..c7c0faf220 100644 --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -275,6 +275,11 @@ class abstractsubrepo(object): """ 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 @@ class hgsubrepo(abstractsubrepo): 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 @@ class svnsubrepo(abstractsubrepo): 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 @@ class gitsubrepo(abstractsubrepo): 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: