diff mercurial/commands.py @ 4209:dbc3846c09a1

Merge with -stable, fix small test failure
author Matt Mackall <mpm@selenic.com>
date Wed, 14 Mar 2007 01:26:09 -0500
parents 7ca05d29c1f0 7e1c8a565a4f
children 5ccbc0be6cdb
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Mar 13 21:54:34 2007 -0700
+++ b/mercurial/commands.py	Wed Mar 14 01:26:09 2007 -0500
@@ -257,16 +257,14 @@
     branch name that shadows an existing branch.
     """
 
-    if label is not None:
+    if label:
         if not opts.get('force') and label in repo.branchtags():
             if label not in [p.branch() for p in repo.workingctx().parents()]:
                 raise util.Abort(_('a branch of the same name already exists'
                                    ' (use --force to override)'))
-        repo.opener("branch", "w").write(util.fromlocal(label) + '\n')
+        repo.dirstate.setbranch(util.fromlocal(label))
     else:
-        b = util.tolocal(repo.workingctx().branch())
-        if b:
-            ui.write("%s\n" % b)
+        ui.write("%s\n" % util.tolocal(repo.dirstate.branch()))
 
 def branches(ui, repo):
     """list repository named branches
@@ -1446,7 +1444,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 '/'