changeset 3419:d0459ec1455d

Add branch support to commit
author Matt Mackall <mpm@selenic.com>
date Tue, 17 Oct 2006 18:32:00 -0500
parents 5436c8fe0ff5
children 2576b6731524
files mercurial/localrepo.py
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Oct 17 18:31:56 2006 -0500
+++ b/mercurial/localrepo.py	Tue Oct 17 18:32:00 2006 -0500
@@ -611,7 +611,14 @@
         m1 = self.manifest.read(c1[0]).copy()
         m2 = self.manifest.read(c2[0])
 
-        if not commit and not remove and not force and p2 == nullid:
+        try:
+            branchname = self.opener("branch").read().rstrip()
+        except IOError:
+            branchname = ""
+        oldname = c1[5].get("branch", "")
+
+        if not commit and not remove and not force and p2 == nullid and \
+               branchname == oldname:
             self.ui.status(_("nothing changed\n"))
             return None
 
@@ -676,7 +683,11 @@
         if not lines:
             return None
         text = '\n'.join(lines)
-        n = self.changelog.add(mn, changed + remove, text, tr, p1, p2, user, date)
+        extra = {}
+        if branchname:
+            extra["branch"] = branchname
+        n = self.changelog.add(mn, changed + remove, text, tr, p1, p2,
+                               user, date, extra)
         self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,
                   parent2=xp2)
         tr.close()