##// END OF EJS Templates
branches: add -r option to show branch name(s) of a given rev (issue5948)...
Navaneeth Suresh -
r41094:4506f801 default
parent child Browse files
Show More
@@ -1132,6 +1132,7 b' def branch(ui, repo, label=None, **opts)'
1132 1132 [('a', 'active', False,
1133 1133 _('show only branches that have unmerged heads (DEPRECATED)')),
1134 1134 ('c', 'closed', False, _('show normal and closed branches')),
1135 ('r', 'rev', [], _('show branch name(s) of the given rev'))
1135 1136 ] + formatteropts,
1136 1137 _('[-c]'),
1137 1138 helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
@@ -1161,6 +1162,13 b' def branches(ui, repo, active=False, clo'
1161 1162 """
1162 1163
1163 1164 opts = pycompat.byteskwargs(opts)
1165 revs = opts.get('rev')
1166 selectedbranches = None
1167 if revs:
1168 revs = scmutil.revrange(repo, revs)
1169 getbi = repo.revbranchcache().branchinfo
1170 selectedbranches = {getbi(r)[0] for r in revs}
1171
1164 1172 ui.pager('branches')
1165 1173 fm = ui.formatter('branches', opts)
1166 1174 hexfunc = fm.hexfunc
@@ -1168,6 +1176,8 b' def branches(ui, repo, active=False, clo'
1168 1176 allheads = set(repo.heads())
1169 1177 branches = []
1170 1178 for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
1179 if selectedbranches is not None and tag not in selectedbranches:
1180 continue
1171 1181 isactive = False
1172 1182 if not isclosed:
1173 1183 openheads = set(repo.branchmap().iteropen(heads))
@@ -157,6 +157,18 b' verify update will accept invalid legacy'
157 157 summary: Adding b branch
158 158
159 159
160 ---- going to test branch listing by rev
161 $ hg branches -r0
162 default 0:19709c5a4e75 (inactive)
163 $ hg branches -qr0
164 default
165 --- now more than one rev
166 $ hg branches -r2:5
167 b 4:aee39cd168d0
168 a 5:d8cbc61dbaa6 (inactive)
169 $ hg branches -qr2:5
170 b
171 a
160 172 ---- going to test branch closing
161 173
162 174 $ hg branches
@@ -238,7 +238,7 b' Show all commands + options'
238 238 bisect: reset, good, bad, skip, extend, command, noupdate
239 239 bookmarks: force, rev, delete, rename, inactive, list, template
240 240 branch: force, clean, rev
241 branches: active, closed, template
241 branches: active, closed, rev, template
242 242 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
243 243 cat: output, rev, decode, include, exclude, template
244 244 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
General Comments 0
You need to be logged in to leave comments. Login now