Mercurial > hg
view tests/test-symlinks.t @ 43256:00de32aa834e
copies: use an unfiltered repository for the changeset centric algorithm
Since the algorithm work form heads to ancestors, we don't need to check
filtering for anything but the two entries.
Using an unfiltered version is noticeably more efficient.
Some timing on the pypy repo:
revision: large amount; added files: large amount; rename small amount; c3b14617fbd7 9ba6ab77fd29
before: ! wall 2.717861 comb 2.720000 user 2.700000 sys 0.020000 (median of 10)
after: ! wall 2.582204 comb 2.580000 user 2.560000 sys 0.020000 (median of 10)
revision: large amount; added files: small amount; rename small amount; c3b14617fbd7 f650a9b140d2
before: ! wall 4.003146 comb 4.010000 user 3.970000 sys 0.040000 (median of 10)
after: ! wall 3.814613 comb 3.810000 user 3.760000 sys 0.050000 (median of 10)
revision: large amount; added files: large amount; rename large amount; 08ea3258278e d9fa043f30c0
before: ! wall 0.704204 comb 0.700000 user 0.700000 sys 0.000000 (median of 13)
after: ! wall 0.657387 comb 0.650000 user 0.640000 sys 0.010000 (best of 14)
revision: small amount; added files: large amount; rename large amount; df6f7a526b60 a83dc6a2d56f
before: ! wall 0.013493 comb 0.020000 user 0.020000 sys 0.000000 (median of 219)
after: ! wall 0.013523 comb 0.020000 user 0.020000 sys 0.000000 (median of 218)
revision: small amount; added files: large amount; rename small amount; 4aa4e1f8e19a 169138063d63
before: ! wall 0.003017 comb 0.000000 user 0.000000 sys 0.000000 (median of 985)
after: ! wall 0.002876 comb 0.000000 user 0.000000 sys 0.000000 (median of 1000)
revision: small amount; added files: small amount; rename small amount; 4bc173b045a6 964879152e2e
before: ! wall 0.000073 comb 0.000000 user 0.000000 sys 0.000000 (median of 12672)
after: ! wall 0.000082 comb 0.000000 user 0.000000 sys 0.000000 (median of 11456)
revision: medium amount; added files: large amount; rename medium amount; c95f1ced15f2 2c68e87c3efe
before: ! wall 0.478061 comb 0.470000 user 0.470000 sys 0.000000 (median of 19)
after: ! wall 0.452420 comb 0.450000 user 0.450000 sys 0.000000 (median of 21)
revision: medium amount; added files: medium amount; rename small amount; d343da0c55a8 d7746d32bf9d
before: ! wall 0.116015 comb 0.110000 user 0.110000 sys 0.000000 (median of 84)
after: ! wall 0.109153 comb 0.100000 user 0.100000 sys 0.000000 (median of 90)
Differential Revision: https://phab.mercurial-scm.org/D7123
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 15 Oct 2019 18:42:03 +0200 |
parents | 4d2b9b304ad0 |
children | 96ca817ec192 |
line wrap: on
line source
#require symlink == tests added in 0.7 == $ hg init test-symlinks-0.7; cd test-symlinks-0.7; $ touch foo; ln -s foo bar; ln -s nonexistent baz import with add and addremove -- symlink walking should _not_ screwup. $ hg add adding bar adding baz adding foo $ hg forget bar baz foo $ hg addremove adding bar adding baz adding foo commit -- the symlink should _not_ appear added to dir state $ hg commit -m 'initial' $ touch bomb again, symlink should _not_ show up on dir state $ hg addremove adding bomb Assert screamed here before, should go by without consequence $ hg commit -m 'is there a bug?' $ cd .. == fifo & ignore == $ hg init test; cd test; $ mkdir dir $ touch a.c dir/a.o dir/b.o test what happens if we want to trick hg $ hg commit -A -m 0 adding a.c adding dir/a.o adding dir/b.o $ echo "relglob:*.o" > .hgignore $ rm a.c $ rm dir/a.o $ rm dir/b.o $ mkdir dir/a.o $ ln -s nonexistent dir/b.o $ mkfifo a.c it should show a.c, dir/a.o and dir/b.o deleted $ hg status M dir/b.o ! a.c ! dir/a.o ? .hgignore $ hg status a.c a.c: unsupported file type (type is fifo) ! a.c $ cd .. == symlinks from outside the tree == test absolute path through symlink outside repo $ p=`pwd` $ hg init x $ ln -s x y $ cd x $ touch f $ hg add f $ hg status "$p"/y/f A f try symlink outside repo to file inside $ ln -s x/f ../z this should fail $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : abort: ../z not under root '$TESTTMP/x' $ cd .. == cloning symlinks == $ hg init clone; cd clone; try cloning symlink in a subdir 1. commit a symlink $ mkdir -p a/b/c $ cd a/b/c $ ln -s /path/to/symlink/source demo $ cd ../../.. $ hg stat ? a/b/c/demo $ hg commit -A -m 'add symlink in a/b/c subdir' adding a/b/c/demo 2. clone it $ cd .. $ hg clone clone clonedest updating to branch default 1 files updated, 0 files merged, 0 files removed, 0 files unresolved == symlink and git diffs == git symlink diff $ cd clonedest $ hg diff --git -r null:tip diff --git a/a/b/c/demo b/a/b/c/demo new file mode 120000 --- /dev/null +++ b/a/b/c/demo @@ -0,0 +1,1 @@ +/path/to/symlink/source \ No newline at end of file $ hg export --git tip > ../sl.diff import git symlink diff $ hg rm a/b/c/demo $ hg commit -m'remove link' $ hg import ../sl.diff applying ../sl.diff $ hg diff --git -r 1:tip diff --git a/a/b/c/demo b/a/b/c/demo new file mode 120000 --- /dev/null +++ b/a/b/c/demo @@ -0,0 +1,1 @@ +/path/to/symlink/source \ No newline at end of file == symlinks and addremove == directory moved and symlinked $ mkdir foo $ touch foo/a $ hg ci -Ama adding foo/a $ mv foo bar $ ln -s bar foo $ hg status ! foo/a ? bar/a ? foo now addremove should remove old files $ hg addremove adding bar/a adding foo removing foo/a commit and update back $ hg ci -mb $ hg up '.^' 1 files updated, 0 files merged, 2 files removed, 0 files unresolved $ hg up tip 2 files updated, 0 files merged, 1 files removed, 0 files unresolved $ cd .. == root of repository is symlinked == $ hg init root $ ln -s root link $ cd root $ echo foo > foo $ hg status ? foo $ hg status ../link ? foo $ hg add foo $ hg cp foo "$TESTTMP/link/bar" foo has not been committed yet, so no copy data will be stored for bar. $ cd .. $ hg init b $ cd b $ ln -s nothing dangling $ hg commit -m 'commit symlink without adding' dangling abort: dangling: file not tracked! [255] $ hg add dangling $ hg commit -m 'add symlink' $ hg tip -v changeset: 0:cabd88b706fc tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 files: dangling description: add symlink $ hg manifest --debug 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling $ readlink.py dangling dangling -> nothing $ rm dangling $ ln -s void dangling $ hg commit -m 'change symlink' $ readlink.py dangling dangling -> void modifying link $ rm dangling $ ln -s empty dangling $ readlink.py dangling dangling -> empty reverting to rev 0: $ hg revert -r 0 -a reverting dangling $ readlink.py dangling dangling -> nothing backups: $ readlink.py *.orig dangling.orig -> empty $ rm *.orig $ hg up -C 1 files updated, 0 files merged, 0 files removed, 0 files unresolved copies $ hg cp -v dangling dangling2 copying dangling to dangling2 $ hg st -Cmard A dangling2 dangling $ readlink.py dangling dangling2 dangling -> void dangling2 -> void Issue995: hg copy -A incorrectly handles symbolic links $ hg up -C 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ mkdir dir $ ln -s dir dirlink $ hg ci -qAm 'add dirlink' $ mkdir newdir $ mv dir newdir/dir $ mv dirlink newdir/dirlink $ hg mv -A dirlink newdir/dirlink $ cd ..