##// END OF EJS Templates
undo-files: clean existing files up before writing new one...
undo-files: clean existing files up before writing new one the in the initial design of journal/undo interaction, ages ago, new file always overwrote previous files. This is no longer the case for a long while, so it is time to properly clean things up before writing new ones. Otherwise, inconsistent "undo" state might exist on disk, leading `hg rollback` to misbehave (more that intended).

File last commit:

r51198:92734603 stable
r51198:92734603 stable
Show More
test-largefiles-cache.t
263 lines | 7.8 KiB | text/troff | Tads3Lexer
/ tests / test-largefiles-cache.t
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 Create user cache directory
$ USERCACHE=`pwd`/cache; export USERCACHE
$ cat <<EOF >> ${HGRCPATH}
> [extensions]
> hgext.largefiles=
> [largefiles]
> usercache=${USERCACHE}
> EOF
$ mkdir -p ${USERCACHE}
Create source repo, and commit adding largefile.
$ hg init src
$ cd src
$ echo large > large
$ hg add --large large
$ hg commit -m 'add largefile'
Mads Kiilerich
tests: don't rely on broken behaviour in test-largefiles-cache.t...
r18723 $ hg rm large
Matt Harbison
largefiles: fix an explicit largefile commit after a remove (issue4969)...
r27942 $ hg commit -m 'branchhead without largefile' large
Mads Kiilerich
tests: don't rely on broken behaviour in test-largefiles-cache.t...
r18723 $ hg up -qr 0
Matt Harbison
largefiles: prevent committing a missing largefile...
r27947 $ rm large
$ echo "0000000000000000000000000000000000000000" > .hglf/large
$ hg commit -m 'commit missing file with corrupt standin' large
abort: large: file not found!
[255]
$ hg up -Cqr 0
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 $ cd ..
Discard all cached largefiles in USERCACHE
$ rm -rf ${USERCACHE}
Matt Mackall
tests: fix trailing whitespace
r15478 Create mirror repo, and pull from source without largefile:
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 "pull" is used instead of "clone" for suppression of (1) updating to
Mads Kiilerich
spelling: fixes from spell checker
r21024 tip (= caching largefile from source repo), and (2) recording source
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 repo as "default" path in .hg/hgrc.
$ hg init mirror
$ cd mirror
$ hg pull ../src
pulling from ../src
requesting all changes
adding changesets
adding manifests
adding file changes
Mads Kiilerich
tests: don't rely on broken behaviour in test-largefiles-cache.t...
r18723 added 2 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets eb85d9124f3f:26c18ce05e4e
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 (run 'hg update' to get a working copy)
Update working directory to "tip", which requires largefile("large"),
but there is no cache file for it. So, hg must treat it as
"missing"(!) file.
Mads Kiilerich
tests: don't rely on broken behaviour in test-largefiles-cache.t...
r18723 $ hg update -r0
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 getting changed largefiles
Simon Heimberg
tests: lines with largefile .* file://$TESTTMP also match on windows...
r20471 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 0 largefiles updated, 0 removed
Benoit Boissinot
largefiles: fix largefiles+subrepo update (issue3752)...
r18459 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 $ hg status
! large
Update working directory to null: this cleanup .hg/largefiles/dirstate
$ hg update null
getting changed largefiles
0 largefiles updated, 0 removed
Benoit Boissinot
largefiles: fix largefiles+subrepo update (issue3752)...
r18459 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472
Update working directory to tip, again.
Mads Kiilerich
tests: don't rely on broken behaviour in test-largefiles-cache.t...
r18723 $ hg update -r0
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 getting changed largefiles
Simon Heimberg
tests: lines with largefile .* file://$TESTTMP also match on windows...
r20471 large: largefile 7f7097b041ccf68cc5561e9600da4655d21c6d18 not available from file:/*/$TESTTMP/mirror (glob)
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 0 largefiles updated, 0 removed
Benoit Boissinot
largefiles: fix largefiles+subrepo update (issue3752)...
r18459 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
FUJIWARA Katsunori
largefiles: treat status of cache missed largefiles as "missing" correctly...
r15472 $ hg status
! large
Mads Kiilerich
tests: convert some hghave unix-permissions to #if
r16986 $ cd ..
Mads Kiilerich
largefiles: getstandinmatcher should not depend on existence of directories...
r18724 Verify that largefiles from pulled branchheads are fetched, also to an empty repo
$ hg init mirror2
$ hg -R mirror2 pull src -r0
pulling from src
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Denis Laxalde
transaction-summary: show the range of new revisions upon pull/unbundle (BC)...
r34662 new changesets eb85d9124f3f
Mads Kiilerich
largefiles: getstandinmatcher should not depend on existence of directories...
r18724 (run 'hg update' to get a working copy)
Mads Kiilerich
tests: convert some hghave unix-permissions to #if
r16986 #if unix-permissions
Martin Geisler
largefiles: use repo.store.createmode for new files in .hg/largefiles...
r16153
Portable way to print file permissions:
$ cat > ls-l.py <<EOF
Augie Fackler
tests: use $PYTHON in #! so we always use the right Python
r32938 > #!$PYTHON
Augie Fackler
tests: update test-largefiles-cache to pass our import checker
r33992 > import os
> import sys
Martin Geisler
largefiles: use repo.store.createmode for new files in .hg/largefiles...
r16153 > path = sys.argv[1]
Augie Fackler
tests: update test-largefiles-cache to pass our import checker
r33992 > print('%03o' % (os.lstat(path).st_mode & 0o777))
Martin Geisler
largefiles: use repo.store.createmode for new files in .hg/largefiles...
r16153 > EOF
$ chmod +x ls-l.py
Test that files in .hg/largefiles inherit mode from .hg/store, not
from file in working copy:
$ cd src
$ chmod 750 .hg/store
$ chmod 660 large
$ echo change >> large
$ hg commit -m change
Mads Kiilerich
tests: don't rely on broken behaviour in test-largefiles-cache.t...
r18723 created new head
Martin Geisler
largefiles: use repo.store.createmode for new files in .hg/largefiles...
r16153 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
640
Martin Geisler
largefiles: respect store.createmode in basestore.get...
r16154
Test permission of with files in .hg/largefiles created by update:
$ cd ../mirror
$ rm -r "$USERCACHE" .hg/largefiles # avoid links
$ chmod 750 .hg/store
$ hg pull ../src --update -q
$ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
640
Martin Geisler
largefiles: respect store.createmode and avoid extra file copy...
r16155
Test permission of files created by push:
$ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \
> --config "web.allow_push=*" --config web.push_ssl=no
$ cat hg.pid >> $DAEMON_PIDS
$ echo change >> large
$ hg commit -m change
$ rm -r "$USERCACHE"
$ hg push -q http://localhost:$HGPORT/
$ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9
640
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
$ cd ..
Mads Kiilerich
tests: convert some hghave unix-permissions to #if
r16986
#endif
Matt Harbison
largefiles: fix a spurious missing file warning with 'remove -A' (issue4053)...
r23618
Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say
Mads Kiilerich
spelling: fixes from proofreading of spell checker issues
r24180 it is missing, but a remove on a nonexistent unknown file still should. Same
Matt Harbison
largefiles: fix a spurious missing file warning with forget (issue4053)...
r23619 for a forget.)
Matt Harbison
largefiles: fix a spurious missing file warning with 'remove -A' (issue4053)...
r23618
$ cd src
$ touch x
$ hg add x
$ mv x y
$ hg remove -A x y ENOENT
ENOENT: * (glob)
not removing y: file is untracked
[1]
Matt Harbison
largefiles: fix a spurious missing file warning with forget (issue4053)...
r23619 $ hg add y
$ mv y z
$ hg forget y z ENOENT
ENOENT: * (glob)
not removing z: file is already untracked
[1]
Matt Harbison
largefiles: use the share source as the primary local store (issue4471)...
r24631
Largefiles are accessible from the share's store
$ cd ..
$ hg share -q src share_dst --config extensions.share=
$ hg -R share_dst update -r0
getting changed largefiles
1 largefiles updated, 0 removed
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo modified > share_dst/large
$ hg -R share_dst ci -m modified
created new head
Only dirstate is in the local store for the share, and the largefile is in the
share source's local store. Avoid the extra largefiles added in the unix
conditional above.
$ hash=`hg -R share_dst cat share_dst/.hglf/large`
$ echo $hash
e2fb5f2139d086ded2cb600d5a91a196e76bf020
$ find share_dst/.hg/largefiles/* | sort
share_dst/.hg/largefiles/dirstate
Pulkit Goyal
largefiles: add tr backup for largefilesdirstate...
r48983 share_dst/.hg/largefiles/undo.backup.dirstate
Matt Harbison
largefiles: use the share source as the primary local store (issue4471)...
r24631
$ find src/.hg/largefiles/* | egrep "(dirstate|$hash)" | sort
src/.hg/largefiles/dirstate
src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
Mads Kiilerich
largefiles: test coverage of handling of store corruption...
r26822
Henrik Stuart
largefiles: fix support for local largefiles while using share extension...
r29329 Verify that backwards compatibility is maintained for old storage layout
$ mv src/.hg/largefiles/$hash share_dst/.hg/largefiles
$ hg verify --quiet --lfa -R share_dst --config largefiles.usercache=
Mads Kiilerich
largefiles: test coverage of handling of store corruption...
r26822 Inject corruption into the largefiles store and see how update handles that:
$ cd src
Pierre-Yves David
update: change default destination to tipmost descendant (issue4673) (BC)...
r28065 $ hg up -qC tip
Mads Kiilerich
largefiles: test coverage of handling of store corruption...
r26822 $ cat large
modified
$ rm large
$ cat .hglf/large
e2fb5f2139d086ded2cb600d5a91a196e76bf020
$ mv .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 ..
$ echo corruption > .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
$ hg up -C
getting changed largefiles
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 large: data corruption in $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020 with hash 6a7bb2556144babe3899b25e5428123735bb1e27
Mads Kiilerich
largefiles: check hash of files in the store before copying to working dir...
r26823 0 largefiles updated, 0 removed
Mads Kiilerich
largefiles: test coverage of handling of store corruption...
r26822 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
Pulkit Goyal
update: show the commit to which we updated in case of multiple heads (BC)...
r32698 updated to "cd24c147f45c: modified"
Matt Harbison
test-largefiles: stabilize output for Windows...
r28887 [12] other heads for branch "default" (re)
Mads Kiilerich
largefiles: test coverage of handling of store corruption...
r26822 $ hg st
Mads Kiilerich
largefiles: check hash of files in the store before copying to working dir...
r26823 ! large
Mads Kiilerich
largefiles: test coverage of handling of store corruption...
r26822 ? z
$ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
Mads Kiilerich
largefiles: test coverage of error handling from putlfile...
r26824
#if serve
Test coverage of error handling from putlfile:
$ mkdir $TESTTMP/mirrorcache
$ hg serve -R ../mirror -d -p $HGPORT1 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache
$ cat hg.pid >> $DAEMON_PIDS
$ hg push http://localhost:$HGPORT1 -f --config files.usercache=nocache
pushing to http://localhost:$HGPORT1/
searching for changes
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 abort: remotestore: could not open file $TESTTMP/src/.hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020: HTTP Error 403: ssl required
Mads Kiilerich
largefiles: test coverage of error handling from putlfile...
r26824 [255]
$ rm .hg/largefiles/e2fb5f2139d086ded2cb600d5a91a196e76bf020
Test coverage of 'missing from store':
$ hg serve -R ../mirror -d -p $HGPORT2 --pid-file hg.pid --config largefiles.usercache=$TESTTMP/mirrorcache --config "web.allow_push=*" --config web.push_ssl=no
$ cat hg.pid >> $DAEMON_PIDS
$ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache
pushing to http://localhost:$HGPORT2/
searching for changes
abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
[255]
Mads Kiilerich
largefiles: introduce push --lfrev to control which revisions are pushed...
r28878 Verify that --lfrev controls which revisions are checked for largefiles to push
$ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev tip
pushing to http://localhost:$HGPORT2/
searching for changes
abort: largefile e2fb5f2139d086ded2cb600d5a91a196e76bf020 missing from store (needs to be uploaded)
[255]
$ hg push http://localhost:$HGPORT2 -f --config largefiles.usercache=nocache --lfrev null
pushing to http://localhost:$HGPORT2/
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files (+1 heads)
Mads Kiilerich
largefiles: test coverage of error handling from putlfile...
r26824 #endif