mercurial/commands.py
changeset 5999 d1fe1a4eb2b7
parent 5998 5d91f6e6f841
child 6001 30d2fecaab76
equal deleted inserted replaced
5998:5d91f6e6f841 5999:d1fe1a4eb2b7
   337     set the working directory branch name (the branch does not exist in
   337     set the working directory branch name (the branch does not exist in
   338     the repository until the next commit).
   338     the repository until the next commit).
   339 
   339 
   340     Unless --force is specified, branch will not let you set a
   340     Unless --force is specified, branch will not let you set a
   341     branch name that shadows an existing branch.
   341     branch name that shadows an existing branch.
       
   342 
       
   343     Use the command 'hg update' to switch to an existing branch.
   342     """
   344     """
   343 
   345 
   344     if label:
   346     if label:
   345         if not opts.get('force') and label in repo.branchtags():
   347         if not opts.get('force') and label in repo.branchtags():
   346             if label not in [p.branch() for p in repo.workingctx().parents()]:
   348             if label not in [p.branch() for p in repo.workingctx().parents()]:
   356 
   358 
   357     List the repository's named branches, indicating which ones are
   359     List the repository's named branches, indicating which ones are
   358     inactive.  If active is specified, only show active branches.
   360     inactive.  If active is specified, only show active branches.
   359 
   361 
   360     A branch is considered active if it contains unmerged heads.
   362     A branch is considered active if it contains unmerged heads.
       
   363 
       
   364     Use the command 'hg update' to switch to an existing branch.
   361     """
   365     """
   362     b = repo.branchtags()
   366     b = repo.branchtags()
   363     heads = dict.fromkeys(repo.heads(), 1)
   367     heads = dict.fromkeys(repo.heads(), 1)
   364     l = [((n in heads), repo.changelog.rev(n), n, t) for t, n in b.items()]
   368     l = [((n in heads), repo.changelog.rev(n), n, t) for t, n in b.items()]
   365     l.sort()
   369     l.sort()