Patchwork [5,of,5] posix: give checklink a fast path that cache the check file and is read only

login
register
mail settings
Submitter Martijn Pieters
Date Nov. 29, 2016, 8:43 p.m.
Message ID <CAJkXj+Y80qu-C1WLPcn1=Ju0ZU7GEpFQASCgshOgR99ip9cf7Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/17796/
State Not Applicable
Headers show

Comments

Martijn Pieters - Nov. 29, 2016, 8:43 p.m.
On 17 November 2016 at 18:44, Mads Kiilerich <mads@kiilerich.com> wrote:
>
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1421194526 -3600
> #      Wed Jan 14 01:15:26 2015 +0100
> # Node ID 73b671fbed41d82a5dd46e485c61ddb8afe42faf
> # Parent  5409e0c5e6c0764e802360a3912f7719885ba2b5
> posix: give checklink a fast path that cache the check file and is read
only

Unfortunately, this patch broke tests on OS X:

"/opt/homebrew/Cellar/python27/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
line 119, in copy
+      copyfile(src, dst)
+    File
"/opt/homebrew/Cellar/python27/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
line 82, in copyfile
+      with open(src, 'rb') as fsrc:
+  IOError: [Errno 2] No such file or directory: 'r3/.hg/cache/checklink'
+  [1]

 r4 has hardlinks in the working dir (not just inside .hg):

@@ -212,71 +229,18 @@
   2 r4/.hg/branch
   2 r4/.hg/cache/branch2-served
   2 r4/.hg/cache/checkisexec
-  2 r4/.hg/cache/checknoexec
-  2 r4/.hg/cache/rbc-names-v1
-  2 r4/.hg/cache/rbc-revs-v1
-  2 r4/.hg/dirstate
-  2 r4/.hg/hgrc
-  2 r4/.hg/last-message.txt
-  2 r4/.hg/requires
-  2 r4/.hg/store/00changelog.i
-  2 r4/.hg/store/00manifest.i
-  2 r4/.hg/store/data/d1/f2.d
-  2 r4/.hg/store/data/d1/f2.i
-  2 r4/.hg/store/data/f1.i
-  2 r4/.hg/store/fncache
-  2 r4/.hg/store/phaseroots
-  2 r4/.hg/store/undo
-  2 r4/.hg/store/undo.backup.fncache
-  2 r4/.hg/store/undo.backup.phaseroots
-  2 r4/.hg/store/undo.backupfiles
-  2 r4/.hg/store/undo.phaseroots
-  2 r4/.hg/undo.backup.dirstate
-  2 r4/.hg/undo.bookmarks
-  2 r4/.hg/undo.branch
-  2 r4/.hg/undo.desc
-  2 r4/.hg/undo.dirstate
-  2 r4/d1/data1
-  2 r4/d1/f2
-  2 r4/f1

 Update back to revision 11 in r4 should break hardlink of file f1:

   $ hg -R r4 up 11
-  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  abort: index 00changelog.i unknown format 2!
+  [255]

   $ nlinksdir r4
   2 r4/.hg/00changelog.i
-  1 r4/.hg/branch
+  2 r4/.hg/branch
   2 r4/.hg/cache/branch2-served
   2 r4/.hg/cache/checkisexec
-  2 r4/.hg/cache/checknoexec
-  2 r4/.hg/cache/rbc-names-v1
-  2 r4/.hg/cache/rbc-revs-v1
-  1 r4/.hg/dirstate
-  2 r4/.hg/hgrc
-  2 r4/.hg/last-message.txt
-  2 r4/.hg/requires
-  2 r4/.hg/store/00changelog.i
-  2 r4/.hg/store/00manifest.i
-  2 r4/.hg/store/data/d1/f2.d
-  2 r4/.hg/store/data/d1/f2.i
-  2 r4/.hg/store/data/f1.i
-  2 r4/.hg/store/fncache
-  2 r4/.hg/store/phaseroots
-  2 r4/.hg/store/undo
-  2 r4/.hg/store/undo.backup.fncache
-  2 r4/.hg/store/undo.backup.phaseroots
-  2 r4/.hg/store/undo.backupfiles
-  2 r4/.hg/store/undo.phaseroots
-  2 r4/.hg/undo.backup.dirstate
-  2 r4/.hg/undo.bookmarks
-  2 r4/.hg/undo.branch
-  2 r4/.hg/undo.desc
-  2 r4/.hg/undo.dirstate
-  2 r4/d1/data1
-  2 r4/d1/f2
-  1 r4/f1


 Test hardlinking outside hg:
@@ -358,18 +322,39 @@

   $ cd ..
   $ linkcp b c
+  Traceback (most recent call last):
+    File "$TESTTMP/linkcp.py", line 3, in <module>
+      util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1110, in copyfiles
+      hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1110, in copyfiles
+      hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1110, in copyfiles
+      hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1118, in copyfiles
+      shutil.copy(src, dst)
+    File
"/opt/homebrew/Cellar/python27/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
line 119, in copy
+      copyfile(src, dst)
+    File
"/opt/homebrew/Cellar/python27/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
line 82, in copyfile
+      with open(src, 'rb') as fsrc:
+  IOError: [Errno 2] No such file or directory: 'b/.hg/cache/checklink'
+  [1]
   $ cd c

   $ hg tag -l -r 0 lbar
+  abort: index 00changelog.i unknown format 2!
+  [255]
   $ hg tag -r 0 bar
+  abort: index 00changelog.i unknown format 2!
+  [255]

   $ cat .hgtags
-  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo
-  430ed4828a74fa4047bc816a25500f7472ab4bfe bar
+  cat: .hgtags: No such file or directory
+  [1]

   $ cat .hg/localtags
