##// END OF EJS Templates
lfs: teach the blob server to handle --prefix
Matt Harbison -
r37635:b03f2e0f default
parent child Browse files
Show More
@@ -215,8 +215,8 b' def _batchresponseobjects(req, objects, '
215
215
216 rsp['actions'] = {
216 rsp['actions'] = {
217 '%s' % action: {
217 '%s' % action: {
218 # TODO: Account for the --prefix, if any.
218 'href': '%s%s/.hg/lfs/objects/%s'
219 'href': '%s/.hg/lfs/objects/%s' % (req.baseurl, oid),
219 % (req.baseurl, req.apppath, oid),
220 # datetime.isoformat() doesn't include the 'Z' suffix
220 # datetime.isoformat() doesn't include the 'Z' suffix
221 "expires_at": expiresat.strftime('%Y-%m-%dT%H:%M:%SZ'),
221 "expires_at": expiresat.strftime('%Y-%m-%dT%H:%M:%SZ'),
222 'header': {
222 'header': {
@@ -38,7 +38,7 b' default cache, so it attempts to downloa'
38 $ hg --config "lfs.usercache=$TESTTMP/servercache" \
38 $ hg --config "lfs.usercache=$TESTTMP/servercache" \
39 > --config "lfs.url=null://" \
39 > --config "lfs.url=null://" \
40 > -R client push -q server
40 > -R client push -q server
41 $ rm -rf `hg config lfs.usercache`
41 $ mv `hg config lfs.usercache` $TESTTMP/servercache
42
42
43 Downloads fail...
43 Downloads fail...
44
44
@@ -65,3 +65,87 b' Downloads fail...'
65 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
65 $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
66 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
66 $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
67 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob)
67 $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 400 - (glob)
68
69 Blob URIs are correct when --prefix is used
70
71 $ rm -f $TESTTMP/access.log $TESTTMP/errors.log
72 $ hg --config "lfs.usercache=$TESTTMP/servercache" -R server serve -d \
73 > -p $HGPORT --pid-file=hg.pid --prefix=subdir/mount/point \
74 > -A $TESTTMP/access.log -E $TESTTMP/errors.log
75 $ cat hg.pid >> $DAEMON_PIDS
76
77 $ hg --config lfs.url=http://localhost:$HGPORT/subdir/mount/point/.git/info/lfs \
78 > clone --debug http://localhost:$HGPORT/subdir/mount/point cloned2
79 using http://localhost:$HGPORT/subdir/mount/point
80 sending capabilities command
81 query 1; heads
82 sending batch command
83 requesting all changes
84 sending getbundle command
85 bundle2-input-bundle: with-transaction
86 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
87 adding changesets
88 add changeset 525251863cad
89 adding manifests
90 adding file changes
91 adding lfs.bin revisions
92 added 1 changesets with 1 changes to 1 files
93 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
94 bundle2-input-part: total payload size 648
95 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
96 bundle2-input-part: "phase-heads" supported
97 bundle2-input-part: total payload size 24
98 bundle2-input-part: "cache:rev-branch-cache" supported
99 bundle2-input-part: total payload size 39
100 bundle2-input-bundle: 3 parts total
101 checking for updated bookmarks
102 updating the branch cache
103 new changesets 525251863cad
104 updating to branch default
105 resolving manifests
106 branchmerge: False, force: False, partial: False
107 ancestor: 000000000000, local: 000000000000+, remote: 525251863cad
108 Status: 200
109 Content-Length: 371
110 Content-Type: application/vnd.git-lfs+json
111 Date: $HTTP_DATE$
112 Server: testing stub value
113 {
114 "objects": [
115 {
116 "actions": {
117 "download": {
118 "expires_at": "$ISO_8601_DATE_TIME$"
119 "header": {
120 "Accept": "application/vnd.git-lfs"
121 }
122 "href": "http://localhost:$HGPORT/subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e"
123 }
124 }
125 "oid": "f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e"
126 "size": 20
127 }
128 ]
129 "transfer": "basic"
130 }
131 lfs: downloading f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e (20 bytes)
132 Status: 200
133 Content-Length: 20
134 Content-Type: application/octet-stream
135 Date: $HTTP_DATE$
136 Server: testing stub value
137 lfs: adding f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e to the usercache
138 lfs: processed: f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e
139 lfs.bin: remote created -> g
140 getting lfs.bin
141 lfs: found f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e in the local lfs store
142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143
144 $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
145
146 $ cat $TESTTMP/access.log $TESTTMP/errors.log
147 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=capabilities HTTP/1.1" 200 - (glob)
148 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
149 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
150 $LOCALIP - - [$LOGDATE$] "POST /subdir/mount/point/.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob)
151 $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e HTTP/1.1" 200 - (glob)
General Comments 0
You need to be logged in to leave comments. Login now