Show More
@@ -373,10 +373,17 b' def branch(ui, repo, label=None, **opts)' | |||
|
373 | 373 | Unless --force is specified, branch will not let you set a |
|
374 | 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 | 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 | 387 | if not opts.get('force') and label in repo.branchtags(): |
|
381 | 388 | if label not in [p.branch() for p in repo.parents()]: |
|
382 | 389 | raise util.Abort(_('a branch of the same name already exists' |
@@ -2987,8 +2994,9 b' table = {' | |||
|
2987 | 2994 | "branch": |
|
2988 | 2995 | (branch, |
|
2989 | 2996 | [('f', 'force', None, |
|
2990 |
_('set branch name even if it shadows an existing branch')) |
|
|
2991 | _('hg branch [-f] [NAME]')), | |
|
2997 | _('set branch name even if it shadows an existing branch')), | |
|
2998 | ('C', 'clean', None, _('reset branch name to parent branch name'))], | |
|
2999 | _('hg branch [-fC] [NAME]')), | |
|
2992 | 3000 | "branches": |
|
2993 | 3001 | (branches, |
|
2994 | 3002 | [('a', 'active', False, |
@@ -11,6 +11,11 b' hg add a' | |||
|
11 | 11 | hg branch a |
|
12 | 12 | hg commit -d '1 0' -u test -m "Adding a branch" |
|
13 | 13 | |
|
14 | hg branch q | |
|
15 | echo 'aa' >a | |
|
16 | hg branch -C | |
|
17 | hg commit -d '2 0' -u test -m "Adding to a branch" | |
|
18 | ||
|
14 | 19 | hg update -C 0 |
|
15 | 20 | echo 'b' >b |
|
16 | 21 | hg add b |
@@ -1,21 +1,34 b'' | |||
|
1 | 1 | marked working directory as branch a |
|
2 | marked working directory as branch q | |
|
3 | reset working directory to branch a | |
|
2 | 4 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
3 | 5 | marked working directory as branch b |
|
4 | 6 | created new head |
|
5 |
|
|
|
6 | created new head | |
|
7 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
|
7 | 8 | marked working directory as branch c |
|
8 | 9 | marked working directory as branch a branch name much longer than the default justification used by branches |
|
9 |
a branch name much longer than the default justification used by branches |
|
|
10 |
b 4: |
|
|
11 |
|
|
|
12 |
|
|
|
10 | a branch name much longer than the default justification used by branches 7:10ff5895aa57 | |
|
11 | b 4:aee39cd168d0 | |
|
12 | c 6:589736a22561 (inactive) | |
|
13 | a 5:d8cbc61dbaa6 (inactive) | |
|
13 | 14 | default 0:19709c5a4e75 (inactive) |
|
14 | 15 | ------- |
|
15 |
a branch name much longer than the default justification used by branches |
|
|
16 |
b 4: |
|
|
17 | a 1:dd6b440dd85a | |
|
16 | a branch name much longer than the default justification used by branches 7:10ff5895aa57 | |
|
17 | b 4:aee39cd168d0 | |
|
18 | 18 | --- Branch a |
|
19 | changeset: 5:d8cbc61dbaa6 | |
|
20 | branch: a | |
|
21 | parent: 2:881fe2b92ad0 | |
|
22 | user: test | |
|
23 | date: Thu Jan 01 00:00:04 1970 +0000 | |
|
24 | summary: Adding b branch head 2 | |
|
25 | ||
|
26 | changeset: 2:881fe2b92ad0 | |
|
27 | branch: a | |
|
28 | user: test | |
|
29 | date: Thu Jan 01 00:00:02 1970 +0000 | |
|
30 | summary: Adding to a branch | |
|
31 | ||
|
19 | 32 | changeset: 1:dd6b440dd85a |
|
20 | 33 | branch: a |
|
21 | 34 | user: test |
@@ -23,20 +36,13 b' date: Thu Jan 01 00:00:01 1970 +0' | |||
|
23 | 36 | summary: Adding a branch |
|
24 | 37 | |
|
25 | 38 | ---- Branch b |
|
26 |
changeset: 4: |
|
|
27 | branch: b | |
|
28 | parent: 2:ac22033332d1 | |
|
29 | user: test | |
|
30 | date: Thu Jan 01 00:00:04 1970 +0000 | |
|
31 | summary: Adding b branch head 2 | |
|
32 | ||
|
33 | changeset: 3:aee39cd168d0 | |
|
39 | changeset: 4:aee39cd168d0 | |
|
34 | 40 | branch: b |
|
35 | 41 | user: test |
|
36 | 42 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
37 | 43 | summary: Adding b branch head 1 |
|
38 | 44 | |
|
39 |
changeset: |
|
|
45 | changeset: 3:ac22033332d1 | |
|
40 | 46 | branch: b |
|
41 | 47 | parent: 0:19709c5a4e75 |
|
42 | 48 | user: test |
General Comments 0
You need to be logged in to leave comments.
Login now