[PATCH 2 of 2] log: introdude the node type lines in the debug mode

Gilles Moris gilles.moris at free.fr
Tue May 18 02:43:40 CDT 2010


# HG changeset patch
# User Gilles Moris <gilles.moris at free.fr>
# Date 1273853271 -7200
# Node ID e70269180926abb753df2c76d8de767dbc7793ab
# Parent  5a536ebb3f70b6b994fd5d0f9b26d0ef436f3ada
log: introdude the node type lines in the debug mode

The "type:" lines in log looks like:

changeset:   18:8661b9c6d7c8e3fce994b3abeff2fe5c92ab11a7
parent:      11:fc7ae2e639eb43885abe90ab6e8ff3bbb2444a9e
parent:      17:b7d5929ea2d51ebe438a5563055f379d1081cd7b
manifest:    16:1dc6adf333c74a176401fb8b8b5d5b550bc2bcc7
user:        Gilles Moris <gilles.moris at free.fr>
files:       file
files+:      file2
type:        branch merge (foo -> default)
extra:       branch=default
description:
This is the commit message.

The "type:" line is intended to  describe the local topology at the node,
like head, merge, root, possibly between named branches.
Heads that have been closed will be marked as such by this keyword.
Multiple values will be printed on separate lines, like this:
type:        head
type:        root

diff -r 5a536ebb3f70 -r e70269180926 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Mon May 10 09:56:06 2010 +0200
+++ b/mercurial/cmdutil.py	Fri May 14 18:07:51 2010 +0200
@@ -699,6 +699,7 @@
         self.hunk = {}
         self.lastheader = None
         self.footer = None
+        self.cache = {}
 
     def flush(self, rev):
         if rev in self.header:
@@ -784,6 +785,12 @@
             self.ui.write(_("copies:      %s\n") % ' '.join(copies),
                           label='ui.note log.copies')
 
+        if self.ui.debugflag:
+            for val in templatekw.getnodetypes(self.repo,
+                                               ctx,
+                                               self.cache):
+                self.ui.write(_("type:        %s\n") % val, label='log.type')
+
         extra = ctx.extra()
         if extra and self.ui.debugflag:
             for key, value in sorted(extra.items()):
diff -r 5a536ebb3f70 -r e70269180926 mercurial/templates/map-cmdline.default
--- a/mercurial/templates/map-cmdline.default	Mon May 10 09:56:06 2010 +0200
+++ b/mercurial/templates/map-cmdline.default	Fri May 14 18:07:51 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_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_debug = 'changeset:   {rev}:{node}\n{branches}{tags}{parents}{manifest}user:        {author}\ndate:        {date|date}\n{file_mods}{file_adds}{file_dels}{file_copies_switch}{nodetypes}{extras}description:\n{desc|strip}\n\n\n'
 start_files = 'files:      '
 file = ' {file}'
 end_files = '\n'
@@ -22,3 +22,4 @@
 branch = 'branch:      {branch}\n'
 tag = 'tag:         {tag}\n'
 extra = 'extra:       {key}={value|stringescape}\n'
+nodetype = 'type:        {nodetype}\n'
diff -r 5a536ebb3f70 -r e70269180926 tests/test-globalopts.out
--- a/tests/test-globalopts.out	Mon May 10 09:56:06 2010 +0200
+++ b/tests/test-globalopts.out	Fri May 14 18:07:51 2010 +0200
@@ -121,6 +121,8 @@
 user:        test
 date:        Thu Jan 01 00:00:01 1970 +0000
 files+:      b
+type:        head
+type:        root
 extra:       branch=default
 description:
 b
@@ -133,6 +135,8 @@
 user:        test
 date:        Thu Jan 01 00:00:01 1970 +0000
 files+:      a
+type:        head
+type:        root
 extra:       branch=default
 description:
 a
diff -r 5a536ebb3f70 -r e70269180926 tests/test-newbranch.out
--- a/tests/test-newbranch.out	Mon May 10 09:56:06 2010 +0200
+++ b/tests/test-newbranch.out	Fri May 14 18:07:51 2010 +0200
@@ -80,6 +80,7 @@
 user:        test
 date:        Mon Jan 12 13:46:40 1970 +0000
 files:       a
+type:        head
 extra:       branch=foo
 description:
 modify a branch


More information about the Mercurial-devel mailing list