##// END OF EJS Templates
add branch and branches commands
Matt Mackall -
r3502:8dc14d63 default
parent child Browse files
Show More
@@ -774,6 +774,35 b' def backout(ui, repo, rev, **opts):'
774 ui.status(_('(use "backout --merge" '
774 ui.status(_('(use "backout --merge" '
775 'if you want to auto-merge)\n'))
775 'if you want to auto-merge)\n'))
776
776
777 def branch(ui, repo, label=None):
778 """set or show the current branch name
779
780 With <name>, set the current branch name. Otherwise, show the
781 current branch name.
782 """
783
784 if label is not None:
785 repo.opener("branch", "w").write(label)
786 else:
787 b = repo.workingctx().branch()
788 if b:
789 ui.write("%s\n" % b)
790
791 def branches(ui, repo):
792 """list repository named branches
793
794 List the repository's named branches.
795 """
796 b = repo.branchtags()
797 l = [(-repo.changelog.rev(n), n, t) for t,n in b.items()]
798 l.sort()
799 for r, n, t in l:
800 hexfunc = ui.debugflag and hex or short
801 if ui.quiet:
802 ui.write("%s\n" % t)
803 else:
804 ui.write("%-30s %s:%s\n" % (t, -r, hexfunc(n)))
805
777 def bundle(ui, repo, fname, dest=None, **opts):
806 def bundle(ui, repo, fname, dest=None, **opts):
778 """create a changegroup file
807 """create a changegroup file
779
808
@@ -2850,6 +2879,8 b' table = {'
2850 ('u', 'user', '', _('record user as committer')),
2879 ('u', 'user', '', _('record user as committer')),
2851 ] + walkopts,
2880 ] + walkopts,
2852 _('hg backout [OPTION]... REV')),
2881 _('hg backout [OPTION]... REV')),
2882 "branch": (branch, [], _('hg branch [NAME]')),
2883 "branches": (branches, [], _('hg branches')),
2853 "bundle":
2884 "bundle":
2854 (bundle,
2885 (bundle,
2855 [('f', 'force', None,
2886 [('f', 'force', None,
@@ -4,6 +4,8 b' addremove'
4 annotate
4 annotate
5 archive
5 archive
6 backout
6 backout
7 branch
8 branches
7 bundle
9 bundle
8 cat
10 cat
9 clone
11 clone
@@ -120,6 +120,8 b' list of commands (use "hg help -v" to sh'
120 annotate show changeset information per file line
120 annotate show changeset information per file line
121 archive create unversioned archive of a repository revision
121 archive create unversioned archive of a repository revision
122 backout reverse effect of earlier changeset
122 backout reverse effect of earlier changeset
123 branch set or show the current branch name
124 branches list repository named branches
123 bundle create a changegroup file
125 bundle create a changegroup file
124 cat output the latest or given revisions of files
126 cat output the latest or given revisions of files
125 clone make a copy of an existing repository
127 clone make a copy of an existing repository
@@ -168,6 +170,8 b' list of commands (use "hg help -v" to sh'
168 annotate show changeset information per file line
170 annotate show changeset information per file line
169 archive create unversioned archive of a repository revision
171 archive create unversioned archive of a repository revision
170 backout reverse effect of earlier changeset
172 backout reverse effect of earlier changeset
173 branch set or show the current branch name
174 branches list repository named branches
171 bundle create a changegroup file
175 bundle create a changegroup file
172 cat output the latest or given revisions of files
176 cat output the latest or given revisions of files
173 clone make a copy of an existing repository
177 clone make a copy of an existing repository
@@ -43,6 +43,8 b' list of commands (use "hg help -v" to sh'
43 annotate show changeset information per file line
43 annotate show changeset information per file line
44 archive create unversioned archive of a repository revision
44 archive create unversioned archive of a repository revision
45 backout reverse effect of earlier changeset
45 backout reverse effect of earlier changeset
46 branch set or show the current branch name
47 branches list repository named branches
46 bundle create a changegroup file
48 bundle create a changegroup file
47 cat output the latest or given revisions of files
49 cat output the latest or given revisions of files
48 clone make a copy of an existing repository
50 clone make a copy of an existing repository
@@ -87,6 +89,8 b' list of commands (use "hg help -v" to sh'
87 annotate show changeset information per file line
89 annotate show changeset information per file line
88 archive create unversioned archive of a repository revision
90 archive create unversioned archive of a repository revision
89 backout reverse effect of earlier changeset
91 backout reverse effect of earlier changeset
92 branch set or show the current branch name
93 branches list repository named branches
90 bundle create a changegroup file
94 bundle create a changegroup file
91 cat output the latest or given revisions of files
95 cat output the latest or given revisions of files
92 clone make a copy of an existing repository
96 clone make a copy of an existing repository
@@ -2,27 +2,32 b''
2
2
3 hg init t
3 hg init t
4 cd t
4 cd t
5 hg branches
5
6
6 echo foo > a
7 echo foo > a
7 hg add a
8 hg add a
8 hg ci -m "initial" -d "0 0"
9 hg ci -m "initial" -d "0 0"
9 echo foo > .hg/branch
10 hg branch foo
11 hg branch
10 hg ci -m "add branch name" -d "0 0"
12 hg ci -m "add branch name" -d "0 0"
11 echo bar > .hg/branch
13 hg branch bar
12 hg ci -m "change branch name" -d "0 0"
14 hg ci -m "change branch name" -d "0 0"
13 rm .hg/branch
15 hg branch ""
14 hg ci -m "clear branch name" -d "0 0"
16 hg ci -m "clear branch name" -d "0 0"
15
17
16 hg co foo
18 hg co foo
17 cat .hg/branch
19 hg branch
18 echo bleah > a
20 echo bleah > a
19 hg ci -m "modify a branch" -d "0 0"
21 hg ci -m "modify a branch" -d "0 0"
20
22
21 hg merge
23 hg merge
22 cat .hg/branch
24 hg branch
23 HG_MERGE=true hg ci -m "merge" -d "0 0"
25 HG_MERGE=true hg ci -m "merge" -d "0 0"
24 hg log
26 hg log
25
27
28 hg branches
29 hg branches -q
30
26 echo % test for invalid branch cache
31 echo % test for invalid branch cache
27 hg rollback
32 hg rollback
28 hg tip
33 hg tip
@@ -1,3 +1,4 b''
1 foo
1 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 foo
3 foo
3 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
4 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -41,6 +42,10 b' user: test'
41 date: Thu Jan 01 00:00:00 1970 +0000
42 date: Thu Jan 01 00:00:00 1970 +0000
42 summary: initial
43 summary: initial
43
44
45 foo 5:dc140083783b
46 bar 2:ed2bbf4e0102
47 foo
48 bar
44 % test for invalid branch cache
49 % test for invalid branch cache
45 rolling back last transaction
50 rolling back last transaction
46 changeset: 4:98d14f698afe
51 changeset: 4:98d14f698afe
General Comments 0
You need to be logged in to leave comments. Login now