##// END OF EJS Templates
bookmarks: port to generic templater
Yuya Nishihara -
r22776:564ae7d2 default
parent child Browse files
Show More
@@ -833,7 +833,8 b' def bisect(ui, repo, rev=None, extra=Non'
833 ('r', 'rev', '', _('revision'), _('REV')),
833 ('r', 'rev', '', _('revision'), _('REV')),
834 ('d', 'delete', False, _('delete a given bookmark')),
834 ('d', 'delete', False, _('delete a given bookmark')),
835 ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
835 ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
836 ('i', 'inactive', False, _('mark a bookmark inactive'))],
836 ('i', 'inactive', False, _('mark a bookmark inactive')),
837 ] + formatteropts,
837 _('hg bookmarks [OPTIONS]... [NAME]...'))
838 _('hg bookmarks [OPTIONS]... [NAME]...'))
838 def bookmark(ui, repo, *names, **opts):
839 def bookmark(ui, repo, *names, **opts):
839 '''create a new bookmark or list existing bookmarks
840 '''create a new bookmark or list existing bookmarks
@@ -991,9 +992,10 b' def bookmark(ui, repo, *names, **opts):'
991 finally:
992 finally:
992 wlock.release()
993 wlock.release()
993 else: # show bookmarks
994 else: # show bookmarks
994 hexfn = ui.debugflag and hex or short
995 fm = ui.formatter('bookmarks', opts)
996 hexfn = fm.hexfunc
995 marks = repo._bookmarks
997 marks = repo._bookmarks
996 if len(marks) == 0:
998 if len(marks) == 0 and not fm:
997 ui.status(_("no bookmarks set\n"))
999 ui.status(_("no bookmarks set\n"))
998 for bmark, n in sorted(marks.iteritems()):
1000 for bmark, n in sorted(marks.iteritems()):
999 current = repo._bookmarkcurrent
1001 current = repo._bookmarkcurrent
@@ -1002,15 +1004,16 b' def bookmark(ui, repo, *names, **opts):'
1002 else:
1004 else:
1003 prefix, label = ' ', ''
1005 prefix, label = ' ', ''
1004
1006
1005 if not ui.quiet:
1007 fm.startitem()
1006 ui.write(' %s ' % prefix, label=label)
1007 ui.write(bmark, label=label)
1008 pad = " " * (25 - encoding.colwidth(bmark))
1009 if not ui.quiet:
1008 if not ui.quiet:
1010 ui.write('%s %d:%s' % (
1009 fm.plain(' %s ' % prefix, label=label)
1011 pad, repo.changelog.rev(n), hexfn(n)),
1010 fm.write('bookmark', '%s', bmark, label=label)
1012 label=label)
1011 pad = " " * (25 - encoding.colwidth(bmark))
1013 ui.write('\n')
1012 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s',
1013 repo.changelog.rev(n), hexfn(n), label=label)
1014 fm.data(active=(bmark == current))
1015 fm.plain('\n')
1016 fm.end()
1014
1017
1015 @command('branch',
1018 @command('branch',
1016 [('f', 'force', None,
1019 [('f', 'force', None,
@@ -5,6 +5,10 b' no bookmarks'
5 $ hg bookmarks
5 $ hg bookmarks
6 no bookmarks set
6 no bookmarks set
7
7
8 $ hg bookmarks -Tjson
9 [
10 ]
11
8 bookmark rev -1
12 bookmark rev -1
9
13
10 $ hg bookmark X
14 $ hg bookmark X
@@ -59,6 +63,28 b' list bookmarks'
59 $ hg add b
63 $ hg add b
60 $ hg commit -m 1
64 $ hg commit -m 1
61
65
66 $ hg bookmarks -Tjson
67 [
68 {
69 "active": false,
70 "bookmark": "X",
71 "node": "f7b1eb17ad24730a1651fccd46c43826d1bbc2ac",
72 "rev": 0
73 },
74 {
75 "active": true,
76 "bookmark": "X2",
77 "node": "925d80f479bb026b0fb3deb27503780b13f74123",
78 "rev": 1
79 },
80 {
81 "active": false,
82 "bookmark": "Y",
83 "node": "0000000000000000000000000000000000000000",
84 "rev": -1
85 }
86 ]
87
62 bookmarks revset
88 bookmarks revset
63
89
64 $ hg log -r 'bookmark()'
90 $ hg log -r 'bookmark()'
@@ -219,7 +219,7 b' Show all commands + options'
219 archive: no-decode, prefix, rev, type, subrepos, include, exclude
219 archive: no-decode, prefix, rev, type, subrepos, include, exclude
220 backout: merge, parent, rev, edit, tool, include, exclude, message, logfile, date, user
220 backout: merge, parent, rev, edit, tool, include, exclude, message, logfile, date, user
221 bisect: reset, good, bad, skip, extend, command, noupdate
221 bisect: reset, good, bad, skip, extend, command, noupdate
222 bookmarks: force, rev, delete, rename, inactive
222 bookmarks: force, rev, delete, rename, inactive, template
223 branch: force, clean
223 branch: force, clean
224 branches: active, closed, template
224 branches: active, closed, template
225 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
225 bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure
General Comments 0
You need to be logged in to leave comments. Login now