[PATCH 3 of 3] cat: disable optimization of single file case for workingctx

Augie Fackler raf at durin42.com
Sat Apr 11 16:29:17 CDT 2015


On Sat, Apr 11, 2015 at 05:06:23PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1428207406 -32400
> #      Sun Apr 05 13:16:46 2015 +0900
> # Node ID f01f98bb99cf25317322cc5871635b6fe0cb0537
> # Parent  0ba34786c958ea24d33ca914546214982b729442
> cat: disable optimization of single file case for workingctx

queued these, thanks

>
> It crashes because workingctx has no manifest.
>
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -2403,7 +2403,7 @@ def cat(ui, repo, ctx, matcher, prefix,
>          file = matcher.files()[0]
>          mf = repo.manifest
>          mfnode = ctx.manifestnode()
> -        if mf.find(mfnode, file)[0]:
> +        if mfnode and mf.find(mfnode, file)[0]:
>              write(file)
>              return 0
>
> diff --git a/tests/test-cat.t b/tests/test-cat.t
> --- a/tests/test-cat.t
> +++ b/tests/test-cat.t
> @@ -63,3 +63,8 @@ Test fileset
>    tmp/h_45116003780e
>    tmp/r_2
>
> +Test working directory
> +
> +  $ echo b-wdir > b
> +  $ hg cat -r 'wdir()' b
> +  b-wdir
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list