[PATCH 3 of 4] log: add a marker for closed heads
Gilles Moris
gilles.moris at free.fr
Wed May 12 03:15:54 CDT 2010
# HG changeset patch
# User Gilles Moris <gilles.moris at free.fr>
# Date 1273478166 -7200
# Node ID bbef7225b4770ac633a804feb990e5b3c88e7bed
# Parent fc60860d838f205830014de60bf9eba1bb65735d
log: add a marker for closed heads
This will appear as a optional separate line below the "changeset:" line and
before the "branch:" line. There is a leading space, so that the template
keyword {closed} can be appended to an existing line, or appear as kind of
line continuation.
For the moment, it just displays " (closed)" and not " (closed head)", as
there is just a check on the "close=1" extra data, and no additional check
if the changeset has already be reopened, which can be time-consuming when
logging a large repo.
diff -r fc60860d838f -r bbef7225b477 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py Mon May 10 08:53:06 2010 +0200
+++ b/mercurial/cmdutil.py Mon May 10 09:56:06 2010 +0200
@@ -739,6 +739,7 @@
self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode)),
label='log.changeset')
+ self.ui.write(templatekw.showclosed(ctx=ctx), label='log.closed')
branch = ctx.branch()
# don't show the default branch name
diff -r fc60860d838f -r bbef7225b477 mercurial/templatekw.py
--- a/mercurial/templatekw.py Mon May 10 08:53:06 2010 +0200
+++ b/mercurial/templatekw.py Mon May 10 09:56:06 2010 +0200
@@ -6,6 +6,7 @@
# GNU General Public License version 2 or any later version.
from node import hex
+from i18n import _
import encoding, patch, util, error
def showlist(name, values, plural=None, **args):
@@ -234,6 +235,12 @@
def showtags(**args):
return showlist('tag', args['ctx'].tags(), **args)
+def showclosed(**args):
+ if args['ctx'].extra().get('close'):
+ return _(' (closed)\n')
+ else:
+ return ''
+
# keywords are callables like:
# fn(repo, ctx, templ, cache, revcache, **args)
# with:
@@ -261,5 +268,6 @@
'node': shownode,
'rev': showrev,
'tags': showtags,
+ 'closed': showclosed,
}
diff -r fc60860d838f -r bbef7225b477 mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default Mon May 10 08:53:06 2010 +0200
+++ b/mercurial/templates/map-cmdline.default Mon May 10 09:56:06 2010 +0200
@@ -1,7 +1,7 @@
-changeset = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
+changeset = 'changeset: {rev}:{node|short}\n{closed}{branches}{tags}{parents}user: {author}\ndate: {date|date}\nsummary: {desc|firstline}\n\n'
changeset_quiet = '{rev}:{node|short}\n'
-changeset_verbose = 'changeset: {rev}:{node|short}\n{branches}{tags}{parents}user: {author}\ndate: {date|date}\n{files}{file_copies_switch}description:\n{desc|strip}\n\n\n'
-changeset_debug = 'changeset: {rev}:{node}\n{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{extras}description:\n{desc|strip}\n\n\n'
+changeset_verbose = 'changeset: {rev}:{node|short}\n{closed}{branches}{tags}{parents}user: {author}\ndate: {date|date}\n{files}{file_copies_switch}description:\n{desc|strip}\n\n\n'
+changeset_debug = 'changeset: {rev}:{node}\n{closed}{branches}{tags}{parents}{manifest}user: {author}\ndate: {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{extras}description:\n{desc|strip}\n\n\n'
start_files = 'files: '
file = ' {file}'
end_files = '\n'
diff -r fc60860d838f -r bbef7225b477 tests/test-branches.out
--- a/tests/test-branches.out Mon May 10 08:53:06 2010 +0200
+++ b/tests/test-branches.out Mon May 10 09:56:06 2010 +0200
@@ -158,6 +158,7 @@
a branch name much longer than the default justification used by branches 7:10ff5895aa57
no open branch heads found on branches b
changeset: 12:2da6583810df
+ (closed)
branch: b
tag: tip
parent: 8:eebb944467c9
@@ -166,6 +167,7 @@
summary: close this part branch too
changeset: 11:c84627f3c15d
+ (closed)
branch: b
user: test
date: Thu Jan 01 00:00:09 1970 +0000
@@ -238,6 +240,7 @@
summary: reopen branch with a change
changeset: 11:c84627f3c15d
+ (closed)
branch: b
user: test
date: Thu Jan 01 00:00:09 1970 +0000
More information about the Mercurial-devel
mailing list