##// END OF EJS Templates
branch: added more support for named branches...
Sune Foldager -
r7006:92d44ec3 default
parent child Browse files
Show More
@@ -373,10 +373,17 b' def branch(ui, repo, label=None, **opts)'
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'
@@ -2987,8 +2994,9 b' table = {'
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,
@@ -11,6 +11,11 b' hg add a'
11 hg branch a
11 hg branch a
12 hg commit -d '1 0' -u test -m "Adding a branch"
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 hg update -C 0
19 hg update -C 0
15 echo 'b' >b
20 echo 'b' >b
16 hg add b
21 hg add b
@@ -1,21 +1,34 b''
1 marked working directory as branch a
1 marked working directory as branch a
2 marked working directory as branch q
3 reset working directory to branch a
2 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
4 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
3 marked working directory as branch b
5 marked working directory as branch b
4 created new head
6 created new head
5 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
6 created new head
7 marked working directory as branch c
8 marked working directory as branch c
8 marked working directory as branch a branch name much longer than the default justification used by branches
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 6:b8cb5af34c4d
10 a branch name much longer than the default justification used by branches 7:10ff5895aa57
10 b 4:22df7444f7c1
11 b 4:aee39cd168d0
11 a 1:dd6b440dd85a
12 c 6:589736a22561 (inactive)
12 c 5:5ca481e59b8c (inactive)
13 a 5:d8cbc61dbaa6 (inactive)
13 default 0:19709c5a4e75 (inactive)
14 default 0:19709c5a4e75 (inactive)
14 -------
15 -------
15 a branch name much longer than the default justification used by branches 6:b8cb5af34c4d
16 a branch name much longer than the default justification used by branches 7:10ff5895aa57
16 b 4:22df7444f7c1
17 b 4:aee39cd168d0
17 a 1:dd6b440dd85a
18 --- Branch a
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 changeset: 1:dd6b440dd85a
32 changeset: 1:dd6b440dd85a
20 branch: a
33 branch: a
21 user: test
34 user: test
@@ -23,20 +36,13 b' date: Thu Jan 01 00:00:01 1970 +0'
23 summary: Adding a branch
36 summary: Adding a branch
24
37
25 ---- Branch b
38 ---- Branch b
26 changeset: 4:22df7444f7c1
39 changeset: 4:aee39cd168d0
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
34 branch: b
40 branch: b
35 user: test
41 user: test
36 date: Thu Jan 01 00:00:03 1970 +0000
42 date: Thu Jan 01 00:00:03 1970 +0000
37 summary: Adding b branch head 1
43 summary: Adding b branch head 1
38
44
39 changeset: 2:ac22033332d1
45 changeset: 3:ac22033332d1
40 branch: b
46 branch: b
41 parent: 0:19709c5a4e75
47 parent: 0:19709c5a4e75
42 user: test
48 user: test
General Comments 0
You need to be logged in to leave comments. Login now