[darcs-users] [patch267] Accept issue1860: (Un)applying move patc... (and 2 more)

Petr Ročkai bugs at darcs.net
Sun Jun 6 14:38:49 UTC 2010


New submission from Petr Ročkai <me at mornfall.net>:

Hey there,

this should fix the cases where applying a bunch of patches including a rename
could lead to bits missing from pristine. The actual fix is in hashed-storage:

Sun Jun  6 16:21:25 CEST 2010  Petr Rockai <me at mornfall.net>
  * Track changed files across directory renames, in TreeMonad.
diff -rN -u -p old-hashed-storage/Storage/Hashed/Monad.hs new-hashed-storage/Storage/Hashed/Monad.hs
--- old-hashed-storage/Storage/Hashed/Monad.hs  2010-06-06 16:39:36.000000000 +0200
+++ new-hashed-storage/Storage/Hashed/Monad.hs  2010-06-06 16:39:36.000000000 +0200
@@ -117,6 +117,12 @@ modifyItem path item = do
                      , changed = (S.union paths (changed st))
                      , changesize = (changesize st + change) }

+renameChanged from to = modify $ \st -> st { changed = rename' $ changed st }
+  where rename' = S.fromList . map renameone . S.toList
+        renameone x | from `isPrefix` x = to `catPaths` relative from x
+                    | otherwise = x
+        relative (AnchoredPath from) (AnchoredPath x) = AnchoredPath $ drop (length from) x
+
 -- | Replace an item with a new version without modifying the content of the
 -- tree. This does not do any change tracking. Ought to be only used from a
 -- 'sync' implementation for a particular storage format. The presumed use-case
@@ -212,3 +218,4 @@ instance (Functor m, Monad m, MonadError
            unless (isNothing item) $ do
                   modifyItem from Nothing
                   modifyItem to item
+                  renameChanged from to

I agree it is a bit crude, but it should do for now. I will eventually refactor
the path handling code in h-s anyway.

3 patches for repository darcs-unstable at darcs.net:darcs:

Sun Jun  6 16:28:58 CEST 2010  Petr Rockai <me at mornfall.net>
  * Accept issue1860: (Un)applying move patches may lead to incomplete pristine.

Thu Jun  3 22:53:30 CEST 2010  Petr Rockai <me at mornfall.net>
  * Resolve issue1817: --external-merge broken, by bumping h-s dependency to 0.5.1.
  
  This h-s releases fixes a problem in index handling code where reading files
  from a Tree that was created from an index only worked in the same working
  directory in which the index had been opened. This was breaking
  externalResolution which called readBlob on index'd files (working) from a
  temporary directory.

Sun Jun  6 16:29:19 CEST 2010  Petr Rockai <me at mornfall.net>
  * Resolve issue1860: (Un)applying move patches may lead to incomplete pristine.
  
  Fixed in hashed-storage 0.5.2 -- directory renames in TreeIO have caused
  subsequent (disk) flush-es to be incomplete in some cases.

----------
files: accept-issue1860_-_un_applying-move-patches-may-lead-to-incomplete-pristine_.dpatch, unnamed
messages: 11262
nosy: mornfall
status: needs-review
title: Accept issue1860: (Un)applying move patc... (and 2 more)

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch267>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: accept-issue1860_-_un_applying-move-patches-may-lead-to-incomplete-pristine_.dpatch
Type: text/x-darcs-patch
Size: 63383 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100606/8dcec3df/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unnamed
Type: application/octet-stream
Size: 5 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100606/8dcec3df/attachment-0001.obj>


More information about the darcs-users mailing list