Mercurial > hg
changeset 18459:c9db897d5a43 stable
largefiles: fix largefiles+subrepo update (issue3752)
Override updaterepo() instead of individual methods that may not be called for
each subrepo. Add test.
Based on patch from Matt Harbison.
Changes the order of update-related messages (now largefiles comes before the
global status).
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 23 Jan 2013 00:51:53 +0100 |
parents | 9354a8c1bded |
children | 877f1dc9263e |
files | hgext/largefiles/overrides.py hgext/largefiles/uisetup.py tests/test-issue3084.t tests/test-largefiles-cache.t tests/test-largefiles-small-disk.t tests/test-largefiles.t tests/test-lfconvert.t |
diffstat | 7 files changed, 82 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Mon Jan 21 13:47:14 2013 -0200 +++ b/hgext/largefiles/overrides.py Wed Jan 23 00:51:53 2013 +0100 @@ -669,18 +669,18 @@ finally: wlock.release() -def hgupdate(orig, repo, node): - # Only call updatelfiles the standins that have changed to save time - oldstandins = lfutil.getstandinsstate(repo) - result = orig(repo, node) - newstandins = lfutil.getstandinsstate(repo) - filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) - lfcommands.updatelfiles(repo.ui, repo, filelist=filelist, printmessage=True) - return result +def hgupdaterepo(orig, repo, node, overwrite): + if not overwrite: + # Only call updatelfiles on the standins that have changed to save time + oldstandins = lfutil.getstandinsstate(repo) -def hgclean(orig, repo, node, show_stats=True): - result = orig(repo, node, show_stats) - lfcommands.updatelfiles(repo.ui, repo) + result = orig(repo, node, overwrite) + + filelist = None + if not overwrite: + newstandins = lfutil.getstandinsstate(repo) + filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) + lfcommands.updatelfiles(repo.ui, repo, filelist=filelist) return result def hgmerge(orig, repo, node, force=None, remind=True):
--- a/hgext/largefiles/uisetup.py Mon Jan 21 13:47:14 2013 -0200 +++ b/hgext/largefiles/uisetup.py Wed Jan 23 00:51:53 2013 +0100 @@ -109,11 +109,7 @@ entry = extensions.wrapfunction(commands, 'revert', overrides.overriderevert) - # clone uses hg._update instead of hg.update even though they are the - # same function... so wrap both of them) - extensions.wrapfunction(hg, 'update', overrides.hgupdate) - extensions.wrapfunction(hg, '_update', overrides.hgupdate) - extensions.wrapfunction(hg, 'clean', overrides.hgclean) + extensions.wrapfunction(hg, 'updaterepo', overrides.hgupdaterepo) extensions.wrapfunction(hg, 'merge', overrides.hgmerge) extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
--- a/tests/test-issue3084.t Mon Jan 21 13:47:14 2013 -0200 +++ b/tests/test-issue3084.t Wed Jan 23 00:51:53 2013 +0100 @@ -16,9 +16,9 @@ $ hg commit -m "Add foo as a largefile" $ hg update -r 0 - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved getting changed largefiles 0 largefiles updated, 1 removed + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo "normal" > foo $ hg add foo
--- a/tests/test-largefiles-cache.t Mon Jan 21 13:47:14 2013 -0200 +++ b/tests/test-largefiles-cache.t Wed Jan 23 00:51:53 2013 +0100 @@ -45,27 +45,27 @@ "missing"(!) file. $ hg update - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles error getting 7f7097b041ccf68cc5561e9600da4655d21c6d18 from file:$TESTTMP/mirror for large: can't get file locally (glob) 0 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg status ! large Update working directory to null: this cleanup .hg/largefiles/dirstate $ hg update null - 0 files updated, 0 files merged, 1 files removed, 0 files unresolved getting changed largefiles 0 largefiles updated, 0 removed + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved Update working directory to tip, again. $ hg update - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles error getting 7f7097b041ccf68cc5561e9600da4655d21c6d18 from file:$TESTTMP/mirror for large: can't get file locally (glob) 0 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg status ! large $ cd ..
--- a/tests/test-largefiles-small-disk.t Mon Jan 21 13:47:14 2013 -0200 +++ b/tests/test-largefiles-small-disk.t Wed Jan 23 00:51:53 2013 +0100 @@ -57,7 +57,6 @@ adding file changes added 1 changesets with 1 changes to 1 files updating to branch default - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles abort: No space left on device [255]
--- a/tests/test-largefiles.t Mon Jan 21 13:47:14 2013 -0200 +++ b/tests/test-largefiles.t Wed Jan 23 00:51:53 2013 +0100 @@ -506,9 +506,9 @@ Test addremove with -R $ hg up -C - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 1 largefiles updated, 0 removed + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ rm normal3 $ rm sub/large4 $ echo "testing addremove with patterns" > testaddremove.dat @@ -524,9 +524,9 @@ Test 3364 $ hg clone . ../addrm updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd ../addrm $ cat >> .hg/hgrc <<EOF > [hooks] @@ -604,9 +604,9 @@ C sub2/large6 C sub2/large7 $ hg up -C '.^' - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 0 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg remove large $ hg addremove --traceback $ hg ci -m "removed large" @@ -715,9 +715,9 @@ $ hg clone . ../b updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd ../b $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 7:daea875e9014 add/edit more largefiles @@ -745,9 +745,9 @@ adding file changes added 4 changesets with 10 changes to 4 files updating to branch default - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 2 largefiles updated, 0 removed + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd c $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 3:9e8fbc4bce62 copy files @@ -767,9 +767,9 @@ tests update). $ hg update -r 1 - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 1 largefiles updated, 0 removed + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat large1 large11 $ cat sub/large2 @@ -781,17 +781,17 @@ $ rm "${USERCACHE}"/* $ hg clone --all-largefiles a a-backup updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved 8 additional largefiles cached $ rm "${USERCACHE}"/* $ hg clone --all-largefiles -u 0 a a-clone0 updating to branch default - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 2 largefiles updated, 0 removed + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved 9 additional largefiles cached $ hg -R a-clone0 sum parent: 0:30d30fe6a5be @@ -803,9 +803,9 @@ $ rm "${USERCACHE}"/* $ hg clone --all-largefiles -u 1 a a-clone1 updating to branch default - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 2 largefiles updated, 0 removed + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved 8 additional largefiles cached $ hg -R a-clone1 sum parent: 1:ce8896473775 @@ -828,9 +828,9 @@ $ hg clone ../a destination directory: a updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd .. Ensure base clone command argument validation @@ -854,9 +854,9 @@ adding file changes added 2 changesets with 8 changes to 4 files updating to branch default - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 2 largefiles updated, 0 removed + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved $ rm "${USERCACHE}"/* $ cd a-backup $ hg pull --all-largefiles --config paths.default-push=bogus/path @@ -877,9 +877,9 @@ $ hg clone a d updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd b $ echo large4-modified > sub/large4 $ echo normal3-modified > normal3 @@ -897,9 +897,9 @@ $ cd .. $ hg clone d e updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd d More rebase testing, but also test that the largefiles are downloaded from @@ -1065,9 +1065,9 @@ $ hg revert sub2/large7 $ hg -q update --clean -r null $ hg update --clean - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat normal3 normal3-modified $ cat sub/normal4 @@ -1086,22 +1086,22 @@ demonstrate misfeature: .orig file is overwritten on every update -C, also when clean: $ hg update --clean - 0 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 0 largefiles updated, 0 removed + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat sub2/large7.orig large7 $ rm sub2/large7.orig .hglf/sub2/large7.orig Now "update check" is happy. $ hg update --check 8 - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 1 largefiles updated, 0 removed + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg update --check - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 1 largefiles updated, 0 removed + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved Test removing empty largefiles directories on update $ test -d sub2 && echo "sub2 exists" @@ -1190,14 +1190,14 @@ adding file changes added 8 changesets with 24 changes to 10 files updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg clone temp f updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved # Delete the largefiles in the largefiles system cache so that we have an # opportunity to test that caching after a pull works. $ rm "${USERCACHE}"/* @@ -1289,9 +1289,9 @@ adding file changes added 9 changesets with 26 changes to 10 files updating to branch default - 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 3 largefiles updated, 0 removed + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd g $ hg transplant -s ../d 598410d3eb9a searching for changes @@ -1551,7 +1551,6 @@ .hglf/f1: remote created -> g updating: .hglf/f1 1/1 files (100.00%) getting .hglf/f1 - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles using http://localhost:$HGPORT2/ sending capabilities command @@ -1561,6 +1560,7 @@ sending getlfile command found 02a439e5c31c526465ab1a0ca1f431f76b827b90 in store 1 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ ls http-clone-usercache/* http-clone-usercache/02a439e5c31c526465ab1a0ca1f431f76b827b90 @@ -1601,9 +1601,9 @@ adding file changes added 1 changesets with 1 changes to 1 files updating to branch default - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 1 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd .. $ chmod -R u+w alice/pubrepo $ HOME="$ORIGHOME" @@ -1755,23 +1755,48 @@ A normal.txt Invoking status precommit hook M .hgsubstate - $ hg archive -S lf_subrepo_archive - $ find lf_subrepo_archive | sort - lf_subrepo_archive - lf_subrepo_archive/.hg_archival.txt - lf_subrepo_archive/.hgsub - lf_subrepo_archive/.hgsubstate - lf_subrepo_archive/a - lf_subrepo_archive/a/b - lf_subrepo_archive/a/b/c - lf_subrepo_archive/a/b/c/d - lf_subrepo_archive/a/b/c/d/e.large.txt - lf_subrepo_archive/a/b/c/d/e.normal.txt - lf_subrepo_archive/a/b/c/x - lf_subrepo_archive/a/b/c/x/y.normal.txt - lf_subrepo_archive/subrepo - lf_subrepo_archive/subrepo/large.txt - lf_subrepo_archive/subrepo/normal.txt + $ hg archive -S ../lf_subrepo_archive + $ find ../lf_subrepo_archive | sort + ../lf_subrepo_archive + ../lf_subrepo_archive/.hg_archival.txt + ../lf_subrepo_archive/.hgsub + ../lf_subrepo_archive/.hgsubstate + ../lf_subrepo_archive/a + ../lf_subrepo_archive/a/b + ../lf_subrepo_archive/a/b/c + ../lf_subrepo_archive/a/b/c/d + ../lf_subrepo_archive/a/b/c/d/e.large.txt + ../lf_subrepo_archive/a/b/c/d/e.normal.txt + ../lf_subrepo_archive/a/b/c/x + ../lf_subrepo_archive/a/b/c/x/y.normal.txt + ../lf_subrepo_archive/subrepo + ../lf_subrepo_archive/subrepo/large.txt + ../lf_subrepo_archive/subrepo/normal.txt + +Test update with subrepos. + + $ hg update 0 + getting changed largefiles + 0 largefiles updated, 1 removed + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg status -S + $ hg update tip + getting changed largefiles + 1 largefiles updated, 0 removed + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg status -S +# modify a large file + $ echo "modified" > subrepo/large.txt + $ hg st -S + M subrepo/large.txt +# update -C should revert the change. + $ hg update -C + getting changed largefiles + 1 largefiles updated, 0 removed + getting changed largefiles + 0 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg status -S Test archiving a revision that references a subrepo that is not yet cloned (see test-subrepo-recursion.t):
--- a/tests/test-lfconvert.t Mon Jan 21 13:47:14 2013 -0200 +++ b/tests/test-lfconvert.t Wed Jan 23 00:51:53 2013 +0100 @@ -78,9 +78,9 @@ "lfconvert" converts content correctly $ cd largefiles-repo $ hg up - 4 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 2 largefiles updated, 0 removed + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg locate .hglf/large .hglf/sub/maybelarge.dat @@ -187,9 +187,9 @@ normal1 stuff/normal2 $ hg update - 3 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 1 largefiles updated, 0 removed + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cat stuff/normal2 alsonormal blah