Patchwork [V2] files: write filenode hash if --debug is passed

login
register
mail settings
Submitter David Soria Parra
Date March 24, 2015, 2:32 a.m.
Message ID <db4efb64cfb859086e25.1427164329@davidsp-mbp.local>
Download mbox | patch
Permalink /patch/8232/
State Changes Requested
Headers show

Comments

David Soria Parra - March 24, 2015, 2:32 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 db4efb64cfb859086e25af34773f808a90505abc
# 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.
Martin von Zweigbergk - March 24, 2015, 4:17 a.m.
On Mon, Mar 23, 2015 at 7:34 PM David Soria Parra <davidsp@fb.com> wrote:

> # HG changeset patch
> # User David Soria Parra <davidsp@fb.com>
> # Date 1427163012 25200
> #      Mon Mar 23 19:10:12 2015 -0700
> # Node ID db4efb64cfb859086e25af34773f808a90505abc
> # 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.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2271,6 +2271,8 @@
>          fm.startitem()
>          if ui.verbose:
>              fc = ctx[f]
> +            if ui.debugflag and fc.filenode():
> +                fm.write('hash', '%s ', hex(fc.filenode()))
>              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
> +
>

Add a test for working copy too? Including modified, added and removed
files, ideally.


>    $ hg manifest -v
>    644   a
>    755 * b/a
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Matt Mackall - March 24, 2015, 2:47 p.m.
On Tue, 2015-03-24 at 04:17 +0000, Martin von Zweigbergk wrote:
> On Mon, Mar 23, 2015 at 7:34 PM David Soria Parra <davidsp@fb.com> wrote:
> 
> > # HG changeset patch
> > # User David Soria Parra <davidsp@fb.com>
> > # Date 1427163012 25200
> > #      Mon Mar 23 19:10:12 2015 -0700
> > # Node ID db4efb64cfb859086e25af34773f808a90505abc
> > # 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.
> >
> > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> > --- a/mercurial/cmdutil.py
> > +++ b/mercurial/cmdutil.py
> > @@ -2271,6 +2271,8 @@
> >          fm.startitem()
> >          if ui.verbose:
> >              fc = ctx[f]
> > +            if ui.debugflag and fc.filenode():
> > +                fm.write('hash', '%s ', hex(fc.filenode()))
> >              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
> > +
> >
> 
> Add a test for working copy too? Including modified, added and removed
> files, ideally.

In fact, I think we should aim for the output being the same format with
--debug on the working copy. In particular, unchanged files should
probably show the filenode from the parent. We have some internal magic
in wctx.manifest() for this, but 'removed' is an interesting case.
Martin von Zweigbergk - March 25, 2015, 4:36 a.m.
On Tue, Mar 24, 2015 at 7:47 AM Matt Mackall <mpm@selenic.com> wrote:

> On Tue, 2015-03-24 at 04:17 +0000, Martin von Zweigbergk wrote:
> > On Mon, Mar 23, 2015 at 7:34 PM David Soria Parra <davidsp@fb.com>
> wrote:
> >
> > > # HG changeset patch
> > > # User David Soria Parra <davidsp@fb.com>
> > > # Date 1427163012 25200
> > > #      Mon Mar 23 19:10:12 2015 -0700
> > > # Node ID db4efb64cfb859086e25af34773f808a90505abc
> > > # 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.
> > >
> > > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> > > --- a/mercurial/cmdutil.py
> > > +++ b/mercurial/cmdutil.py
> > > @@ -2271,6 +2271,8 @@
> > >          fm.startitem()
> > >          if ui.verbose:
> > >              fc = ctx[f]
> > > +            if ui.debugflag and fc.filenode():
> > > +                fm.write('hash', '%s ', hex(fc.filenode()))
> > >              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
> > > +
> > >
> >
> > Add a test for working copy too? Including modified, added and removed
> > files, ideally.
>
> In fact, I think we should aim for the output being the same format with
> --debug on the working copy. In particular, unchanged files should
> probably show the filenode from the parent.


