Show More
@@ -230,7 +230,7 b' class remotenames(object):' | |||||
230 | self._nodetohoists.setdefault(node[0], []).append(name) |
|
230 | self._nodetohoists.setdefault(node[0], []).append(name) | |
231 | return self._nodetohoists |
|
231 | return self._nodetohoists | |
232 |
|
232 | |||
233 |
def wrapprintbookmarks(orig, ui, repo, |
|
233 | def wrapprintbookmarks(orig, ui, repo, fm, bmarks): | |
234 | if 'remotebookmarks' not in repo.names: |
|
234 | if 'remotebookmarks' not in repo.names: | |
235 | return |
|
235 | return | |
236 | ns = repo.names['remotebookmarks'] |
|
236 | ns = repo.names['remotebookmarks'] | |
@@ -243,7 +243,7 b' def wrapprintbookmarks(orig, ui, repo, b' | |||||
243 |
|
243 | |||
244 | bmarks[name] = (node, ' ', '') |
|
244 | bmarks[name] = (node, ' ', '') | |
245 |
|
245 | |||
246 |
return orig(ui, repo, |
|
246 | return orig(ui, repo, fm, bmarks) | |
247 |
|
247 | |||
248 | def extsetup(ui): |
|
248 | def extsetup(ui): | |
249 | extensions.wrapfunction(bookmarks, '_printbookmarks', wrapprintbookmarks) |
|
249 | extensions.wrapfunction(bookmarks, '_printbookmarks', wrapprintbookmarks) |
@@ -915,14 +915,12 b' def addbookmarks(repo, tr, names, rev=No' | |||||
915 | elif cur != tgt and newact == repo._activebookmark: |
|
915 | elif cur != tgt and newact == repo._activebookmark: | |
916 | deactivate(repo) |
|
916 | deactivate(repo) | |
917 |
|
917 | |||
918 |
def _printbookmarks(ui, repo, |
|
918 | def _printbookmarks(ui, repo, fm, bmarks): | |
919 | """private method to print bookmarks |
|
919 | """private method to print bookmarks | |
920 |
|
920 | |||
921 | Provides a way for extensions to control how bookmarks are printed (e.g. |
|
921 | Provides a way for extensions to control how bookmarks are printed (e.g. | |
922 | prepend or postpend names) |
|
922 | prepend or postpend names) | |
923 | """ |
|
923 | """ | |
924 | opts = pycompat.byteskwargs(opts) |
|
|||
925 | fm = ui.formatter('bookmarks', opts) |
|
|||
926 | hexfn = fm.hexfunc |
|
924 | hexfn = fm.hexfunc | |
927 | if len(bmarks) == 0 and fm.isplain(): |
|
925 | if len(bmarks) == 0 and fm.isplain(): | |
928 | ui.status(_("no bookmarks set\n")) |
|
926 | ui.status(_("no bookmarks set\n")) | |
@@ -937,10 +935,9 b' def _printbookmarks(ui, repo, bmarks, **' | |||||
937 | repo.changelog.rev(n), hexfn(n), label=label) |
|
935 | repo.changelog.rev(n), hexfn(n), label=label) | |
938 | fm.data(active=(activebookmarklabel in label)) |
|
936 | fm.data(active=(activebookmarklabel in label)) | |
939 | fm.plain('\n') |
|
937 | fm.plain('\n') | |
940 | fm.end() |
|
|||
941 |
|
938 | |||
942 |
def printbookmarks(ui, repo, |
|
939 | def printbookmarks(ui, repo, fm): | |
943 |
"""print bookmarks |
|
940 | """print bookmarks by the given formatter | |
944 |
|
941 | |||
945 | Provides a way for extensions to control how bookmarks are printed. |
|
942 | Provides a way for extensions to control how bookmarks are printed. | |
946 | """ |
|
943 | """ | |
@@ -954,7 +951,7 b' def printbookmarks(ui, repo, **opts):' | |||||
954 | prefix, label = ' ', '' |
|
951 | prefix, label = ' ', '' | |
955 |
|
952 | |||
956 | bmarks[bmark] = (n, prefix, label) |
|
953 | bmarks[bmark] = (n, prefix, label) | |
957 |
_printbookmarks(ui, repo, |
|
954 | _printbookmarks(ui, repo, fm, bmarks) | |
958 |
|
955 | |||
959 | def preparehookargs(name, old, new): |
|
956 | def preparehookargs(name, old, new): | |
960 | if new is None: |
|
957 | if new is None: |
@@ -1011,7 +1011,9 b' def bookmark(ui, repo, *names, **opts):' | |||||
1011 | return 1 |
|
1011 | return 1 | |
1012 | ui.write("%s\n" % book, label=bookmarks.activebookmarklabel) |
|
1012 | ui.write("%s\n" % book, label=bookmarks.activebookmarklabel) | |
1013 | else: # show bookmarks |
|
1013 | else: # show bookmarks | |
1014 | bookmarks.printbookmarks(ui, repo, **opts) |
|
1014 | opts = pycompat.byteskwargs(opts) | |
|
1015 | with ui.formatter('bookmarks', opts) as fm: | |||
|
1016 | bookmarks.printbookmarks(ui, repo, fm) | |||
1015 |
|
1017 | |||
1016 | @command('branch', |
|
1018 | @command('branch', | |
1017 | [('f', 'force', None, |
|
1019 | [('f', 'force', None, |
General Comments 0
You need to be logged in to leave comments.
Login now