diff hgext/strip.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 135b23868f45
children 69154e0ae384
line wrap: on
line diff
--- a/hgext/strip.py	Wed Mar 25 13:55:32 2015 +0900
+++ b/hgext/strip.py	Wed Mar 25 13:55:35 2015 +0900
@@ -23,10 +23,8 @@
     else:
         bctx = wctx.parents()[0]
     for s in sorted(wctx.substate):
-        if wctx.sub(s).dirty(True):
-            raise util.Abort(
-                _("uncommitted changes in subrepository %s") % s)
-        elif s not in bctx.substate or bctx.sub(s).dirty():
+        wctx.sub(s).bailifchanged(True)
+        if s not in bctx.substate or bctx.sub(s).dirty():
             inclsubs.append(s)
     return inclsubs