Show More
@@ -765,16 +765,35 b' def addbookmarks(repo, tr, names, rev=No' | |||||
765 | deactivate(repo) |
|
765 | deactivate(repo) | |
766 | marks.recordchange(tr) |
|
766 | marks.recordchange(tr) | |
767 |
|
767 | |||
|
768 | def _printbookmarks(ui, repo, bmarks, **opts): | |||
|
769 | """private method to print bookmarks | |||
|
770 | ||||
|
771 | Provides a way for extensions to control how bookmarks are printed (e.g. | |||
|
772 | prepend or postpend names) | |||
|
773 | """ | |||
|
774 | fm = ui.formatter('bookmarks', opts) | |||
|
775 | hexfn = fm.hexfunc | |||
|
776 | if len(bmarks) == 0 and fm.isplain(): | |||
|
777 | ui.status(_("no bookmarks set\n")) | |||
|
778 | for bmark, (n, prefix, label) in sorted(bmarks.iteritems()): | |||
|
779 | fm.startitem() | |||
|
780 | if not ui.quiet: | |||
|
781 | fm.plain(' %s ' % prefix, label=label) | |||
|
782 | fm.write('bookmark', '%s', bmark, label=label) | |||
|
783 | pad = " " * (25 - encoding.colwidth(bmark)) | |||
|
784 | fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', | |||
|
785 | repo.changelog.rev(n), hexfn(n), label=label) | |||
|
786 | fm.data(active=(activebookmarklabel in label)) | |||
|
787 | fm.plain('\n') | |||
|
788 | fm.end() | |||
|
789 | ||||
768 | def printbookmarks(ui, repo, **opts): |
|
790 | def printbookmarks(ui, repo, **opts): | |
769 | """print bookmarks to a formatter |
|
791 | """print bookmarks to a formatter | |
770 |
|
792 | |||
771 | Provides a way for extensions to control how bookmarks are printed. |
|
793 | Provides a way for extensions to control how bookmarks are printed. | |
772 | """ |
|
794 | """ | |
773 | fm = ui.formatter('bookmarks', opts) |
|
|||
774 | hexfn = fm.hexfunc |
|
|||
775 | marks = repo._bookmarks |
|
795 | marks = repo._bookmarks | |
776 | if len(marks) == 0 and fm.isplain(): |
|
796 | bmarks = {} | |
777 | ui.status(_("no bookmarks set\n")) |
|
|||
778 | for bmark, n in sorted(marks.iteritems()): |
|
797 | for bmark, n in sorted(marks.iteritems()): | |
779 | active = repo._activebookmark |
|
798 | active = repo._activebookmark | |
780 | if bmark == active: |
|
799 | if bmark == active: | |
@@ -782,13 +801,5 b' def printbookmarks(ui, repo, **opts):' | |||||
782 | else: |
|
801 | else: | |
783 | prefix, label = ' ', '' |
|
802 | prefix, label = ' ', '' | |
784 |
|
803 | |||
785 | fm.startitem() |
|
804 | bmarks[bmark] = (n, prefix, label) | |
786 | if not ui.quiet: |
|
805 | _printbookmarks(ui, repo, bmarks, **opts) | |
787 | fm.plain(' %s ' % prefix, label=label) |
|
|||
788 | fm.write('bookmark', '%s', bmark, label=label) |
|
|||
789 | pad = " " * (25 - encoding.colwidth(bmark)) |
|
|||
790 | fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', |
|
|||
791 | repo.changelog.rev(n), hexfn(n), label=label) |
|
|||
792 | fm.data(active=(bmark == active)) |
|
|||
793 | fm.plain('\n') |
|
|||
794 | fm.end() |
|
General Comments 0
You need to be logged in to leave comments.
Login now