With a '+' suffix? I saw that you accepted Sid's series that added a '+'
suffix to annotate ouput (if I understood right from skimming).
Matt Mackall - March 25, 2015, 6:05 p.m.
On Wed, 2015-03-25 at 04:36 +0000, Martin von Zweigbergk wrote:
> On Tue, Mar 24, 2015 at 7:47 AM Matt Mackall <mpm@selenic.com> wrote:
> 
> > On Tue, 2015-03-24 at 04:17 +0000, Martin von Zweigbergk wrote:
> > > On Mon, Mar 23, 2015 at 7:34 PM David Soria Parra <davidsp@fb.com>
> > wrote:
> > >
> > > > # HG changeset patch
> > > > # User David Soria Parra <davidsp@fb.com>
> > > > # Date 1427163012 25200
> > > > #      Mon Mar 23 19:10:12 2015 -0700
> > > > # Node ID db4efb64cfb859086e25af34773f808a90505abc
> > > > # 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.
> > > >
> > > > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> > > > --- a/mercurial/cmdutil.py
> > > > +++ b/mercurial/cmdutil.py
> > > > @@ -2271,6 +2271,8 @@
> > > >          fm.startitem()
> > > >          if ui.verbose:
> > > >              fc = ctx[f]
> > > > +            if ui.debugflag and fc.filenode():
> > > > +                fm.write('hash', '%s ', hex(fc.filenode()))
> > > >              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
> > > > +
> > > >
> > >
> > > Add a test for working copy too? Including modified, added and removed
> > > files, ideally.
> >
> > In fact, I think we should aim for the output being the same format with
> > --debug on the working copy. In particular, unchanged files should
> > probably show the filenode from the parent.
> 
> 
> With a '+' suffix? I saw that you accepted Sid's series that added a '+'
> suffix to annotate ouput (if I understood right from skimming).

Well.. unchanged files should probably just show the parent node, right?
Martin von Zweigbergk - March 25, 2015, 6:06 p.m.
On Wed, Mar 25, 2015 at 11:05 AM Matt Mackall <mpm@selenic.com> wrote:

> On Wed, 2015-03-25 at 04:36 +0000, Martin von Zweigbergk wrote:
> > On Tue, Mar 24, 2015 at 7:47 AM Matt Mackall <mpm@selenic.com> wrote:
> >
> > > On Tue, 2015-03-24 at 04:17 +0000, Martin von Zweigbergk wrote:
> > > > On Mon, Mar 23, 2015 at 7:34 PM David Soria Parra <davidsp@fb.com>
> > > wrote:
> > > >
> > > > > # HG changeset patch
> > > > > # User David Soria Parra <davidsp@fb.com>
> > > > > # Date 1427163012 25200
> > > > > #      Mon Mar 23 19:10:12 2015 -0700
> > > > > # Node ID db4efb64cfb859086e25af34773f808a90505abc
> > > > > # 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.
> > > > >
> > > > > diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> > > > > --- a/mercurial/cmdutil.py
> > > > > +++ b/mercurial/cmdutil.py
> > > > > @@ -2271,6 +2271,8 @@
> > > > >          fm.startitem()
> > > > >          if ui.verbose:
> > > > >              fc = ctx[f]
> > > > > +            if ui.debugflag and fc.filenode():
> > > > > +                fm.write('hash', '%s ', hex(fc.filenode()))
> > > > >              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
> > > > > +
> > > > >
> > > >
> > > > Add a test for working copy too? Including modified, added and
> removed
> > > > files, ideally.
> > >
> > > In fact, I think we should aim for the output being the same format
> with
> > > --debug on the working copy. In particular, unchanged files should
> > > probably show the filenode from the parent.
> >
> >
> > With a '+' suffix? I saw that you accepted Sid's series that added a '+'
> > suffix to annotate ouput (if I understood right from skimming).
>
> Well.. unchanged files should probably just show the parent node, right?
>

Ooh, I missed the "unchanged" part. Then I definitely agree. Sorry about
the noise.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2271,6 +2271,8 @@ 
         fm.startitem()
         if ui.verbose:
             fc = ctx[f]
+            if ui.debugflag and fc.filenode():
+                fm.write('hash', '%s ', hex(fc.filenode()))
             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