-  4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c lfoo
-  430ed4828a74fa4047bc816a25500f7472ab4bfe lbar
+  cat: .hg/localtags: No such file or directory
+  [1]

   $ cat ../b/.hgtags
   4e7abb4840c46a910f6d7b4d3c3fc7e5209e684c foo

ERROR: test-hardlinks.t output changed

I'm taking a look now to see what can be done to fix this.

--
Martijn Pieters
Martijn Pieters - Nov. 29, 2016, 9:31 p.m.
On 29 November 2016 at 20:43, Martijn Pieters <mj@zopatista.com> wrote:

> On 17 November 2016 at 18:44, Mads Kiilerich <mads@kiilerich.com> wrote:
> >
> > # HG changeset patch
> > # User Mads Kiilerich <madski@unity3d.com>
> > # Date 1421194526 -3600
> > #      Wed Jan 14 01:15:26 2015 +0100
> > # Node ID 73b671fbed41d82a5dd46e485c61ddb8afe42faf
> > # Parent  5409e0c5e6c0764e802360a3912f7719885ba2b5
> > posix: give checklink a fast path that cache the check file and is read
> only
>
> Unfortunately, this patch broke tests on OS X:
>

and I'm way behind the times, it appears. I see that this also broke
Solaris, and that a patch is in the works.

Any ETA on that Mads, or is it now stuck in limbo? Can I help?

Patch

--- test-subrepo.t
+++ test-subrepo.t.err
@@ -1519,7 +1519,13 @@ 
 (issue3781)

   $ cp -r main issue3781
+  cp: main/.hg/cache/checklink: No such file or directory
+  cp: main/s/.hg/cache/checklink: No such file or directory
+  [1]
   $ cp -r main issue3781-dest
+  cp: main/.hg/cache/checklink: No such file or directory
+  cp: main/s/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd issue3781-dest/s
   $ hg phase tip # show we have draft changeset
   5: draft

ERROR: test-subrepo.t output changed
!.sss.s..!s.......
--- test-revert.t
+++ test-revert.t.err
@@ -785,6 +785,8 @@ 
 (setup from reference repo)

   $ cp -r revert-ref revert-parent-all
+  cp: revert-ref/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd revert-parent-all

 check revert output
@@ -842,6 +844,8 @@ 
 (setup from reference repo)

   $ cp -r revert-ref revert-base-all
+  cp: revert-ref/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd revert-base-all

 check revert output
@@ -897,6 +901,8 @@ 
 (setup from reference repo)

   $ cp -r revert-ref revert-parent-explicit
+  cp: revert-ref/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd revert-parent-explicit

 revert all files individually and check the output
@@ -990,6 +996,8 @@ 
 (setup from reference repo)

   $ cp -r revert-ref revert-base-explicit
+  cp: revert-ref/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd revert-base-explicit

 revert all files individually and check the output

ERROR: test-revert.t output changed
!.........s.......s.
--- test-bookmarks.t
+++ test-bookmarks.t.err
@@ -573,7 +573,11 @@ 
   $ hg bookmark -r3 Y
   moving bookmark 'Y' forward from db815d6d32e6
   $ cp -r  ../cloned-bookmarks-update ../cloned-bookmarks-manual-update
+  cp: ../cloned-bookmarks-update/.hg/cache/checklink: No such file or
directory
+  [1]
   $ cp -r  ../cloned-bookmarks-update
../cloned-bookmarks-manual-update-with-divergence
+  cp: ../cloned-bookmarks-update/.hg/cache/checklink: No such file or
directory
+  [1]

 (manual version)


ERROR: test-bookmarks.t output changed
!........s.........................................
--- test-histedit-obsolete.t
+++ test-histedit-obsolete.t.err
@@ -340,6 +340,8 @@ 
 New-commit as draft (default)

   $ cp -r base simple-draft
+  cp: base/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd simple-draft
   $ hg histedit -r 'b449568bf7fc' --commands - << EOF
   > edit b449568bf7fc 11 f
@@ -379,6 +381,8 @@ 
 New-commit as secret (config)

   $ cp -r base simple-secret
+  cp: base/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd simple-secret
   $ cat >> .hg/hgrc << EOF
   > [phases]
@@ -426,6 +430,8 @@ 
 It seems more important to present the secret phase.

   $ cp -r base reorder
+  cp: base/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd reorder
   $ hg histedit -r 'b449568bf7fc' --commands - << EOF
   > pick b449568bf7fc 11 f
@@ -463,6 +469,8 @@ 
 Note that there is a few reordering in this series for more extensive test

   $ cp -r base folding
+  cp: base/.hg/cache/checklink: No such file or directory
+  [1]
   $ cd folding
   $ cat >> .hg/hgrc << EOF
   > [phases]

ERROR: test-histedit-obsolete.t output changed
!..........s...s...........................................
--- test-hardlinks.t
+++ test-hardlinks.t.err
@@ -204,6 +204,23 @@ 
 Create hardlinked copy r4 of r3 (on Linux, we would call 'cp -al'):

   $ linkcp r3 r4
+  Traceback (most recent call last):
+    File "$TESTTMP/linkcp.py", line 3, in <module>
+      util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1110, in copyfiles
+      hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1110, in copyfiles
+      hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1110, in copyfiles
+      hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog)
+    File
"/private/var/folders/2x/7rw4n56d5bscpd1s9qglkm08000xbj/T/hgtests.er0Be9/install/lib/python/mercurial/util.py",
line 1118, in copyfiles
+      shutil.copy(src, dst)
+    File