changeset 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 8eb3408bf005
children 7e6946ed5756
files mercurial/localrepo.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Feb 10 23:01:12 2013 +0000
+++ b/mercurial/localrepo.py	Fri Feb 08 05:36:07 2013 -0800
@@ -1230,6 +1230,8 @@
                     elif f not in self.dirstate:
                         fail(f, _("file not tracked!"))
 
+            cctx = context.workingctx(self, text, user, date, extra, changes)
+
             if (not force and not extra.get("close") and not merge
                 and not (changes[0] or changes[1] or changes[2])
                 and wctx.branch() == wctx.p1().branch()):
@@ -1244,7 +1246,6 @@
                     raise util.Abort(_("unresolved merge conflicts "
                                        "(see hg help resolve)"))
 
-            cctx = context.workingctx(self, text, user, date, extra, changes)
             if editor:
                 cctx._text = editor(self, cctx, subs)
             edited = (text != cctx._text)