##// 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:

r22676:a014fdc9 default
r24158:d414c28d stable
Show More
test-fetch.t
431 lines | 12.5 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: replace exit 80 with #require
r22046 #require serve
Mads Kiilerich
tests: use 'hghave serve' to guard tests that requires serve daemon management
r15446
Matt Mackall
tests: unify test-fetch
r12426 $ echo "[extensions]" >> $HGRCPATH
$ echo "fetch=" >> $HGRCPATH
test fetch with default branches only
$ hg init a
$ echo a > a/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd a commit -Ama
Matt Mackall
tests: unify test-fetch
r12426 adding a
$ hg clone a b
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone a c
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo b > a/b
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd a commit -Amb
Matt Mackall
tests: unify test-fetch
r12426 adding b
$ hg --cwd a parents -q
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 1:d2ae7f538514
Matt Mackall
tests: unify test-fetch
r12426
should pull one change
$ hg --cwd b fetch ../a
pulling from ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg --cwd b parents -q
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 1:d2ae7f538514
Matt Mackall
tests: unify test-fetch
r12426 $ echo c > c/c
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd c commit -Amc
Matt Mackall
tests: unify test-fetch
r12426 adding c
$ hg clone c d
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone c e
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
We cannot use the default commit message if fetching from a local
repo, because the path of the repo will be included in the commit
message, making every commit appear different.
should merge c into a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd c fetch -d '0 0' -m 'automated merge' ../a
Matt Mackall
tests: unify test-fetch
r12426 pulling from ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 updating to 2:d2ae7f538514
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 merging with 1:d36c0562f908
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 new changeset 3:a323a0c43ec4 merges remote changes with local
Matt Mackall
tests: unify test-fetch
r12426 $ ls c
a
b
c
$ hg --cwd a serve -a localhost -p $HGPORT -d --pid-file=hg.pid
$ cat a/hg.pid >> "$DAEMON_PIDS"
fetch over http, no auth
FUJIWARA Katsunori
fetch: use "getcommiteditor()" instead of explicit editor choice...
r21406 (this also tests that editor is invoked if '--edit' is specified)
Matt Mackall
tests: unify test-fetch
r12426
FUJIWARA Katsunori
fetch: use "getcommiteditor()" instead of explicit editor choice...
r21406 $ HGEDITOR=cat hg --cwd d fetch --edit http://localhost:$HGPORT/
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 pulling from http://localhost:$HGPORT/
Matt Mackall
tests: unify test-fetch
r12426 searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 updating to 2:d2ae7f538514
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 merging with 1:d36c0562f908
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
FUJIWARA Katsunori
fetch: use "getcommiteditor()" instead of explicit editor choice...
r21406 Automated merge with http://localhost:$HGPORT/
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch merge
HG: branch 'default'
HG: changed c
Matt Mackall
tests: fix test-fetch port number variability
r12535 new changeset 3:* merges remote changes with local (glob)
Matt Mackall
tests: unify test-fetch
r12426 $ hg --cwd d tip --template '{desc}\n'
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 Automated merge with http://localhost:$HGPORT/
FUJIWARA Katsunori
fetch: use "getcommiteditor()" instead of explicit editor choice...
r21406 $ hg --cwd d status --rev 'tip^1' --rev tip
A c
$ hg --cwd d status --rev 'tip^2' --rev tip
A b
Matt Mackall
tests: unify test-fetch
r12426
fetch over http with auth (should be hidden in desc)
FUJIWARA Katsunori
fetch: use "getcommiteditor()" instead of explicit editor choice...
r21406 (this also tests that editor is not invoked if '--edit' is not
specified, even though commit message is not specified explicitly)
Matt Mackall
tests: unify test-fetch
r12426
FUJIWARA Katsunori
fetch: use "getcommiteditor()" instead of explicit editor choice...
r21406 $ HGEDITOR=cat hg --cwd e fetch http://user:password@localhost:$HGPORT/
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 pulling from http://user:***@localhost:$HGPORT/
Matt Mackall
tests: unify test-fetch
r12426 searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 updating to 2:d2ae7f538514
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 merging with 1:d36c0562f908
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Matt Mackall
tests: fix test-fetch port number variability
r12535 new changeset 3:* merges remote changes with local (glob)
Matt Mackall
tests: unify test-fetch
r12426 $ hg --cwd e tip --template '{desc}\n'
Mads Kiilerich
tests: reintroduce ":$HGPORT" in test output...
r12643 Automated merge with http://localhost:$HGPORT/
Matt Mackall
tests: unify test-fetch
r12426 $ hg clone a f
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone a g
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo f > f/f
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd f ci -Amf
Matt Mackall
tests: unify test-fetch
r12426 adding f
$ echo g > g/g
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd g ci -Amg
Matt Mackall
tests: unify test-fetch
r12426 adding g
$ hg clone -q f h
$ hg clone -q g i
should merge f into g
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg --cwd g fetch -d '0 0' --switch -m 'automated merge' ../f
Matt Mackall
tests: unify test-fetch
r12426 pulling from ../f
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 merging with 3:6343ca3eff20
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 new changeset 4:f7faa0b7d3c6 merges remote changes with local
Matt Mackall
tests: unify test-fetch
r12426 $ rm i/g
should abort, because i is modified
$ hg --cwd i fetch ../h
Martin von Zweigbergk
fetch: use cmdutil.bailifchanged()...
r22676 abort: uncommitted changes
Matt Mackall
tests: unify test-fetch
r12426 [255]
test fetch with named branches
$ hg init nbase
$ echo base > nbase/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R nbase ci -Am base
Matt Mackall
tests: unify test-fetch
r12426 adding a
$ hg -R nbase branch a
marked working directory as branch a
Matt Mackall
branch: warn on branching
r15615 (branches are permanent and global, did you want a bookmark?)
Matt Mackall
tests: unify test-fetch
r12426 $ echo a > nbase/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R nbase ci -m a
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R nbase up -C 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R nbase branch b
marked working directory as branch b
Matt Mackall
branch: warn on branching
r15615 (branches are permanent and global, did you want a bookmark?)
Matt Mackall
tests: unify test-fetch
r12426 $ echo b > nbase/b
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R nbase ci -Am b
Matt Mackall
tests: unify test-fetch
r12426 adding b
pull in change on foreign branch
$ hg clone nbase n1
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone nbase n2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R n1 up -C a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo aa > n1/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m a1
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n2 up -C b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n2 fetch -m 'merge' n1
Matt Mackall
tests: unify test-fetch
r12426 pulling from n1
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
parent should be 2 (no automatic update)
$ hg -R n2 parents --template '{rev}\n'
2
$ rm -fr n1 n2
pull in changes on both foreign and local branches
$ hg clone nbase n1
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone nbase n2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R n1 up -C a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo aa > n1/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m a1
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n1 up -C b
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo bb > n1/b
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m b1
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n2 up -C b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n2 fetch -m 'merge' n1
Matt Mackall
tests: unify test-fetch
r12426 pulling from n1
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
parent should be 4 (fast forward)
$ hg -R n2 parents --template '{rev}\n'
4
$ rm -fr n1 n2
pull changes on foreign (2 new heads) and local (1 new head) branches
with a local change
$ hg clone nbase n1
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone nbase n2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R n1 up -C a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo a1 > n1/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m a1
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n1 up -C b
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo bb > n1/b
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m b1
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n1 up -C 1
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo a2 > n1/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m a2
Matt Mackall
tests: unify test-fetch
r12426 created new head
$ hg -R n2 up -C b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo change >> n2/c
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n2 ci -A -m local
Matt Mackall
tests: unify test-fetch
r12426 adding c
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n2 fetch -d '0 0' -m 'merge' n1
Matt Mackall
tests: unify test-fetch
r12426 pulling from n1
searching for changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 changes to 2 files (+2 heads)
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 updating to 5:3c4a837a864f
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 merging with 3:1267f84a9ea5
Matt Mackall
tests: unify test-fetch
r12426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 new changeset 7:2cf2a1261f21 merges remote changes with local
Matt Mackall
tests: unify test-fetch
r12426
parent should be 7 (new merge changeset)
$ hg -R n2 parents --template '{rev}\n'
7
$ rm -fr n1 n2
pull in changes on foreign (merge of local branch) and local (2 new
heads) with a local change
$ hg clone nbase n1
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg clone nbase n2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R n1 up -C a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R n1 merge b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m merge
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n1 up -C 2
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo c > n1/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m c
Matt Mackall
tests: unify test-fetch
r12426 $ hg -R n1 up -C 2
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo cc > n1/a
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n1 ci -m cc
Matt Mackall
tests: unify test-fetch
r12426 created new head
$ hg -R n2 up -C b
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo change >> n2/b
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n2 ci -A -m local
$ hg -R n2 fetch -m 'merge' n1
Matt Mackall
tests: unify test-fetch
r12426 pulling from n1
searching for changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 2 changes to 1 files (+2 heads)
not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them)
Matt Mackall
fetch: fix and document exit codes (issue2356)
r12711 [1]
Matt Mackall
tests: unify test-fetch
r12426
parent should be 3 (fetch did not merge anything)
$ hg -R n2 parents --template '{rev}\n'
3
$ rm -fr n1 n2
pull in change on different branch than dirstate
$ hg init n1
$ echo a > n1/a
$ hg -R n1 ci -Am initial
adding a
$ hg clone n1 n2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo b > n1/a
$ hg -R n1 ci -m next
$ hg -R n2 branch topic
marked working directory as branch topic
Matt Mackall
branch: warn on branching
r15615 (branches are permanent and global, did you want a bookmark?)
Mads Kiilerich
tests: cleanup of test-fetch.t
r15244 $ hg -R n2 fetch -m merge n1
Matt Mackall
tests: unify test-fetch
r12426 abort: working dir not at branch tip (use "hg update" to check out branch tip)
[255]
parent should be 0 (fetch did not update or merge anything)
$ hg -R n2 parents --template '{rev}\n'
0
$ rm -fr n1 n2
test fetch with inactive branches
$ hg init ib1
$ echo a > ib1/a
$ hg --cwd ib1 ci -Am base
adding a
$ hg --cwd ib1 branch second
marked working directory as branch second
Matt Mackall
branch: warn on branching
r15615 (branches are permanent and global, did you want a bookmark?)
Matt Mackall
tests: unify test-fetch
r12426 $ echo b > ib1/b
$ hg --cwd ib1 ci -Am onsecond
adding b
$ hg --cwd ib1 branch -f default
marked working directory as branch default
Matt Mackall
branch: warn on branching
r15615 (branches are permanent and global, did you want a bookmark?)
Matt Mackall
tests: unify test-fetch
r12426 $ echo c > ib1/c
$ hg --cwd ib1 ci -Am newdefault
adding c
created new head
$ hg clone ib1 ib2
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
fetch should succeed
$ hg --cwd ib2 fetch ../ib1
pulling from ../ib1
searching for changes
no changes found
$ rm -fr ib1 ib2
test issue1726
$ hg init i1726r1
$ echo a > i1726r1/a
$ hg --cwd i1726r1 ci -Am base
adding a
$ hg clone i1726r1 i1726r2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo b > i1726r1/a
$ hg --cwd i1726r1 ci -m second
$ echo c > i1726r2/a
$ hg --cwd i1726r2 ci -m third
$ HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1
pulling from ../i1726r1
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
updating to 2:7837755a2789
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
merging with 1:d1f0c6c48ebd
merging a
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
new changeset 3:* merges remote changes with local (glob)
$ hg --cwd i1726r2 heads default --template '{rev}\n'
3
test issue2047
$ hg -q init i2047a
$ cd i2047a
$ echo a > a
$ hg -q ci -Am a
$ hg -q branch stable
$ echo b > b
$ hg -q ci -Am b
$ cd ..
$ hg -q clone -r 0 i2047a i2047b
$ cd i2047b
$ hg fetch ../i2047a
pulling from ../i2047a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
$ cd ..