Skip to content
Snippets Groups Projects
Commit 5516fdf3fe24 authored by hlian's avatar hlian
Browse files

largefiles: in putlfile, ensure tempfile's directory exists prior to creation

Let R be a repo served by an hg daemon on a machine with an empty largefiles
cache. Pushing a largefiles repo to R will result in a no-such-file-or-directory
OSError because putlfile will attempt to create a temporary file in
R/.hg/largefiles, which does not yet exist.

This patch also adds a regression test for this scenario.
parent e462313ef1bd
No related branches found
No related tags found
No related merge requests found
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
user cache.''' user cache.'''
proto.redirect() proto.redirect()
tmpfp = util.atomictempfile(lfutil.storepath(repo, sha), path = lfutil.storepath(repo, sha)
createmode=repo.store.createmode) util.makedirs(os.path.dirname(path))
tmpfp = util.atomictempfile(path, createmode=repo.store.createmode)
try: try:
try: try:
proto.getfile(tmpfp) proto.getfile(tmpfp)
......
...@@ -952,6 +952,31 @@ ...@@ -952,6 +952,31 @@
[255] [255]
$ rm -rf empty $ rm -rf empty
Push a largefiles repository to a served empty repository
$ hg init r8
$ echo c3 > r8/f1
$ hg add --large r8/f1 -R r8
$ hg commit -m "m1" -R r8
Invoking status precommit hook
A f1
$ hg init empty
$ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
> --config 'web.allow_push=*' --config web.push_ssl=False
$ cat hg.pid >> $DAEMON_PIDS
$ rm ${USERCACHE}/*
$ hg push -R r8 http://localhost:$HGPORT2
pushing to http://localhost:$HGPORT2/
searching for changes
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
$ rm -rf empty
used all HGPORTs, kill all daemons
$ "$TESTDIR/killdaemons.py"
Clone a local repository owned by another user Clone a local repository owned by another user
We have to simulate that here by setting $HOME and removing write permissions We have to simulate that here by setting $HOME and removing write permissions
$ ORIGHOME="$HOME" $ ORIGHOME="$HOME"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment