##// END OF EJS Templates
merge with stable
Matt Mackall -
r16166:5b0a4383 merge default
parent child Browse files
Show More
@@ -225,7 +225,7 b' class mercurial_sink(converter_sink):'
225 225
226 226 def hascommit(self, rev):
227 227 if not rev in self.repo and self.clonebranches:
228 raise util.Abort(_('revision %s not be found in destination '
228 raise util.Abort(_('revision %s not found in destination '
229 229 'repository (lookups with clonebranches=true '
230 230 'are not implemented)') % rev)
231 231 return rev in self.repo
@@ -1194,5 +1194,5 b' class svn_sink(converter_sink, commandli'
1194 1194 if rev in self.childmap:
1195 1195 return True
1196 1196 raise util.Abort(_('splice map revision %s not found in subversion '
1197 'child map (revision lookups are not implemented')
1197 'child map (revision lookups are not implemented)')
1198 1198 % rev)
@@ -8,8 +8,6 b''
8 8
9 9 '''base class for store implementations and store-related utility code'''
10 10
11 import os
12 import tempfile
13 11 import binascii
14 12 import re
15 13
@@ -75,13 +73,8 b' class basestore(object):'
75 73 ui.note(_('getting %s:%s\n') % (filename, hash))
76 74
77 75 storefilename = lfutil.storepath(self.repo, hash)
78 storedir = os.path.dirname(storefilename)
79
80 # No need to pass mode='wb' to fdopen(), since mkstemp() already
81 # opened the file in binary mode.
82 (tmpfd, tmpfilename) = tempfile.mkstemp(
83 dir=storedir, prefix=os.path.basename(filename))
84 tmpfile = os.fdopen(tmpfd, 'w')
76 tmpfile = util.atomictempfile(storefilename,
77 createmode=self.repo.store.createmode)
85 78
86 79 try:
87 80 hhash = binascii.hexlify(self._getfile(tmpfile, filename, hash))
@@ -93,14 +86,11 b' class basestore(object):'
93 86 if hhash != "":
94 87 ui.warn(_('%s: data corruption (expected %s, got %s)\n')
95 88 % (filename, hash, hhash))
96 tmpfile.close() # no-op if it's already closed
97 os.remove(tmpfilename)
89 tmpfile.discard() # no-op if it's already closed
98 90 missing.append(filename)
99 91 continue
100 92
101 if os.path.exists(storefilename): # Windows
102 os.remove(storefilename)
103 os.rename(tmpfilename, storefilename)
93 tmpfile.close()
104 94 lfutil.linktousercache(self.repo, hash)
105 95 success.append((filename, hhash))
106 96
@@ -13,7 +13,6 b' import errno'
13 13 import platform
14 14 import shutil
15 15 import stat
16 import tempfile
17 16
18 17 from mercurial import dirstate, httpconnection, match as match_, util, scmutil
19 18 from mercurial.i18n import _
@@ -237,11 +236,11 b' def copytostoreabsolute(repo, file, hash'
237 236 if inusercache(repo.ui, hash):
238 237 link(usercachepath(repo.ui, hash), storepath(repo, hash))
239 238 else:
240 dst = util.atomictempfile(storepath(repo, hash))
239 dst = util.atomictempfile(storepath(repo, hash),
240 createmode=repo.store.createmode)
241 241 for chunk in util.filechunkiter(open(file, 'rb')):
242 242 dst.write(chunk)
243 243 dst.close()
244 util.copymode(file, storepath(repo, hash))
245 244 linktousercache(repo, hash)
246 245
247 246 def linktousercache(repo, hash):
@@ -439,13 +438,6 b' def islfilesrepo(repo):'
439 438 return ('largefiles' in repo.requirements and
440 439 util.any(shortname + '/' in f[0] for f in repo.store.datafiles()))
441 440
442 def mkstemp(repo, prefix):
443 '''Returns a file descriptor and a filename corresponding to a temporary
444 file in the repo's largefiles store.'''
445 path = repo.join(longname)
446 util.makedirs(path)
447 return tempfile.mkstemp(prefix=prefix, dir=path)
448
449 441 class storeprotonotcapable(Exception):
450 442 def __init__(self, storetypes):
451 443 self.storetypes = storetypes
@@ -20,23 +20,22 b' def putlfile(repo, proto, sha):'
20 20 user cache.'''
21 21 proto.redirect()
22 22
23 fd, tmpname = lfutil.mkstemp(repo, prefix='hg-putlfile')
24 tmpfp = os.fdopen(fd, 'wb+')
23 tmpfp = util.atomictempfile(lfutil.storepath(repo, sha),
24 createmode=repo.store.createmode)
25 25 try:
26 26 try:
27 27 proto.getfile(tmpfp)
28 tmpfp.seek(0)
29 if sha != lfutil.hexsha1(tmpfp):
28 tmpfp._fp.seek(0)
29 if sha != lfutil.hexsha1(tmpfp._fp):
30 30 raise IOError(0, _('largefile contents do not match hash'))
31 31 tmpfp.close()
32 lfutil.copytostoreabsolute(repo, tmpname, sha)
32 lfutil.linktousercache(repo, sha)
33 33 except IOError, e:
34 34 repo.ui.warn(_('largefiles: failed to put %s into store: %s') %
35 35 (sha, e.strerror))
36 36 return wireproto.pushres(1)
37 37 finally:
38 tmpfp.close()
39 os.unlink(tmpname)
38 tmpfp.discard()
40 39
41 40 return wireproto.pushres(0)
42 41
@@ -1024,8 +1024,15 b' def walkchangerevs(repo, match, opts, pr'
1024 1024
1025 1025 return reversed(revs)
1026 1026 def iterfiles():
1027 pctx = repo['.']
1027 1028 for filename in match.files():
1028 yield filename, None
1029 if follow:
1030 if filename not in pctx:
1031 raise util.Abort(_('cannot follow file not in parent '
1032 'revision: "%s"') % filename)
1033 yield filename, pctx[filename].filenode()
1034 else:
1035 yield filename, None
1029 1036 for filename_node in copies:
1030 1037 yield filename_node
1031 1038 for file_, node in iterfiles():
@@ -2605,7 +2605,7 b' def graft(ui, repo, *revs, **opts):'
2605 2605 repo.dirstate.setparents(current.node(), nullid)
2606 2606 repo.dirstate.write()
2607 2607 # fix up dirstate for copies and renames
2608 cmdutil.duplicatecopies(repo, ctx.rev(), current.node())
2608 cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
2609 2609 # report any conflicts
2610 2610 if stats and stats[3] > 0:
2611 2611 # write out state for --continue
@@ -3,7 +3,7 b''
3 3
4 4 $ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
5 5
6 $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0
6 $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
7 7 contrib/check-code.py:0:
8 8 > # (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=', "don't use underbars in identifiers"),
9 9 warning: line over 80 characters
@@ -654,4 +654,3 b''
654 654 tests/test-walkrepo.py:0:
655 655 > print "Found %d repositories when I should have found 3" % (len(reposet),)
656 656 warning: line over 80 characters
657 [123]
@@ -115,6 +115,7 b' Convert from merge parent'
115 115 o 0 "1: add c" files: a b c
116 116
117 117 $ cd conv1
118 $ hg up -q
118 119
119 120 Check copy preservation
120 121
@@ -203,7 +203,7 b' Test clonebranches'
203 203 > --splicemap splicemap ordered ordered-hg3
204 204 initializing destination ordered-hg3 repository
205 205 scanning source...
206 abort: revision 717d54d67e6c31fd75ffef2ff3042bdd98418437 not be found in destination repository (lookups with clonebranches=true are not implemented)
206 abort: revision 717d54d67e6c31fd75ffef2ff3042bdd98418437 not found in destination repository (lookups with clonebranches=true are not implemented)
207 207 [255]
208 208
209 209 Test invalid dependency
@@ -1,3 +1,5 b''
1 $ "$TESTDIR/hghave" unix-permissions || exit 80
2
1 3 Create user cache directory
2 4
3 5 $ USERCACHE=`pwd`/cache; export USERCACHE
@@ -70,3 +72,50 b' Update working directory to tip, again.'
70 72 0 largefiles updated, 0 removed
71 73 $ hg status
72 74 ! large
75
76 Portable way to print file permissions:
77
78 $ cd ..
79 $ cat > ls-l.py <<EOF
80 > #!/usr/bin/env python
81 > import sys, os
82 > path = sys.argv[1]
83 > print '%03o' % (os.lstat(path).st_mode & 0777)
84 > EOF
85 $ chmod +x ls-l.py
86
87 Test that files in .hg/largefiles inherit mode from .hg/store, not
88 from file in working copy:
89
90 $ cd src
91 $ chmod 750 .hg/store
92 $ chmod 660 large
93 $ echo change >> large
94 $ hg commit -m change
95 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
96 640
97
98 Test permission of with files in .hg/largefiles created by update:
99
100 $ cd ../mirror
101 $ rm -r "$USERCACHE" .hg/largefiles # avoid links
102 $ chmod 750 .hg/store
103 $ hg pull ../src --update -q
104 $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea
105 640
106
107 Test permission of files created by push:
108
109 $ hg serve -R ../src -d -p $HGPORT --pid-file hg.pid \
110 > --config "web.allow_push=*" --config web.push_ssl=no
111 $ cat hg.pid >> $DAEMON_PIDS
112
113 $ echo change >> large
114 $ hg commit -m change
115
116 $ rm -r "$USERCACHE"
117
118 $ hg push -q http://localhost:$HGPORT/
119
120 $ ../ls-l.py ../src/.hg/largefiles/b734e14a0971e370408ab9bce8d56d8485e368a9
121 640
@@ -1,20 +1,28 b''
1 1 $ "$TESTDIR/hghave" execbit || exit 80
2 2
3 The g is crafted to have 2 filelog topological heads in a linear
4 changeset graph
5
3 6 $ hg init a
4
5 7 $ cd a
6 8 $ echo a > a
9 $ echo f > f
7 10 $ hg ci -Ama -d '1 0'
8 11 adding a
12 adding f
9 13
10 14 $ hg cp a b
15 $ hg cp f g
11 16 $ hg ci -mb -d '2 0'
12 17
13 18 $ mkdir dir
14 19 $ hg mv b dir
20 $ echo g >> g
21 $ echo f >> f
15 22 $ hg ci -mc -d '3 0'
16 23
17 24 $ hg mv a b
25 $ hg cp -f f g
18 26 $ echo a > d
19 27 $ hg add d
20 28 $ hg ci -md -d '4 0'
@@ -23,7 +31,7 b''
23 31 $ hg ci -me -d '5 0'
24 32
25 33 $ hg log a
26 changeset: 0:8580ff50825a
34 changeset: 0:9161b9aeaf16
27 35 user: test
28 36 date: Thu Jan 01 00:00:01 1970 +0000
29 37 summary: a
@@ -32,34 +40,34 b''
32 40 -f, directory
33 41
34 42 $ hg log -f dir
35 abort: cannot follow nonexistent file: "dir"
43 abort: cannot follow file not in parent revision: "dir"
36 44 [255]
37 45
38 46 -f, but no args
39 47
40 48 $ hg log -f
41 changeset: 4:66c1345dc4f9
49 changeset: 4:7e4639b4691b
42 50 tag: tip
43 51 user: test
44 52 date: Thu Jan 01 00:00:05 1970 +0000
45 53 summary: e
46 54
47 changeset: 3:7c6c671bb7cc
55 changeset: 3:2ca5ba701980
48 56 user: test
49 57 date: Thu Jan 01 00:00:04 1970 +0000
50 58 summary: d
51 59
52 changeset: 2:41dd4284081e
60 changeset: 2:f8954cd4dc1f
53 61 user: test
54 62 date: Thu Jan 01 00:00:03 1970 +0000
55 63 summary: c
56 64
57 changeset: 1:784de7cef101
65 changeset: 1:d89b0a12d229
58 66 user: test
59 67 date: Thu Jan 01 00:00:02 1970 +0000
60 68 summary: b
61 69
62 changeset: 0:8580ff50825a
70 changeset: 0:9161b9aeaf16
63 71 user: test
64 72 date: Thu Jan 01 00:00:01 1970 +0000
65 73 summary: a
@@ -67,11 +75,12 b''
67 75
68 76 one rename
69 77
78 $ hg up -q 2
70 79 $ hg log -vf a
71 changeset: 0:8580ff50825a
80 changeset: 0:9161b9aeaf16
72 81 user: test
73 82 date: Thu Jan 01 00:00:01 1970 +0000
74 files: a
83 files: a f
75 84 description:
76 85 a
77 86
@@ -79,8 +88,9 b' one rename'
79 88
80 89 many renames
81 90
91 $ hg up -q tip
82 92 $ hg log -vf e
83 changeset: 4:66c1345dc4f9
93 changeset: 4:7e4639b4691b
84 94 tag: tip
85 95 user: test
86 96 date: Thu Jan 01 00:00:05 1970 +0000
@@ -89,26 +99,26 b' many renames'
89 99 e
90 100
91 101
92 changeset: 2:41dd4284081e
102 changeset: 2:f8954cd4dc1f
93 103 user: test
94 104 date: Thu Jan 01 00:00:03 1970 +0000
95 files: b dir/b
105 files: b dir/b f g
96 106 description:
97 107 c
98 108
99 109
100 changeset: 1:784de7cef101
110 changeset: 1:d89b0a12d229
101 111 user: test
102 112 date: Thu Jan 01 00:00:02 1970 +0000
103 files: b
113 files: b g
104 114 description:
105 115 b
106 116
107 117
108 changeset: 0:8580ff50825a
118 changeset: 0:9161b9aeaf16
109 119 user: test
110 120 date: Thu Jan 01 00:00:01 1970 +0000
111 files: a
121 files: a f
112 122 description:
113 123 a
114 124
@@ -117,35 +127,36 b' many renames'
117 127
118 128 log -pf dir/b
119 129
130 $ hg up -q 3
120 131 $ hg log -pf dir/b
121 changeset: 2:41dd4284081e
132 changeset: 2:f8954cd4dc1f
122 133 user: test
123 134 date: Thu Jan 01 00:00:03 1970 +0000
124 135 summary: c
125 136
126 diff -r 784de7cef101 -r 41dd4284081e dir/b
137 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
127 138 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128 139 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
129 140 @@ -0,0 +1,1 @@
130 141 +a
131 142
132 changeset: 1:784de7cef101
143 changeset: 1:d89b0a12d229
133 144 user: test
134 145 date: Thu Jan 01 00:00:02 1970 +0000
135 146 summary: b
136 147
137 diff -r 8580ff50825a -r 784de7cef101 b
148 diff -r 9161b9aeaf16 -r d89b0a12d229 b
138 149 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
139 150 +++ b/b Thu Jan 01 00:00:02 1970 +0000
140 151 @@ -0,0 +1,1 @@
141 152 +a
142 153
143 changeset: 0:8580ff50825a
154 changeset: 0:9161b9aeaf16
144 155 user: test
145 156 date: Thu Jan 01 00:00:01 1970 +0000
146 157 summary: a
147 158
148 diff -r 000000000000 -r 8580ff50825a a
159 diff -r 000000000000 -r 9161b9aeaf16 a
149 160 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
150 161 +++ b/a Thu Jan 01 00:00:01 1970 +0000
151 162 @@ -0,0 +1,1 @@
@@ -155,39 +166,53 b' log -pf dir/b'
155 166 log -vf dir/b
156 167
157 168 $ hg log -vf dir/b
158 changeset: 2:41dd4284081e
169 changeset: 2:f8954cd4dc1f
159 170 user: test
160 171 date: Thu Jan 01 00:00:03 1970 +0000
161 files: b dir/b
172 files: b dir/b f g
162 173 description:
163 174 c
164 175
165 176
166 changeset: 1:784de7cef101
177 changeset: 1:d89b0a12d229
167 178 user: test
168 179 date: Thu Jan 01 00:00:02 1970 +0000
169 files: b
180 files: b g
170 181 description:
171 182 b
172 183
173 184
174 changeset: 0:8580ff50825a
185 changeset: 0:9161b9aeaf16
175 186 user: test
176 187 date: Thu Jan 01 00:00:01 1970 +0000
177 files: a
188 files: a f
178 189 description:
179 190 a
180 191
181 192
182 193
183 194
195 -f and multiple filelog heads
196
197 $ hg up -q 2
198 $ hg log -f g --template '{rev}\n'
199 2
200 1
201 0
202 $ hg up -q tip
203 $ hg log -f g --template '{rev}\n'
204 3
205 2
206 0
207
208
184 209 log copies with --copies
185 210
186 211 $ hg log -vC --template '{rev} {file_copies}\n'
187 212 4 e (dir/b)
188 3 b (a)
213 3 b (a)g (f)
189 214 2 dir/b (b)
190 1 b (a)
215 1 b (a)g (f)
191 216 0
192 217
193 218 log copies switch without --copies, with old filecopy template
@@ -203,16 +228,16 b' log copies switch with --copies'
203 228
204 229 $ hg log -vC --template '{rev} {file_copies_switch}\n'
205 230 4 e (dir/b)
206 3 b (a)
231 3 b (a)g (f)
207 232 2 dir/b (b)
208 1 b (a)
233 1 b (a)g (f)
209 234 0
210 235
211 236
212 237 log copies with hardcoded style and with --style=default
213 238
214 239 $ hg log -vC -r4
215 changeset: 4:66c1345dc4f9
240 changeset: 4:7e4639b4691b
216 241 tag: tip
217 242 user: test
218 243 date: Thu Jan 01 00:00:05 1970 +0000
@@ -223,7 +248,7 b' log copies with hardcoded style and with'
223 248
224 249
225 250 $ hg log -vC -r4 --style=default
226 changeset: 4:66c1345dc4f9
251 changeset: 4:7e4639b4691b
227 252 tag: tip
228 253 user: test
229 254 date: Thu Jan 01 00:00:05 1970 +0000
@@ -259,15 +284,15 b' log copies, execute bit set'
259 284 log -p d
260 285
261 286 $ hg log -pv d
262 changeset: 3:7c6c671bb7cc
287 changeset: 3:2ca5ba701980
263 288 user: test
264 289 date: Thu Jan 01 00:00:04 1970 +0000
265 files: a b d
290 files: a b d g
266 291 description:
267 292 d
268 293
269 294
270 diff -r 41dd4284081e -r 7c6c671bb7cc d
295 diff -r f8954cd4dc1f -r 2ca5ba701980 d
271 296 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
272 297 +++ b/d Thu Jan 01 00:00:04 1970 +0000
273 298 @@ -0,0 +1,1 @@
@@ -278,18 +303,18 b' log -p d'
278 303 log --removed file
279 304
280 305 $ hg log --removed -v a
281 changeset: 3:7c6c671bb7cc
306 changeset: 3:2ca5ba701980
282 307 user: test
283 308 date: Thu Jan 01 00:00:04 1970 +0000
284 files: a b d
309 files: a b d g
285 310 description:
286 311 d
287 312
288 313
289 changeset: 0:8580ff50825a
314 changeset: 0:9161b9aeaf16
290 315 user: test
291 316 date: Thu Jan 01 00:00:01 1970 +0000
292 files: a
317 files: a f
293 318 description:
294 319 a
295 320
@@ -298,10 +323,10 b' log --removed file'
298 323 log --removed revrange file
299 324
300 325 $ hg log --removed -v -r0:2 a
301 changeset: 0:8580ff50825a
326 changeset: 0:9161b9aeaf16
302 327 user: test
303 328 date: Thu Jan 01 00:00:01 1970 +0000
304 files: a
329 files: a f
305 330 description:
306 331 a
307 332
General Comments 0
You need to be logged in to leave comments. Login now