Patchwork [2,of,2,STABLE] largefiles: add examination of exec bit in "hg status --rev REV" case

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Oct. 27, 2014, 4:18 p.m.
Message ID <2e61c15a19b94d8b1fcd.1414426709@feefifofum>
Download mbox | patch
Permalink /patch/6473/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - Oct. 27, 2014, 4:18 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1414426452 -32400
#      Tue Oct 28 01:14:12 2014 +0900
# Branch stable
# Node ID 2e61c15a19b94d8b1fcdbaa49076a3f0e8f6e0a1
# Parent  6b65dc22d61aeab57b6287f4a431c7d76856788c
largefiles: add examination of exec bit in "hg status --rev REV" case

Before this patch, "hg status --rev REV" doesn't list largefiles up
with "M" mark, even if exec bit of them is changed, because
"lfilesrepo.status" doesn't examine exec bit in such case.
Matt Mackall - Oct. 27, 2014, 8:05 p.m.
On Tue, 2014-10-28 at 01:18 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1414426452 -32400
> #      Tue Oct 28 01:14:12 2014 +0900
> # Branch stable
> # Node ID 2e61c15a19b94d8b1fcdbaa49076a3f0e8f6e0a1
> # Parent  6b65dc22d61aeab57b6287f4a431c7d76856788c
> largefiles: add examination of exec bit in "hg status --rev REV" case

These are queued for stable, thanks.

Patch

diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py
--- a/hgext/largefiles/reposetup.py
+++ b/hgext/largefiles/reposetup.py
@@ -174,8 +174,11 @@ 
                         for lfile in tocheck:
                             standin = lfutil.standin(lfile)
                             if standin in ctx1:
-                                if ctx1[standin].data().strip() != \
-                                        lfutil.hashfile(self.wjoin(lfile)):
+                                abslfile = self.wjoin(lfile)
+                                if ((ctx1[standin].data().strip() !=
+                                     lfutil.hashfile(abslfile)) or
+                                    (('x' in ctx1.flags(standin)) !=
+                                     bool(lfutil.getexecutable(abslfile)))):
                                     modified.append(lfile)
                                 elif listclean:
                                     clean.append(lfile)
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -552,4 +552,31 @@ 
   R largeX
   $ hg status -A --rev '.^1' largeX
 
+#if execbit
+
+Test that "hg status" against revisions other than parent notices exec
+bit changes of largefiles.
+
+  $ hg update -q -C 4
+
+(the case that large2 doesn't have exec bit in the target context but
+in the working context)
+
+  $ chmod +x large2
+  $ hg status -A --rev 0 large2
+  M large2
+  $ hg commit -m 'chmod +x large2'
+
+(the case that large2 has exec bit in the target context but not in
+the working context)
+
+  $ echo dummy > dummy
+  $ hg add dummy
+  $ hg commit -m 'revision for separation'
+  $ chmod -x large2
+  $ hg status -A --rev '.^1' large2
+  M large2
+
+#endif
+
   $ cd ..