comparison mercurial/localrepo.py @ 18659:b946470efed9

localrepo: create context used for actual commit earlier localrepo.commit creates a workingctx, calls self.status, does some munging on the changes status returns, does some validation on those changes, and then creates a new workingctx from the changes. This moves the creation of the new workginctx ahead of some validation, with the intention of refactoring some of that validation logic into the workingctx, so that it can be reused elsewhere.
author David Schleimer <dschleimer@fb.com>
date Fri, 08 Feb 2013 05:36:07 -0800
parents 3e92772d5383
children 7e6946ed5756
comparison
equal deleted inserted replaced
18656:8eb3408bf005 18659:b946470efed9
1228 else: 1228 else:
1229 fail(f, _("no match under directory!")) 1229 fail(f, _("no match under directory!"))
1230 elif f not in self.dirstate: 1230 elif f not in self.dirstate:
1231 fail(f, _("file not tracked!")) 1231 fail(f, _("file not tracked!"))
1232 1232
1233 cctx = context.workingctx(self, text, user, date, extra, changes)
1234
1233 if (not force and not extra.get("close") and not merge 1235 if (not force and not extra.get("close") and not merge
1234 and not (changes[0] or changes[1] or changes[2]) 1236 and not (changes[0] or changes[1] or changes[2])
1235 and wctx.branch() == wctx.p1().branch()): 1237 and wctx.branch() == wctx.p1().branch()):
1236 return None 1238 return None
1237 1239
1242 for f in changes[0]: 1244 for f in changes[0]:
1243 if f in ms and ms[f] == 'u': 1245 if f in ms and ms[f] == 'u':
1244 raise util.Abort(_("unresolved merge conflicts " 1246 raise util.Abort(_("unresolved merge conflicts "
1245 "(see hg help resolve)")) 1247 "(see hg help resolve)"))
1246 1248
1247 cctx = context.workingctx(self, text, user, date, extra, changes)
1248 if editor: 1249 if editor:
1249 cctx._text = editor(self, cctx, subs) 1250 cctx._text = editor(self, cctx, subs)
1250 edited = (text != cctx._text) 1251 edited = (text != cctx._text)
1251 1252
1252 # commit subs and write new state 1253 # commit subs and write new state