comparison mercurial/localrepo.py @ 24470:76b0b0fed2e3

subrepo: add dirtyreason to centralize composing dirty reason message This patch newly adds "dirtyreason()" to centralize composing dirty reason message like "uncommitted changes in subrepository 'xxxx'". There are 3 similar messages below, and this patch is a part of preparations for unifying them into (1), too. 1. uncommitted changes in subrepository 'XXXX' 2. uncommitted changes in subrepository XXXX 3. uncommitted changes in subrepo XXXX This patch chooses adding new method "dirtyreason()" instead of making "dirty()" return "reason string", because: - some of existing "dirty()" implementation is too complicated to do so simply, and - ill-mannered 3rd party subrepo classes, of which "dirty()" doesn't return "reason string", cause meaningless message (even though it is rare case)
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 25 Mar 2015 13:55:32 +0900
parents f247fbfe07f3
children cd50f3717639
comparison
equal deleted inserted replaced
24469:e71053ef0c46 24470:76b0b0fed2e3
1370 newstate[s] = oldstate[s] 1370 newstate[s] = oldstate[s]
1371 continue 1371 continue
1372 if not force: 1372 if not force:
1373 raise util.Abort( 1373 raise util.Abort(
1374 _("commit with new subrepo %s excluded") % s) 1374 _("commit with new subrepo %s excluded") % s)
1375 if wctx.sub(s).dirty(True): 1375 dirtyreason = wctx.sub(s).dirtyreason(True)
1376 if dirtyreason:
1376 if not self.ui.configbool('ui', 'commitsubrepos'): 1377 if not self.ui.configbool('ui', 'commitsubrepos'):
1377 raise util.Abort( 1378 raise util.Abort(dirtyreason,
1378 _("uncommitted changes in subrepo %s") % s,
1379 hint=_("use --subrepos for recursive commit")) 1379 hint=_("use --subrepos for recursive commit"))
1380 subs.append(s) 1380 subs.append(s)
1381 commitsubs.add(s) 1381 commitsubs.add(s)
1382 else: 1382 else:
1383 bs = wctx.sub(s).basestate() 1383 bs = wctx.sub(s).basestate()