[PATCH 4 of 4] status: change + back out == clean (API)
Augie Fackler
raf at durin42.com
Mon Jan 11 21:18:17 CST 2016
On Sun, Jan 10, 2016 at 11:47:20PM -0600, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1451931209 28800
> # Mon Jan 04 10:13:29 2016 -0800
> # Node ID ab1516b36e44bfb32ed6f354a9dae2f2f6300add
> # Parent 4ea59d0f00be7bc44f1968c073a44274d67fa4f3
> status: change + back out == clean (API)
Queued these, thanks.
>
> After backing out a change, so the file contents is equal to a
> previous revision of itself, we currently report the status between
> the two equal revisions as modified. This is because
> context._buildstatus() reports any file whose new nodeid is not equal
> to _newnode as modified. That magic nodeid is given only to files
> added or modified in the working directory, so any file whose nodeid
> has changed between two revisions will be reported as modified.
>
> Fix by simply comparing the file contents for all cases where the
> nodeid changed, whether they are in the working copy or committed.
>
> Marking with (API) as it subtly changes the semantics of the method.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -140,15 +140,9 @@
> added.append(fn)
> elif node2 is None:
> removed.append(fn)
> - elif node2 != _newnode:
> - # The file was not a new file in mf2, so an entry
> - # from diff is really a difference.
> - modified.append(fn)
> elif flag1 != flag2:
> modified.append(fn)
> elif self[fn].cmp(other[fn]):
> - # node2 was newnode, but the working file doesn't
> - # match the one in mf1.
> modified.append(fn)
> else:
> clean.append(fn)
> diff --git a/tests/test-status.t b/tests/test-status.t
> --- a/tests/test-status.t
> +++ b/tests/test-status.t
> @@ -388,6 +388,14 @@
>
> #endif
>
> +reverted and commit change should appear clean
> +
> + $ hg revert -r 0 .
> + reverting file
> + $ hg ci -m a
> + $ hg status -A --rev 0 --rev 2
> + C file
> +
> $ cd ..
>
> hg status of binary file starting with '\1\n', a separator for metadata:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list