Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 7006:92d44ec32430
branch: added more support for named branches
hg branch now has a -C (--clean) option, to reset the current (dirstate)
branch to the branch of the last commit (first parent).
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Mon, 08 Sep 2008 12:55:27 +0200 |
parents | 2365c6d4c330 |
children | 78341ea65d16 |
comparison
equal
deleted
inserted
replaced
7005:7739b61897df | 7006:92d44ec32430 |
---|---|
371 the repository until the next commit). | 371 the repository until the next commit). |
372 | 372 |
373 Unless --force is specified, branch will not let you set a | 373 Unless --force is specified, branch will not let you set a |
374 branch name that shadows an existing branch. | 374 branch name that shadows an existing branch. |
375 | 375 |
376 Use --clean to reset the working directory branch to that of the | |
377 parent of the working directory, negating a previous branch change. | |
378 | |
376 Use the command 'hg update' to switch to an existing branch. | 379 Use the command 'hg update' to switch to an existing branch. |
377 """ | 380 """ |
378 | 381 |
379 if label: | 382 if opts.get('clean'): |
383 label = repo[None].parents()[0].branch() | |
384 repo.dirstate.setbranch(label) | |
385 ui.status(_('reset working directory to branch %s\n') % label) | |
386 elif label: | |
380 if not opts.get('force') and label in repo.branchtags(): | 387 if not opts.get('force') and label in repo.branchtags(): |
381 if label not in [p.branch() for p in repo.parents()]: | 388 if label not in [p.branch() for p in repo.parents()]: |
382 raise util.Abort(_('a branch of the same name already exists' | 389 raise util.Abort(_('a branch of the same name already exists' |
383 ' (use --force to override)')) | 390 ' (use --force to override)')) |
384 repo.dirstate.setbranch(util.fromlocal(label)) | 391 repo.dirstate.setbranch(util.fromlocal(label)) |
2985 ('U', 'noupdate', False, _('do not update to target'))], | 2992 ('U', 'noupdate', False, _('do not update to target'))], |
2986 _("hg bisect [-gbsr] [REV]")), | 2993 _("hg bisect [-gbsr] [REV]")), |
2987 "branch": | 2994 "branch": |
2988 (branch, | 2995 (branch, |
2989 [('f', 'force', None, | 2996 [('f', 'force', None, |
2990 _('set branch name even if it shadows an existing branch'))], | 2997 _('set branch name even if it shadows an existing branch')), |
2991 _('hg branch [-f] [NAME]')), | 2998 ('C', 'clean', None, _('reset branch name to parent branch name'))], |
2999 _('hg branch [-fC] [NAME]')), | |
2992 "branches": | 3000 "branches": |
2993 (branches, | 3001 (branches, |
2994 [('a', 'active', False, | 3002 [('a', 'active', False, |
2995 _('show only branches that have unmerged heads'))], | 3003 _('show only branches that have unmerged heads'))], |
2996 _('hg branches [-a]')), | 3004 _('hg branches [-a]')), |