##// END OF EJS Templates
largefiles: update largefiles even if rebase is aborted by conflict...
FUJIWARA Katsunori -
r22288:4e255984 default
parent child Browse files
Show More
@@ -714,47 +714,6 b' def overriderevert(orig, ui, repo, *pats'
714 714 finally:
715 715 wlock.release()
716 716
717 def hgupdaterepo(orig, repo, node, overwrite):
718 wlock = repo.wlock()
719 try:
720 return _hgupdaterepo(orig, repo, node, overwrite)
721 finally:
722 wlock.release()
723
724 def _hgupdaterepo(orig, repo, node, overwrite):
725 if not overwrite:
726 # update standins for linear merge
727 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
728 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
729 [], False, False, False)
730 unsure, modified, added = s[:3]
731 for lfile in unsure + modified + added:
732 lfutil.updatestandin(repo, lfutil.standin(lfile))
733
734 # Only call updatelfiles on the standins that have changed to save time
735 oldstandins = lfutil.getstandinsstate(repo)
736
737 result = orig(repo, node, overwrite)
738
739 filelist = None
740 if not overwrite:
741 newstandins = lfutil.getstandinsstate(repo)
742 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
743 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist)
744 return result
745
746 def hgmerge(orig, repo, node, force=None, remind=True):
747 wlock = repo.wlock()
748 try:
749 return _hgmerge(orig, repo, node, force, remind)
750 finally:
751 wlock.release()
752
753 def _hgmerge(orig, repo, node, force, remind):
754 result = orig(repo, node, force, remind)
755 lfcommands.updatelfiles(repo.ui, repo)
756 return result
757
758 717 # When we rebase a repository with remotely changed largefiles, we need to
759 718 # take some extra care so that the largefiles are correctly updated in the
760 719 # working copy
@@ -1305,3 +1264,57 b' def mercurialsinkbefore(orig, sink):'
1305 1264 def mercurialsinkafter(orig, sink):
1306 1265 sink.repo._isconverting = False
1307 1266 orig(sink)
1267
1268 def mergeupdate(orig, repo, node, branchmerge, force, partial,
1269 *args, **kwargs):
1270 wlock = repo.wlock()
1271 try:
1272 # branch | | |
1273 # merge | force | partial | action
1274 # -------+-------+---------+--------------
1275 # x | x | x | linear-merge
1276 # o | x | x | branch-merge
1277 # x | o | x | overwrite (as clean update)
1278 # o | o | x | force-branch-merge (*1)
1279 # x | x | o | (*)
1280 # o | x | o | (*)
1281 # x | o | o | overwrite (as revert)
1282 # o | o | o | (*)
1283 #
1284 # (*) don't care
1285 # (*1) deprecated, but used internally (e.g: "rebase --collapse")
1286
1287 linearmerge = not branchmerge and not force and not partial
1288
1289 if linearmerge or (branchmerge and force and not partial):
1290 # update standins for linear-merge or force-branch-merge,
1291 # because largefiles in the working directory may be modified
1292 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1293 s = lfdirstate.status(match_.always(repo.root, repo.getcwd()),
1294 [], False, False, False)
1295 unsure, modified, added = s[:3]
1296 for lfile in unsure + modified + added:
1297 lfutil.updatestandin(repo, lfutil.standin(lfile))
1298
1299 if linearmerge:
1300 # Only call updatelfiles on the standins that have changed
1301 # to save time
1302 oldstandins = lfutil.getstandinsstate(repo)
1303
1304 result = orig(repo, node, branchmerge, force, partial, *args, **kwargs)
1305
1306 filelist = None
1307 if linearmerge:
1308 newstandins = lfutil.getstandinsstate(repo)
1309 filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
1310
1311 # suppress status message while automated committing
1312 printmessage = not (getattr(repo, "_isrebasing", False) or
1313 getattr(repo, "_istransplanting", False))
1314 lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
1315 printmessage=printmessage,
1316 normallookup=partial)
1317
1318 return result
1319 finally:
1320 wlock.release()
@@ -101,6 +101,8 b' def uisetup(ui):'
101 101 overrides.overridecalculateupdates)
102 102 entry = extensions.wrapfunction(merge, 'recordupdates',
103 103 overrides.mergerecordupdates)
104 entry = extensions.wrapfunction(merge, 'update',
105 overrides.mergeupdate)
104 106 entry = extensions.wrapfunction(filemerge, 'filemerge',
105 107 overrides.overridefilemerge)
106 108 entry = extensions.wrapfunction(cmdutil, 'copy',
@@ -117,9 +119,6 b' def uisetup(ui):'
117 119 entry = extensions.wrapfunction(commands, 'revert',
118 120 overrides.overriderevert)
119 121
120 extensions.wrapfunction(hg, 'updaterepo', overrides.hgupdaterepo)
121 extensions.wrapfunction(hg, 'merge', overrides.hgmerge)
122
123 122 extensions.wrapfunction(archival, 'archive', overrides.overridearchive)
124 123 extensions.wrapfunction(subrepo.hgsubrepo, 'archive',
125 124 overrides.hgsubrepoarchive)
@@ -29,10 +29,10 b' Normal file in the working copy, keeping'
29 29
30 30 $ echo "n" | hg merge --config ui.interactive=Yes
31 31 remote turned local normal file foo into a largefile
32 use (l)argefile or keep (n)ormal file? 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
32 use (l)argefile or keep (n)ormal file? getting changed largefiles
33 0 largefiles updated, 0 removed
34 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
33 35 (branch merge, don't forget to commit)
34 getting changed largefiles
35 0 largefiles updated, 0 removed
36 36
37 37 $ hg status
38 38 $ cat foo
@@ -43,10 +43,10 b' Normal file in the working copy, keeping'
43 43 $ hg update -q -C
44 44 $ echo "l" | hg merge --config ui.interactive=Yes
45 45 remote turned local normal file foo into a largefile
46 use (l)argefile or keep (n)ormal file? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
46 use (l)argefile or keep (n)ormal file? getting changed largefiles
47 1 largefiles updated, 0 removed
48 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 49 (branch merge, don't forget to commit)
48 getting changed largefiles
49 1 largefiles updated, 0 removed
50 50
51 51 $ hg status
52 52 M foo
@@ -71,10 +71,10 b' Largefile in the working copy, keeping t'
71 71 $ hg update -q -C -r 1
72 72 $ echo "n" | hg merge --config ui.interactive=Yes
73 73 remote turned local largefile foo into a normal file
74 keep (l)argefile or use (n)ormal file? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
74 keep (l)argefile or use (n)ormal file? getting changed largefiles
75 0 largefiles updated, 0 removed
76 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
75 77 (branch merge, don't forget to commit)
76 getting changed largefiles
77 0 largefiles updated, 0 removed
78 78
79 79 $ hg status
80 80 M foo
@@ -99,10 +99,10 b' Largefile in the working copy, keeping t'
99 99 $ hg update -q -C -r 1
100 100 $ echo "l" | hg merge --config ui.interactive=Yes
101 101 remote turned local largefile foo into a normal file
102 keep (l)argefile or use (n)ormal file? 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
102 keep (l)argefile or use (n)ormal file? getting changed largefiles
103 1 largefiles updated, 0 removed
104 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
103 105 (branch merge, don't forget to commit)
104 getting changed largefiles
105 1 largefiles updated, 0 removed
106 106
107 107 $ hg status
108 108
@@ -206,10 +206,10 b' Ancestor: normal Parent: normal= Paren'
206 206
207 207 $ hg up -Cqr normal=
208 208 $ hg merge -r large
209 getting changed largefiles
210 1 largefiles updated, 0 removed
209 211 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
210 212 (branch merge, don't forget to commit)
211 getting changed largefiles
212 1 largefiles updated, 0 removed
213 213 $ cat f
214 214 large
215 215
@@ -217,10 +217,10 b' swap'
217 217
218 218 $ hg up -Cqr large
219 219 $ hg merge -r normal=
220 getting changed largefiles
221 0 largefiles updated, 0 removed
220 222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
221 223 (branch merge, don't forget to commit)
222 getting changed largefiles
223 0 largefiles updated, 0 removed
224 224 $ cat f
225 225 large
226 226
@@ -233,10 +233,10 b' Ancestor: normal Parent: normal2 Paren'
233 233 use (c)hanged version or (d)elete? c
234 234 remote turned local normal file f into a largefile
235 235 use (l)argefile or keep (n)ormal file? l
236 getting changed largefiles
237 1 largefiles updated, 0 removed
236 238 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
237 239 (branch merge, don't forget to commit)
238 getting changed largefiles
239 1 largefiles updated, 0 removed
240 240 $ cat f
241 241 large
242 242
@@ -244,20 +244,20 b' Ancestor: normal Parent: normal2 Paren'
244 244 $ ( echo c; echo n ) | hg merge -r large --config ui.interactive=Yes
245 245 local changed f which remote deleted
246 246 use (c)hanged version or (d)elete? remote turned local normal file f into a largefile
247 use (l)argefile or keep (n)ormal file? 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
247 use (l)argefile or keep (n)ormal file? getting changed largefiles
248 0 largefiles updated, 0 removed
249 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
248 250 (branch merge, don't forget to commit)
249 getting changed largefiles
250 0 largefiles updated, 0 removed
251 251 $ cat f
252 252 normal2
253 253
254 254 $ hg up -Cqr normal2
255 255 $ echo d | hg merge -r large --config ui.interactive=Yes
256 256 local changed f which remote deleted
257 use (c)hanged version or (d)elete? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
257 use (c)hanged version or (d)elete? getting changed largefiles
258 1 largefiles updated, 0 removed
259 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
258 260 (branch merge, don't forget to commit)
259 getting changed largefiles
260 1 largefiles updated, 0 removed
261 261 $ cat f
262 262 large
263 263
@@ -269,10 +269,10 b' swap'
269 269 use (c)hanged version or leave (d)eleted? c
270 270 remote turned local largefile f into a normal file
271 271 keep (l)argefile or use (n)ormal file? l
272 getting changed largefiles
273 1 largefiles updated, 0 removed
272 274 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
273 275 (branch merge, don't forget to commit)
274 getting changed largefiles
275 1 largefiles updated, 0 removed
276 276 $ cat f
277 277 large
278 278
@@ -280,20 +280,20 b' swap'
280 280 $ ( echo c; echo n ) | hg merge -r normal2 --config ui.interactive=Yes
281 281 remote changed f which local deleted
282 282 use (c)hanged version or leave (d)eleted? remote turned local largefile f into a normal file
283 keep (l)argefile or use (n)ormal file? 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
283 keep (l)argefile or use (n)ormal file? getting changed largefiles
284 0 largefiles updated, 0 removed
285 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
284 286 (branch merge, don't forget to commit)
285 getting changed largefiles
286 0 largefiles updated, 0 removed
287 287 $ cat f
288 288 normal2
289 289
290 290 $ hg up -Cqr large
291 291 $ echo d | hg merge -r normal2 --config ui.interactive=Yes
292 292 remote changed f which local deleted
293 use (c)hanged version or leave (d)eleted? 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
293 use (c)hanged version or leave (d)eleted? getting changed largefiles
294 0 largefiles updated, 0 removed
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 296 (branch merge, don't forget to commit)
295 getting changed largefiles
296 0 largefiles updated, 0 removed
297 297 $ cat f
298 298 large
299 299
@@ -301,10 +301,10 b' Ancestor: large Parent: large= Paren'
301 301
302 302 $ hg up -Cqr large=
303 303 $ hg merge -r normal
304 getting changed largefiles
305 0 largefiles updated, 0 removed
304 306 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
305 307 (branch merge, don't forget to commit)
306 getting changed largefiles
307 0 largefiles updated, 0 removed
308 308 $ cat f
309 309 normal
310 310
@@ -326,20 +326,20 b' Ancestor: large Parent: large2 Paren'
326 326 use (c)hanged version or (d)elete? c
327 327 remote turned local largefile f into a normal file
328 328 keep (l)argefile or use (n)ormal file? l
329 getting changed largefiles
330 1 largefiles updated, 0 removed
329 331 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
330 332 (branch merge, don't forget to commit)
331 getting changed largefiles
332 1 largefiles updated, 0 removed
333 333 $ cat f
334 334 large2
335 335
336 336 $ hg up -Cqr large2
337 337 $ echo d | hg merge -r normal --config ui.interactive=Yes
338 338 local changed .hglf/f which remote deleted
339 use (c)hanged version or (d)elete? 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
339 use (c)hanged version or (d)elete? getting changed largefiles
340 0 largefiles updated, 0 removed
341 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
340 342 (branch merge, don't forget to commit)
341 getting changed largefiles
342 0 largefiles updated, 0 removed
343 343 $ cat f
344 344 normal
345 345
@@ -351,10 +351,10 b' swap'
351 351 use (c)hanged version or leave (d)eleted? c
352 352 remote turned local normal file f into a largefile
353 353 use (l)argefile or keep (n)ormal file? l
354 getting changed largefiles
355 1 largefiles updated, 0 removed
354 356 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
355 357 (branch merge, don't forget to commit)
356 getting changed largefiles
357 1 largefiles updated, 0 removed
358 358 $ cat f
359 359 large2
360 360
@@ -659,10 +659,10 b" merge action 'd' for 'local renamed dire"
659 659 R d1/f
660 660 $ hg merge
661 661 merging d2/f and d1/f to d2/f
662 getting changed largefiles
663 0 largefiles updated, 0 removed
662 664 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
663 665 (branch merge, don't forget to commit)
664 getting changed largefiles
665 0 largefiles updated, 0 removed
666 666 $ cd ..
667 667
668 668
@@ -725,10 +725,10 b' Merge conflicts:'
725 725 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
726 726 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
727 727 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
728 getting changed largefiles
729 1 largefiles updated, 0 removed
728 730 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
729 731 (branch merge, don't forget to commit)
730 getting changed largefiles
731 1 largefiles updated, 0 removed
732 732 $ cat f-different
733 733 1
734 734 $ cat f-same
@@ -36,10 +36,10 b' Test that "hg merge" updates largefiles '
36 36 $ cat .hglf/large1
37 37 4669e532d5b2c093a78eca010077e708a071bb64
38 38 $ hg merge --config debug.dirstate.delaywrite=2
39 getting changed largefiles
40 1 largefiles updated, 0 removed
39 41 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 42 (branch merge, don't forget to commit)
41 getting changed largefiles
42 1 largefiles updated, 0 removed
43 43 $ hg status -A large1
44 44 M large1
45 45 $ cat large1
@@ -67,10 +67,10 b' Test that "hg merge" updates largefiles '
67 67 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? merging normal1
68 68 warning: conflicts during merge.
69 69 merging normal1 incomplete! (edit conflicts, then use 'hg resolve --mark')
70 getting changed largefiles
71 1 largefiles updated, 0 removed
70 72 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
71 73 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
72 getting changed largefiles
73 1 largefiles updated, 0 removed
74 74 [1]
75 75 $ hg status -A large1
76 76 M large1
@@ -456,3 +456,33 b' Test that the internal linear merging wo'
456 456 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
457 457
458 458 $ cd ..
459 $ cd repo
460
461 Test that rebase updates largefiles in the working directory even if
462 it is aborted by conflict.
463
464 $ hg update -q -C 3
465 $ cat .hglf/large1
466 e5bb990443d6a92aaf7223813720f7566c9dd05b
467 $ cat large1
468 large1 in #3
469 $ hg rebase -s 1 -d 3 --keep --config ui.interactive=True <<EOF
470 > o
471 > EOF
472 largefile large1 has a merge conflict
473 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
474 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
475 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? merging normal1
476 warning: conflicts during merge.
477 merging normal1 incomplete! (edit conflicts, then use 'hg resolve --mark')
478 unresolved conflicts (see hg resolve, then hg rebase --continue)
479 [1]
480 $ cat .hglf/large1
481 58e24f733a964da346e2407a2bee99d9001184f5
482 $ cat large1
483 large1 in #1
484
485 $ hg rebase -q --abort
486 rebase aborted
487
488 $ cd ..
@@ -1603,11 +1603,11 b' Merge with revision with missing largefi'
1603 1603 A f
1604 1604 created new head
1605 1605 $ hg merge -r 6
1606 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1607 (branch merge, don't forget to commit)
1608 1606 getting changed largefiles
1609 1607 large3: largefile 7838695e10da2bb75ac1156565f40a2595fa2fa0 not available from file:/*/$TESTTMP/d (glob)
1610 1608 1 largefiles updated, 0 removed
1609 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
1610 (branch merge, don't forget to commit)
1611 1611
1612 1612 $ hg rollback -q
1613 1613 $ hg up -Cq
@@ -1661,10 +1661,10 b' correctly.'
1661 1661 ancestor was 971fb41e78fea4f8e0ba5244784239371cb00591
1662 1662 keep (l)ocal d846f26643bfa8ec210be40cc93cc6b7ff1128ea or
1663 1663 take (o)ther e166e74c7303192238d60af5a9c4ce9bef0b7928? l
1664 getting changed largefiles
1665 1 largefiles updated, 0 removed
1664 1666 3 files updated, 1 files merged, 0 files removed, 0 files unresolved
1665 1667 (branch merge, don't forget to commit)
1666 getting changed largefiles
1667 1 largefiles updated, 0 removed
1668 1668 $ hg commit -m "Merge repos e and f"
1669 1669 Invoking status precommit hook
1670 1670 M normal3
@@ -1695,10 +1695,10 b' Test status after merging with a branch '
1695 1695 M normal3
1696 1696 created new head
1697 1697 $ hg merge
1698 getting changed largefiles
1699 1 largefiles updated, 0 removed
1698 1700 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1699 1701 (branch merge, don't forget to commit)
1700 getting changed largefiles
1701 1 largefiles updated, 0 removed
1702 1702 $ hg status
1703 1703 M large
1704 1704
@@ -1742,7 +1742,7 b' Test that transplanting a largefile chan'
1742 1742 adding file changes
1743 1743 added 1 changesets with 2 changes to 2 files
1744 1744 getting changed largefiles
1745 1 largefiles updated, 0 removed
1745 0 largefiles updated, 0 removed
1746 1746 $ hg log --template '{rev}:{node|short} {desc|firstline}\n'
1747 1747 9:598410d3eb9a modify normal file largefile in repo d
1748 1748 8:a381d2c8c80e modify normal file and largefile in repo b
General Comments 0
You need to be logged in to leave comments. Login now