"default" is the default branch name
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Tue, 13 Mar 2007 15:02:33 -0300
changeset 4176 f9bbcebcacea
parent 4175 fc12ac3755d5
child 4177 a7af0eeae8a3
"default" is the default branch name
mercurial/changelog.py
mercurial/cmdutil.py
mercurial/commands.py
mercurial/context.py
mercurial/localrepo.py
tests/test-encoding.out
tests/test-globalopts.out
tests/test-mq-caches.out
tests/test-newbranch.out
--- a/mercurial/changelog.py	Sat Mar 10 17:36:29 2007 -0800
+++ b/mercurial/changelog.py	Tue Mar 13 15:02:33 2007 -0300
@@ -59,7 +59,7 @@
         changelog v0 doesn't use extra
         """
         if not text:
-            return (nullid, "", (0, 0), [], "", {})
+            return (nullid, "", (0, 0), [], "", {'branch': 'default'})
         last = text.index("\n\n")
         desc = util.tolocal(text[last + 2:])
         l = text[:last].split('\n')
@@ -79,6 +79,8 @@
             time, timezone, extra = extra_data
             time, timezone = float(time), int(timezone)
             extra = self.decode_extra(extra)
+        if not extra.get('branch'):
+            extra['branch'] = 'default'
         files = l[3:]
         return (manifest, user, (time, timezone), files, desc, extra)
 
@@ -94,6 +96,8 @@
             parseddate = "%d %d" % util.parsedate(date)
         else:
             parseddate = "%d %d" % util.makedate()
+        if extra and extra.get("branch") in ("default", ""):
+            del extra["branch"]
         if extra:
             extra = self.encode_extra(extra)
             parseddate = "%s %s" % (parseddate, extra)
--- a/mercurial/cmdutil.py	Sat Mar 10 17:36:29 2007 -0800
+++ b/mercurial/cmdutil.py	Tue Mar 13 15:02:33 2007 -0300
@@ -262,7 +262,8 @@
 
         self.ui.write(_("changeset:   %d:%s\n") % (rev, hexfunc(changenode)))
 
-        if branch:
+        # don't show the default branch name
+        if branch != 'default':
             branch = util.tolocal(branch)
             self.ui.write(_("branch:      %s\n") % branch)
         for tag in self.repo.nodetags(changenode):
@@ -406,7 +407,7 @@
 
         def showbranches(**args):
             branch = changes[5].get("branch")
-            if branch:
+            if branch != 'default':
                 branch = util.tolocal(branch)
                 return showlist('branch', [branch], plural='branches', **args)
             # add old style branches if requested
--- a/mercurial/commands.py	Sat Mar 10 17:36:29 2007 -0800
+++ b/mercurial/commands.py	Tue Mar 13 15:02:33 2007 -0300
@@ -1447,7 +1447,7 @@
     if not ui.quiet:
 
         branch = util.tolocal(repo.workingctx().branch())
-        if branch:
+        if branch != 'default':
             output.append("(%s)" % branch)
 
         # multiple tags for a single parent separated by '/'
--- a/mercurial/context.py	Sat Mar 10 17:36:29 2007 -0800
+++ b/mercurial/context.py	Tue Mar 13 15:02:33 2007 -0300
@@ -413,9 +413,9 @@
     def clean(self): return self._status[5]
     def branch(self):
         try:
-            return self._repo.opener("branch").read().strip()
+            return self._repo.opener("branch").read().strip() or "default"
         except IOError:
-            return ""
+            return "default"
 
     def parents(self):
         """return contexts for each parent changeset"""
--- a/mercurial/localrepo.py	Sat Mar 10 17:36:29 2007 -0800
+++ b/mercurial/localrepo.py	Tue Mar 13 15:02:33 2007 -0300
@@ -17,7 +17,7 @@
 class localrepository(repo.repository):
     capabilities = ('lookup', 'changegroupsubset')
     supported = ('revlogv1', 'store')
-    branchcache_features = ('unnamed',)
+    branchcache_features = ('default',)
 
     def __del__(self):
         self.transhandle = None
@@ -727,7 +727,7 @@
             branchname = ""
 
         if use_dirstate:
-            oldname = c1[5].get("branch", "") # stored in UTF-8
+            oldname = c1[5].get("branch") or "default" # stored in UTF-8
             if not commit and not remove and not force and p2 == nullid and \
                    branchname == oldname:
                 self.ui.status(_("nothing changed\n"))
--- a/tests/test-encoding.out	Sat Mar 10 17:36:29 2007 -0800
+++ b/tests/test-encoding.out	Tue Mar 13 15:02:33 2007 -0300
@@ -126,13 +126,13 @@
 é                                  3:770b9b11621d
 % ascii
 ?                              5:db5520b4645f
-                               4:9cff3c980b58
+default                        4:9cff3c980b58
 % latin-1
 é                              5:db5520b4645f
-                               4:9cff3c980b58
+default                        4:9cff3c980b58
 % utf-8
 é                              5:db5520b4645f
-                               4:9cff3c980b58
+default                        4:9cff3c980b58
 % utf-8
 changeset:   5:db5520b4645f
 branch:      é
--- a/tests/test-globalopts.out	Sat Mar 10 17:36:29 2007 -0800
+++ b/tests/test-globalopts.out	Tue Mar 13 15:02:33 2007 -0300
@@ -91,6 +91,7 @@
 user:        test
 date:        Thu Jan 01 00:00:01 1970 +0000
 files+:      b
+extra:       branch=default
 description:
 b
 
@@ -102,6 +103,7 @@
 user:        test
 date:        Thu Jan 01 00:00:01 1970 +0000
 files+:      a
+extra:       branch=default
 description:
 a
 
--- a/tests/test-mq-caches.out	Sat Mar 10 17:36:29 2007 -0800
+++ b/tests/test-mq-caches.out	Tue Mar 13 15:02:33 2007 -0300
@@ -7,7 +7,7 @@
 # some regular revisions
 Patch queue now empty
 tip: 1
- features: unnamed
+ features: default
 3f910abad313ff802d3a23a7529433872df9b3ae 1
 3f910abad313ff802d3a23a7529433872df9b3ae bar
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -16,12 +16,12 @@
 applying p1
 Now at: p1
 tip: 2
- features: unnamed
+ features: default
 3f910abad313ff802d3a23a7529433872df9b3ae 1
 3f910abad313ff802d3a23a7529433872df9b3ae bar
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
 tip: 3
- features: unnamed
+ features: default
 3f910abad313ff802d3a23a7529433872df9b3ae 1
 3f910abad313ff802d3a23a7529433872df9b3ae bar
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -30,7 +30,7 @@
 
 # removing the cache
 tip: 3
- features: unnamed
+ features: default
 3f910abad313ff802d3a23a7529433872df9b3ae 1
 3f910abad313ff802d3a23a7529433872df9b3ae bar
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -39,7 +39,7 @@
 
 # importing rev 1 (the cache now ends in one of the patches)
 tip: 3
- features: unnamed
+ features: default
 3f910abad313ff802d3a23a7529433872df9b3ae 1
 3f910abad313ff802d3a23a7529433872df9b3ae bar
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
@@ -54,6 +54,6 @@
 applying p2
 Now at: p2
 tip: 3
- features: unnamed
+ features: default
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff 0
 9539f35bdc80732cc9a3f84e46508f1ed1ec8cff foo
--- a/tests/test-newbranch.out	Sat Mar 10 17:36:29 2007 -0800
+++ b/tests/test-newbranch.out	Tue Mar 13 15:02:33 2007 -0300
@@ -43,10 +43,10 @@
 summary:     initial
 
 foo                            5:5f8fb06e083e
-                               3:bf1bc2f45e83
+default                        3:bf1bc2f45e83
 bar                            2:67ec16bde7f1
 foo
-
+default
 bar
 % test for invalid branch cache
 rolling back last transaction
@@ -74,23 +74,23 @@
 
 
 4:4909a3732169
- features: unnamed
+ features: default
 4909a3732169c0c20011c4f4b8fdff4e3d89b23f 4
-bf1bc2f45e834c75404d0ddab57d53beab56e2f8 
+bf1bc2f45e834c75404d0ddab57d53beab56e2f8 default
 4909a3732169c0c20011c4f4b8fdff4e3d89b23f foo
 67ec16bde7f1575d523313b9bca000f6a6f12dca bar
 % test for different branch cache features
 branch cache: no features specified
 foo                            4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
-                               3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
+default                        3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
 bar                            2:67ec16bde7f1575d523313b9bca000f6a6f12dca
-branch cache: unknown features: dummy, foo, bar
+branch cache: missing features: default
 foo                            4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
-                               3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
+default                        3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
 bar                            2:67ec16bde7f1575d523313b9bca000f6a6f12dca
-branch cache: missing features: unnamed
+branch cache: missing features: default
 foo                            4:4909a3732169c0c20011c4f4b8fdff4e3d89b23f
-                               3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
+default                        3:bf1bc2f45e834c75404d0ddab57d53beab56e2f8
 bar                            2:67ec16bde7f1575d523313b9bca000f6a6f12dca
 % test old hg reading branch cache with feature list
 ValueError raised correctly, good.