Submitter | Martin von Zweigbergk |
---|---|
Date | Jan. 6, 2016, 12:37 a.m. |
Message ID | <0ed2abb33fa6ea01e9d4.1452040654@waste.org> |
Download | mbox | patch |
Permalink | /patch/12545/ |
State | Accepted |
Headers | show |
Comments
I think this has been broken since Mercurial version < 2.0, so there is probably no urgency and this can be applied to the default branch if preferred. I have another patch that fixes status with different nodeid but same content, but I need to fix other brokenness in the convert extension before I can send that patch, so that will be another day/week/month.
On Tue, Jan 05, 2016 at 06:37:34PM -0600, Martin von Zweigbergk wrote: > # HG changeset patch > # User Martin von Zweigbergk <martinvonz@google.com> > # Date 1451929498 28800 > # Mon Jan 04 09:44:58 2016 -0800 > # Branch stable > # Node ID 0ed2abb33fa6ea01e9d4df6a544779f528aae2ca > # Parent 7c598947fbbd78b26989326c61345c6e46855bdc > status: revert + flag-change == modified Neat! Queued this for default, since it's not a regression on any meaningful timescale. > > After just changing the flag on a file, plain 'hg status' will report > the file as modified. However, after reverting a file to a previous > revision's state and changing the flag, it will be reported as clean. > > Fix by comparing the flags that were previously ignored in > context._buildstatus(). > > diff --git a/mercurial/context.py b/mercurial/context.py > --- a/mercurial/context.py > +++ b/mercurial/context.py > @@ -124,6 +124,8 @@ > # 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. > diff --git a/tests/test-status.t b/tests/test-status.t > --- a/tests/test-status.t > +++ b/tests/test-status.t > @@ -362,6 +362,34 @@ > > $ cd .. > > +hg status with --rev and reverted changes: > + > + $ hg init reverted-changes-repo > + $ cd reverted-changes-repo > + $ echo a > file > + $ hg add file > + $ hg ci -m a > + $ echo b > file > + $ hg ci -m b > + > +reverted file should appear clean > + > + $ hg revert -r 0 . > + reverting file > + $ hg status -A --rev 0 > + C file > + > +#if execbit > +reverted file with changed flag should appear modified > + > + $ chmod +x file > + $ hg status -A --rev 0 > + M file > + > +#endif > + > + $ cd .. > + > hg status of binary file starting with '\1\n', a separator for metadata: > > $ hg init repo5 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -124,6 +124,8 @@ # 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. diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -362,6 +362,34 @@ $ cd .. +hg status with --rev and reverted changes: + + $ hg init reverted-changes-repo + $ cd reverted-changes-repo + $ echo a > file + $ hg add file + $ hg ci -m a + $ echo b > file + $ hg ci -m b + +reverted file should appear clean + + $ hg revert -r 0 . + reverting file + $ hg status -A --rev 0 + C file + +#if execbit +reverted file with changed flag should appear modified + + $ chmod +x file + $ hg status -A --rev 0 + M file + +#endif + + $ cd .. + hg status of binary file starting with '\1\n', a separator for metadata: $ hg init repo5