diff mercurial/localrepo.py @ 6708:7566f00a3979

localrepo: let commit() get extra data from workingctx
author Patrick Mezard <pmezard@gmail.com>
date Wed, 18 Jun 2008 22:52:26 +0200
parents 02bad34230a2
children f84f507c53d3
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Jun 18 22:52:25 2008 +0200
+++ b/mercurial/localrepo.py	Wed Jun 18 22:52:26 2008 +0200
@@ -491,8 +491,8 @@
     def changectx(self, changeid=None):
         return context.changectx(self, changeid)
 
-    def workingctx(self, parents=None, changes=None):
-        return context.workingctx(self, parents, changes)
+    def workingctx(self, parents=None, extra=None, changes=None):
+        return context.workingctx(self, parents, extra, changes)
 
     def parents(self, changeid=None):
         '''
@@ -767,7 +767,6 @@
             remove = []
             changed = []
             use_dirstate = (p1 is None) # not rawcommit
-            extra = extra.copy()
 
             if use_dirstate:
                 p1, p2 = self.dirstate.parents()
@@ -796,9 +795,11 @@
                 update_dirstate = (self.dirstate.parents()[0] == p1)
                 changes = [files, [], [], [], []]
 
-            wctx = self.workingctx((p1, p2), changes)
+            wctx = self.workingctx((p1, p2), extra, changes)
             commit = wctx.modified() + wctx.added()
             remove = wctx.removed()
+            extra = wctx.extra().copy()
+            branchname = extra['branch']
 
             c1 = self.changelog.read(p1)
             c2 = self.changelog.read(p2)
@@ -806,15 +807,6 @@
             m2 = self.manifest.read(c2[0])
 
             if use_dirstate:
-                branchname = wctx.branch()
-                try:
-                    branchname = branchname.decode('UTF-8').encode('UTF-8')
-                except UnicodeDecodeError:
-                    raise util.Abort(_('branch name not in UTF-8!'))
-            else:
-                branchname = ""
-
-            if use_dirstate:
                 oldname = c1[5].get("branch") # stored in UTF-8
                 if (not commit and not remove and not force and p2 == nullid
                     and branchname == oldname):
@@ -901,9 +893,6 @@
                 text = self.ui.edit("\n".join(edittext), user)
                 os.chdir(olddir)
 
-            if branchname:
-                extra["branch"] = branchname
-
             lines = [line.rstrip() for line in text.rstrip().splitlines()]
             while lines and not lines[0]:
                 del lines[0]