##// END OF EJS Templates
largefiles: access to specific fields only if largefiles enabled (issue4547)...
largefiles: access to specific fields only if largefiles enabled (issue4547) Even if largefiles extension is enabled in a repository, "repo" object, which isn't "largefiles.reposetup()"-ed, is passed to overridden functions in the cases below unexpectedly, because extensions are enabled for each repositories strictly. (1) clone without -U: (2) pull with -U: (3) pull with --rebase: combination of "enabled@src", "disabled@dst" and "not-required@src" cause this situation. largefiles requirement @src @dst @src result -------- -------- --------------- -------------------- enabled disabled not-required aborted unexpectedly required requirement error (intentional) -------- -------- --------------- -------------------- enabled enabled * success -------- -------- --------------- -------------------- disabled enabled * success (only for "pull") -------- -------- --------------- -------------------- disabled disabled not-required success required requirement error (intentional) -------- -------- --------------- -------------------- (4) update/revert with a subrepo disabling largefiles In these cases, overridden functions cause accessing to largefiles specific fields of not "largefiles.reposetup()"-ed "repo" object, and execution is aborted. - (1), (2), (4) cause accessing to "_lfstatuswriters" in "getstatuswriter()" invoked via "updatelfiles()" - (3) causes accessing to "_lfcommithooks" in "overriderebase()" For safe accessing to these fields, this patch examines whether passed "repo" object is "largefiles.reposetup()"-ed or not before accessing to them. This patch chooses examining existence of newly introduced "_largefilesenabled" instead of "_lfcommithooks" and "_lfstatuswriters" directly, because the former is better name for the generic "largefiles is enabled in this repo" mark than the latter. In the future, all other overridden functions should avoid largefiles specific processing for efficiency, and "_largefilesenabled" is better also for such purpose. BTW, "lfstatus" can't be used for such purpose, because some code paths set it forcibly regardless of existence of it in specified "repo" object.

File last commit:

r23462:afa3fbbc default
r24158:d414c28d stable
Show More
test-symlinks.t
275 lines | 5.0 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: replace exit 80 with #require
r22046 #require symlink
Nicolas Dumazet
tests: unify test-symlinks
r11798
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 == tests added in 0.7 ==
Nicolas Dumazet
tests: unify test-symlinks
r11798
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ hg init test-symlinks-0.7; cd test-symlinks-0.7;
John Coomes
add: use lexists so that broken symbolic links are added...
r23462 $ touch foo; ln -s foo bar; ln -s nonexistent baz
import with add and addremove -- symlink walking should _not_ screwup.
Nicolas Dumazet
tests: unify test-symlinks
r11798
John Coomes
add: use lexists so that broken symbolic links are added...
r23462 $ hg add
adding bar
adding baz
adding foo
$ hg forget bar baz foo
Nicolas Dumazet
tests: unify test-symlinks
r11798 $ hg addremove
adding bar
John Coomes
add: use lexists so that broken symbolic links are added...
r23462 adding baz
Nicolas Dumazet
tests: unify test-symlinks
r11798 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?'
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ cd ..
Nicolas Dumazet
tests: unify test-symlinks
r11798
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812
== fifo & ignore ==
Nicolas Dumazet
tests: unify test-symlinks
r11798 $ 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
timeless@mozdev.org
spelling: nonexistent
r17492 $ ln -s nonexistent dir/b.o
Nicolas Dumazet
tests: unify test-symlinks
r11798 $ 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
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ cd ..
== symlinks from outside the tree ==
Nicolas Dumazet
tests: unify test-symlinks
r11798
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; } || :
Mads Kiilerich
scmutil: localize and improve 'not under root' message
r18450 abort: ../z not under root '$TESTTMP/x'
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ cd ..
Nicolas Dumazet
tests: unify test-symlinks
r11798
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812
== cloning symlinks ==
$ hg init clone; cd clone;
Nicolas Dumazet
tests: unify test-symlinks
r11798
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 ..
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ hg clone clone clonedest
Nicolas Dumazet
tests: unify test-symlinks
r11798 updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812
== symlink and git diffs ==
Nicolas Dumazet
tests: unify test-symlinks
r11798 git symlink diff
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ cd clonedest
Nicolas Dumazet
tests: unify test-symlinks
r11798 $ 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
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812
== 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
Durham Goode
dirstate: walk returns None for files that have a symlink in their path...
r18625 $ hg status
! foo/a
? bar/a
? foo
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812
now addremove should remove old files
$ hg addremove
adding bar/a
adding foo
removing foo/a
Siddharth Agarwal
manifestmerge: local unknown, remote created: don't traverse symlinks...
r19157
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
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ 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
Dan Villiom Podlaski Christiansen
canonpath: allow canonicalization of non-existant paths...
r15797 $ hg add foo
$ hg cp foo "$TESTTMP/link/bar"
foo has not been committed yet, so no copy data will be stored for bar.
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ cd ..
$ hg init b
$ cd b
$ ln -s nothing dangling
$ hg commit -m 'commit symlink without adding' dangling
abort: dangling: file not tracked!
Matt Mackall
tests: add exit codes to unified tests
r12316 [255]
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 $ 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
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ "$TESTDIR/readlink.py" dangling
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 dangling -> nothing
$ rm dangling
$ ln -s void dangling
$ hg commit -m 'change symlink'
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ "$TESTDIR/readlink.py" dangling
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 dangling -> void
modifying link
$ rm dangling
$ ln -s empty dangling
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ "$TESTDIR/readlink.py" dangling
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 dangling -> empty
reverting to rev 0:
$ hg revert -r 0 -a
reverting dangling
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ "$TESTDIR/readlink.py" dangling
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 dangling -> nothing
backups:
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ "$TESTDIR/readlink.py" *.orig
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 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
Thomas Arendsen Hein
tests: make tests work if directory contains special characters...
r16350 $ "$TESTDIR/readlink.py" dangling dangling2
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812 dangling -> void
dangling2 -> void
Martin Geisler
tests: added a short description to issue numbers...
r12399 Issue995: hg copy -A incorrectly handles symbolic links
Nicolas Dumazet
tests: merge all 4 test-symlink* into test-symlinks
r11812
$ 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
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913 $ cd ..