Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 24471:1ff35d76421c
subrepo: add bailifchanged to centralize raising Abort if subrepo is dirty
This patch also centralizes composing dirty reason message like
"uncommitted changes in subrepository 'xxxx'".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 25 Mar 2015 13:55:35 +0900 |
parents | 76b0b0fed2e3 |
children | b39afa36006a |
line wrap: on
line diff
--- a/mercurial/subrepo.py Wed Mar 25 13:55:32 2015 +0900 +++ b/mercurial/subrepo.py Wed Mar 25 13:55:35 2015 +0900 @@ -402,6 +402,13 @@ return _("uncommitted changes in subrepository '%s'" ) % subrelpath(self) + def bailifchanged(self, ignoreupdate=False): + """raise Abort if subrepository is ``dirty()`` + """ + dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate) + if dirtyreason: + raise util.Abort(dirtyreason) + def basestate(self): """current working directory base state, disregarding .hgsubstate state and working directory modifications"""