Patchwork files: write filenode hash if --debug is passed

login
register
mail settings
Submitter David Soria Parra
Date March 24, 2015, 2:28 a.m.
Message ID <b25deef8d80dafbc0b3d.1427164124@waste.org>
Download mbox | patch
Permalink /patch/8231/
State Superseded
Headers show

Comments

David Soria Parra - March 24, 2015, 2:28 a.m.
# HG changeset patch
# User David Soria Parra <davidsp@fb.com>
# Date 1427163012 25200
#      Mon Mar 23 19:10:12 2015 -0700
# Node ID b25deef8d80dafbc0b3d65ca7f8fdacb7dad95bc
# Parent  811a1842cfe5f632145912d9bf2dc859e6ee3eeb
files: write filenode hash if --debug is passed

Write the filenode hash similar to hg manifest if --debug is passed.
This allows to retrieve the filenode hash for a specific patho.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2271,6 +2271,9 @@ 
         fm.startitem()
         if ui.verbose:
             fc = ctx[f]
+            if fc.filenode():
+                fnode = fc.filenode()
+                fm.condwrite(ui.debugflag, 'hash', '%s ', hex(fnode))
             fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
         fm.data(abspath=f)
         fm.write('path', fmt, m.rel(f))
diff --git a/tests/test-manifest.t b/tests/test-manifest.t
--- a/tests/test-manifest.t
+++ b/tests/test-manifest.t
@@ -32,6 +32,10 @@ 
   a
   l
 
+  $ hg files -r . -X b --debug
+  b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3          2   a
+  047b75c6d7a3ef6a2243bd0e99f94f6ea6683597          1 l l
+
   $ hg manifest -v
   644   a
   755 * b/a