[PATCH 2 of 2] status: don't list files as both clean and deleted
Augie Fackler
raf at durin42.com
Tue Jan 6 08:38:49 CST 2015
On Mon, Jan 05, 2015 at 05:21:42PM -0800, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1420506724 28800
> # Mon Jan 05 17:12:04 2015 -0800
> # Node ID 1e22a823c1889adfd8c3d92881f80603bb03d88e
> # Parent 16ccfb957c0659b60b5e1c9d2f1fe8bd3ed97a91
> status: don't list files as both clean and deleted
queued these, thanks.
>
> Tracked files that are deleted should always be reported as such, no
> matter what their state was in earlier revisions. This is encoded in
> in two conditions in the loop in basectx._buildstatus() for modified
> and added files, but the check is missing for clean files. We should
> check for clean files too, but instead of adding the check in a third
> place, move it earlier and skip most of the loop body for deleted
> files.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -140,16 +140,17 @@
> deletedset = set(deleted)
> withflags = mf1.withflags() | mf2.withflags()
> for fn, mf2node in mf2.iteritems():
> + if fn in deletedset:
> + continue
> if fn in mf1:
> - if (fn not in deletedset and
> - ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
> + if ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
> (mf1[fn] != mf2node and
> - (mf2node != _newnode or self[fn].cmp(other[fn]))))):
> + (mf2node != _newnode or self[fn].cmp(other[fn])))):
> modified.append(fn)
> elif listclean:
> clean.append(fn)
> del mf1[fn]
> - elif fn not in deletedset:
> + else:
> added.append(fn)
> removed = mf1.keys()
> if removed:
> diff --git a/tests/test-status-rev.t b/tests/test-status-rev.t
> --- a/tests/test-status-rev.t
> +++ b/tests/test-status-rev.t
> @@ -153,13 +153,10 @@
> R content1_missing_content1-untracked
> R content1_missing_content3-untracked
> R content1_missing_missing-untracked
> -BROKEN: content1_content*_missing-tracked appear twice; should just be '!'
> $ hg status -A --rev 0 'glob:*_*_missing-tracked'
> ! content1_content1_missing-tracked
> ! content1_content2_missing-tracked
> ! content1_missing_missing-tracked
> ! missing_content2_missing-tracked
> ! missing_missing_missing-tracked
> - C content1_content1_missing-tracked
> - C content1_content2_missing-tracked
> $ hg status -A --rev 0 'glob:missing_*_missing-untracked'
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list