# HG changeset patch # User Matt Mackall # Date 1161127920 18000 # Node ID d0459ec1455defcda2cd16e36ff5935b2e252392 # Parent 5436c8fe0ff52524fcb80b8538edaf7eed9aeadb Add branch support to commit diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -611,7 +611,14 @@ class localrepository(repo.repository): 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 @@ class localrepository(repo.repository): 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()