[PATCH 1 of 1] manifest: add --local option to list current directory state (issue2140)

Adrian Buehlmann adrian at cadifra.com
Fri Apr 16 04:01:56 CDT 2010


On 16.04.2010 08:14, Nicolas Dumazet wrote:
> # HG changeset patch
> # User Nicolas Dumazet <nicdumz.commits at gmail.com>
> # Date 1271394625 -32400
> # Node ID 98028d5691a751140ec32c641c0bf14c1703252a
> # Parent  342b20693f5b21fae0da8ce8198b99521ff7e868
> manifest: add --local option to list current directory state (issue2140)
> 
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -11,7 +11,7 @@
>  import os, re, sys, difflib, time, tempfile
>  import hg, util, revlog, bundlerepo, extensions, copies, error
>  import patch, help, mdiff, url, encoding, templatekw
> -import archival, changegroup, cmdutil, sshserver, hbisect
> +import archival, changegroup, cmdutil, sshserver, hbisect, context
>  from hgweb import server, hgweb_mod, hgwebdir_mod
>  import merge as mergemod
>  import minirst
> @@ -2199,7 +2199,7 @@
>              count += 1
>      displayer.close()
>  
> -def manifest(ui, repo, node=None, rev=None):
> +def manifest(ui, repo, node=None, rev=None, local=False):
>      """output the current or given revision of the project manifest
>  
>      Print a list of version controlled files for the given revision.
> @@ -2216,8 +2216,15 @@
>      if not node:
>          node = rev
>  
> +    if local and node:
> +        raise util.Abort(_("--rev and --local are incompatible"))
> +
> +    if local:
> +        ctx = context.workingctx(repo)
> +    else:
> +        ctx = repo[node]
> +
>      decor = {'l':'644 @ ', 'x':'755 * ', '':'644   '}
> -    ctx = repo[node]
>      for f in ctx:
>          if ui.debugflag:
>              ui.write("%40s " % hex(ctx.manifest()[f]))

Side question:
What is ctx.manifest() supposed to return if ctx is a workingctx?
Shouldn't this be 'not defined' (i.e. abort)?


With this patch applied, it looks like hg manifest --local even emits
'unknown' files. Which is quite surprising.

And using both --local and --debug emits some strange hashes for
these (see file AAAAAAA.txt in the example below)

$ hg manifest --local --debug
a11f9b9644d48e9df7067121c2164ad6e7069994 644   .hgignore
4e4baadb7b91eb3f58b0f5cbabf65680df1d1704 644   .hgtags
000000000000000000000000000000000000000075 644   AAAAAAA.txt           <-----
86b4d83f715ca980a162de291d9bcfbed2a9e472 644   CONTRIBUTING.txt
1b3fe5fd6a73de01da4e2f425c87c04b4eba300f 644   COPYING.txt
907531e85857378b15eeb8679208e64e4c65b6d5 644   INSTALL.txt
e1366b2e0fffb2cee27e8e6ccc972196dbb9311c 644   MANIFEST.in
bac292999b85ae00927ae244c36fafb36b5ec6316d 644   ReleaseNotes.txt
9b1c34ca1f4c89975c571bb323a04c1ecf183d77 644   ReleaseProcedure.txt
084c8f2733f4b9ebe9f930356e9105c5c9139301 644   TortoiseHgOverlayServer.py
c8a7f14ac0577df20c0d40b39e9963ce49c3ce3b 644   contrib/_hgtk
708a24a64d7d919a077f4539aa9b76f422a9d4ae 644   contrib/bash_completion
adeabf3927c651dcd7d1ca814c50c11073dc6e1d 644   contrib/docdiff.py
...


More information about the Mercurial-devel mailing list