comparison tests/test-git-import.t @ 14452:ee574cfd0c32

patch: use temporary files to handle intermediate copies git patches may require copies to be handled out-of-order. For instance, take the following sequence: * modify a * copy a into b Here, we have to generate b from a before its modification. To do so, applydiff() was scanning for copy metadata and performing the copies before processing the other changes in-order. While smart and efficient, this approach complicates things by handling file copies and file creations at different places and times. While a new file must not exist before being patched a copied file already exists before applying the first hunk. Instead of copying the files at their final destination before patching, we store them in a temporary file location and retrieve them when patching. The filestore always stores file content in real files but nothing prevents adding a cache layer. The filestore class was kept separate from fsbackend for at least two reasons: - This class is likely to be reused as a temporary result store for a future repository patching call (entries just have to be extended to contain copy sources). - Delegating this role to backends might be more efficient in a repository backend case: the source files are already available in the repository itself and do not need to be copied again. It also means that third-parties backend would have to implement two other methods. If we ever decide to merge the filestore feature into backend, a minimalistic approach would be to compose with filestore directly. Keep in mind this copy overhead only applies for copy/rename sources, and may even be reduced to copy sources which have to handled ahead of time.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 27 May 2011 21:50:10 +0200
parents a6b543e05305
children e597ef52a7c2
comparison
equal deleted inserted replaced
14451:c78d41db6f88 14452:ee574cfd0c32
434 > @@ -1,1 +1,2 @@ 434 > @@ -1,1 +1,2 @@
435 > a 435 > a
436 > +b 436 > +b
437 > EOF 437 > EOF
438 applying patch from stdin 438 applying patch from stdin
439 abort: cannot create b: destination already exists 439 cannot create b: destination already exists
440 1 out of 1 hunks FAILED -- saving rejects to file b.rej
441 abort: patch failed to apply
440 [255] 442 [255]
441 $ cat b 443 $ cat b
442 b 444 b
443 $ cd .. 445 $ cd ..