changeset 1233:0d0132cba155

editor: fix edge case with in memory file-store size limit There are a few cases where we will set a single file into to the editor's FileStore object more than once. Notably, for copied and then modified files, we will set it at least twice. Three times if editing fails (which it can for symlinks). If we pass the in-memory storage limit in between the first (or second if editing fails) time we set the file and the last time we set the file, we will write the data to the in memory store the first time and the file store the last time. We didn't remove it form the in-memory store though, and we always prefer reading from the in-memory store. This means we can sometimes end up with the wrong version of a file. This is fairly unlikely to happen in normal use since you need to hit the memory limit between two writes to the store for the same file. We only write a file multiple times if a) the file (and not one of it's parent directories) is copied and then modified or b) editing fails. From what I can tell, it's only common for editing to fail for symlinks, and they ten to be relatively small data that is unlikely to push over the limit. Finally, the default limit is 100MB which I would expect to be most often either well over (source code) or well under (binaries or automated changes) the size of the changes files in a single commit. The easiest way to reproduce this is to set the in-memory cache size to 0 and then commit a copied and modified symlink. The empty-string version from the failed editing will be the one that persists. I happened to stumble upon this while trying (and failing) to test a bug-fix for a related bug with identical symptoms (empty simlink). I have seen this in the wild, once, but couldn't reproduce it at the time. The repo in question is quite large and quite active, so I am quite confident in my estimation that this is a real, but very rare, problem. The test changes attached to this was mneant to test a related bug, but turned out not to actually cover the bug in question. They did trigger this bug though, and are worthwhile to test, so I kept them.
author David Schleimer <dschleimer@fb.com>
date Mon, 07 Apr 2014 17:51:59 -0700
parents ba8485b9fee0
children d3c79072bc6a
files hgsubversion/editor.py tests/fixtures/renames.sh tests/fixtures/renames.svndump tests/test_fetch_renames.py
diffstat 4 files changed, 611 insertions(+), 166 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/editor.py
+++ b/hgsubversion/editor.py
@@ -31,6 +31,13 @@ class FileStore(object):
         if fname in self._popped:
             raise EditingError('trying to set a popped file %s' % fname)
 
+        if fname in self._data:
+            self._size -= len(self._data[fname])
+            del self._data[fname]
+
+        if fname in self._files:
+            del self._files[fname]
+
         if self._maxsize < 0 or (len(data) + self._size) <= self._maxsize:
             self._data[fname] = data
             self._size += len(data)
--- a/tests/fixtures/renames.sh
+++ b/tests/fixtures/renames.sh
@@ -3,6 +3,10 @@
 # Generate renames.svndump
 #
 
+set -e
+
+rm -rf temp
+
 mkdir temp
 cd temp
 
@@ -21,82 +25,112 @@ cd project/trunk
 # Entries for regular tests
 echo a > a
 echo b > b
+ln -s a linka
+ln -s b linkb
 mkdir -p da/db
 echo c > da/daf
+ln -s daf da/dalink
 echo d > da/db/dbf
+ln -s ../daf da/db/dblink
 # Entries to test delete + copy
 echo deleted > deletedfile
+ln -s b deletedlink
 mkdir deleteddir
 echo deleteddir > deleteddir/f
+ln -s f deleteddir/link
 # Entries to test copy before change
 echo changed > changed
+ln -s changed changedlink
 mkdir changeddir
 echo changed2 > changeddir/f
+ln -s f changeddir/link
 # Entries unchanged in the rest of history
 echo unchanged > unchanged
+ln -s unchanged unchangedlink
 mkdir unchangeddir
 echo unchanged2 > unchangeddir/f
+ln -s f unchangeddir/link
 # One of the files will be changed afterwards, to test
 # group copies detection
 mkdir groupdir
 echo a > groupdir/a
 echo b > groupdir/b
-svn add a b da deletedfile deleteddir changed changeddir unchanged unchangeddir groupdir
-svn ci -m "add a and b"
+ln -s a groupdir/linka
+ln -s b groupdir/linkb
+svn add a b linka linkb da deleted* changed* unchanged* groupdir
+svn ci -m "add everything"
 # Remove files to be copied later
 svn rm deletedfile
 svn rm deleteddir
+svn rm deletedlink
 # Update files to be copied before this change
 echo changed >> changed
 echo changed2 >> changeddir/f
+ln -sfn changeddir/f changedlink
+ln -sfn ../changed changeddir/link
 # Update one of the groupdir files
 echo a >> groupdir/a
+ln -sfn ../a groupdir/linka
 svn ci -m "delete files and dirs"
 cd ../branches
 svn cp ../trunk branch1
 svn ci -m "create branch1"
 cd branch1
 echo c > c
-svn add c
-svn ci -m "add c"
+ln -s c linkc
+svn add c linkc
+svn ci -m "add c and linkc"
 cd ../../trunk
 # Regular copy and rename
 svn cp a a1
+svn cp linka linka1
 svn mv a a2
+svn mv linka linka2
 # Copy and update of source and dest
 svn cp b b1
+svn cp linkb linkb1
 echo b >> b
 echo c >> b1
+ln -sfn bb linkb
+ln -sfn bc linkb1
 # Directory copy and renaming
 svn cp da da1
 svn mv da da2
 # Test one copy operation in branch
 cd ../branches/branch1
 svn cp c c1
+svn cp linkc linkc1
 echo c >> c1
+ln -sfn cc linkc1
 cd ../..
-svn ci -m "rename and copy a, b and da"
+svn ci -m "rename and copy a, b, c and da, plus their links"
 cd trunk
 # Copy across branch
 svn cp ../branches/branch1/c c
-svn ci -m "copy b from branch1"
+svn cp ../branches/branch1/linkc linkc
+svn ci -m "copy c from branch1"
 # Copy deleted stuff from the past
 svn cp $svnurl/trunk/deletedfile@2 deletedfile
 svn cp $svnurl/trunk/deleteddir@2 deleteddir
+svn cp $svnurl/trunk/deletedlink@2 deletedlink
 svn ci -m "copy stuff from the past"
 # Copy data from the past before it was changed
 svn cp $svnurl/trunk/changed@2 changed2
 svn cp $svnurl/trunk/changeddir@2 changeddir2
+svn cp $svnurl/trunk/changedlink@2 changedlink2
 # Harder, copy from the past before change and change it again
 # This confused the stupid diff path
 svn cp $svnurl/trunk/changed@2 changed3
+svn cp $svnurl/trunk/changedlink@2 changedlink3
 echo changed3 >> changed3
+ln -sfn changed3 changedlink3
 svn ci -m "copy stuff from the past before change"
 # Copy unchanged stuff from the past. Since no changed occured in these files
 # between the source and parent revision, we record them as copy from parent
 # instead of source rev.
 svn cp $svnurl/trunk/unchanged@2 unchanged2
 svn cp $svnurl/trunk/unchangeddir@2 unchangeddir2
+svn cp $svnurl/trunk/unchangedlink@2 unchangedlink2
 svn ci -m "copy unchanged stuff from the past"
 # Copy groupdir, unfortunately one file was changed after r2 so the
 # copy should not be recorded at all
--- a/tests/fixtures/renames.svndump
+++ b/tests/fixtures/renames.svndump
@@ -1,6 +1,6 @@
 SVN-fs-dump-format-version: 2
 
-UUID: 113560bd-ec36-42a6-acef-e4688a33b129
+UUID: e86bec6c-370f-405d-b639-abb48bba3962
 
 Revision-number: 0
 Prop-content-length: 56
@@ -9,25 +9,25 @@ Content-length: 56
 K 8
 svn:date
 V 27
-2008-12-05T22:48:38.139917Z
+2014-04-07T22:34:17.074854Z
 PROPS-END
 
 Revision-number: 1
-Prop-content-length: 114
-Content-length: 114
+Prop-content-length: 118
+Content-length: 118
 
-K 7
-svn:log
-V 12
-init project
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:38.525864Z
+2014-04-07T22:34:17.214759Z
+K 7
+svn:log
+V 12
+init project
 PROPS-END
 
 Node-path: branches
@@ -49,21 +49,21 @@ PROPS-END
 
 
 Revision-number: 2
-Prop-content-length: 113
-Content-length: 113
+Prop-content-length: 120
+Content-length: 120
 
-K 7
-svn:log
-V 11
-add a and b
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:39.313010Z
+2014-04-07T22:34:17.391940Z
+K 7
+svn:log
+V 14
+add everything
 PROPS-END
 
 Node-path: trunk/a
@@ -72,6 +72,7 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: 60b725f10c9c85c70d97880dfe8191b3
+Text-content-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
 Content-length: 12
 
 PROPS-END
@@ -84,6 +85,7 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: 3b5d5c3712955042212316173ccf37be
+Text-content-sha1: 89e6c98d92887913cadf06b2adb97f26cde4849b
 Content-length: 12
 
 PROPS-END
@@ -96,6 +98,7 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 8
 Text-content-md5: ec1bebaea2c042beb68f7679ddd106a4
+Text-content-sha1: 2f6933b5ee0f5fdd823d9717d8729f3c2523811b
 Content-length: 18
 
 PROPS-END
@@ -117,12 +120,45 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 9
 Text-content-md5: 2dfdfd8492a2c558ec838d69f73f5f6b
+Text-content-sha1: fc7acf217b976525893922a9ed1bb3c3ab24f3a9
 Content-length: 19
 
 PROPS-END
 changed2
 
 
+Node-path: trunk/changeddir/link
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: af3f1e8f8fa51f08e4985bda241ee7b8
+Text-content-sha1: f11a0ea0293755a1ec59d29628130cf3fcd3ec1c
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link f
+
+Node-path: trunk/changedlink
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 12
+Text-content-md5: d91fb1e1062e62a17f97b44932d454c4
+Text-content-sha1: 8c147187742f58ed0cd8707ddd0c0942fe8b2616
+Content-length: 45
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link changed
+
 Node-path: trunk/da
 Node-kind: dir
 Node-action: add
@@ -138,12 +174,29 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: 2cd6ee2c70b0bde53fbe6cac3c8b8bb1
+Text-content-sha1: 2b66fd261ee5c6cfc8de7fa466bab600bcfe4f69
 Content-length: 12
 
 PROPS-END
 c
 
 
+Node-path: trunk/da/dalink
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 8
+Text-content-md5: 21af4beda4f4d197c0b1cecbf11543dc
+Text-content-sha1: 52f2276428bcb4cf45fefaf293521b5b3a26aa5f
+Content-length: 41
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link daf
+
 Node-path: trunk/da/db
 Node-kind: dir
 Node-action: add
@@ -159,12 +212,29 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: e29311f6f1bf1af907f9ef9f44b8328b
+Text-content-sha1: e983f374794de9c64e3d1c1de1d490c0756eeeff
 Content-length: 12
 
 PROPS-END
 d
 
 
+Node-path: trunk/da/db/dblink
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 11
+Text-content-md5: 301198daf87f24796a8be0746389da42
+Text-content-sha1: af5485e6ea78867c36f7993542cbaadb570b79c8
+Content-length: 44
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link ../daf
+
 Node-path: trunk/deleteddir
 Node-kind: dir
 Node-action: add
@@ -180,24 +250,58 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 11
 Text-content-md5: 49b72b575e26ecddb296dd59b24c3e67
+Text-content-sha1: 02801293a2cd7e4c105239d34a3cfa4a4eb9c921
 Content-length: 21
 
 PROPS-END
 deleteddir
 
 
+Node-path: trunk/deleteddir/link
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: af3f1e8f8fa51f08e4985bda241ee7b8
+Text-content-sha1: f11a0ea0293755a1ec59d29628130cf3fcd3ec1c
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link f
+
 Node-path: trunk/deletedfile
 Node-kind: file
 Node-action: add
 Prop-content-length: 10
 Text-content-length: 8
 Text-content-md5: 4d742b2f247bec99b41a60acbebc149a
+Text-content-sha1: 1ef5922542033869106719d682a87ed706af4ddd
 Content-length: 18
 
 PROPS-END
 deleted
 
 
+Node-path: trunk/deletedlink
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: e9292b8c4fca95ac8c70b4ae040d0b79
+Text-content-sha1: 7325442a5f7383205e66db563025d51535883784
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link b
+
 Node-path: trunk/groupdir
 Node-kind: dir
 Node-action: add
@@ -213,6 +317,7 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: 60b725f10c9c85c70d97880dfe8191b3
+Text-content-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
 Content-length: 12
 
 PROPS-END
@@ -225,18 +330,84 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: 3b5d5c3712955042212316173ccf37be
+Text-content-sha1: 89e6c98d92887913cadf06b2adb97f26cde4849b
 Content-length: 12
 
 PROPS-END
 b
 
 
+Node-path: trunk/groupdir/linka
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: c118dba188202a1efc975bef6064180b
+Text-content-sha1: 41f94e4692313bf7f7c92aa600002f1dff93d6bf
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link a
+
+Node-path: trunk/groupdir/linkb
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: e9292b8c4fca95ac8c70b4ae040d0b79
+Text-content-sha1: 7325442a5f7383205e66db563025d51535883784
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link b
+
+Node-path: trunk/linka
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: c118dba188202a1efc975bef6064180b
+Text-content-sha1: 41f94e4692313bf7f7c92aa600002f1dff93d6bf
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link a
+
+Node-path: trunk/linkb
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: e9292b8c4fca95ac8c70b4ae040d0b79
+Text-content-sha1: 7325442a5f7383205e66db563025d51535883784
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link b
+
 Node-path: trunk/unchanged
 Node-kind: file
 Node-action: add
 Prop-content-length: 10
 Text-content-length: 10
 Text-content-md5: 85ae5b04dd0a666efad8633d142a4635
+Text-content-sha1: c654a5435f170cfad37e136fee9672ecc40afd4a
 Content-length: 20
 
 PROPS-END
@@ -258,28 +429,61 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 11
 Text-content-md5: a11092875079a002afb9ecef07f510e7
+Text-content-sha1: c18ebadf1cffd6a79e4b74c50474b3cf8d5cb32b
 Content-length: 21
 
 PROPS-END
 unchanged2
 
 
+Node-path: trunk/unchangeddir/link
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: af3f1e8f8fa51f08e4985bda241ee7b8
+Text-content-sha1: f11a0ea0293755a1ec59d29628130cf3fcd3ec1c
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link f
+
+Node-path: trunk/unchangedlink
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 14
+Text-content-md5: 1aa9c01278c74a273e3117dc42426153
+Text-content-sha1: 3f1a6ab03b820f0baab56c083f77bd9279db2486
+Content-length: 47
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link unchanged
+
 Revision-number: 3
-Prop-content-length: 123
-Content-length: 123
+Prop-content-length: 127
+Content-length: 127
 
-K 7
-svn:log
-V 21
-delete files and dirs
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:40.224632Z
+2014-04-07T22:34:17.496578Z
+K 7
+svn:log
+V 21
+delete files and dirs
 PROPS-END
 
 Node-path: trunk/changed
@@ -287,6 +491,7 @@ Node-kind: file
 Node-action: change
 Text-content-length: 16
 Text-content-md5: 1725f40a29aad369a39b0f96c82d50f9
+Text-content-sha1: bd7078ed7302005a46b0f32b08cb81406df5d5cf
 Content-length: 16
 
 changed
@@ -298,23 +503,55 @@ Node-kind: file
 Node-action: change
 Text-content-length: 18
 Text-content-md5: 984b8c4ab9193b7659b9f914897a949c
+Text-content-sha1: df588cfa0799c1d4447646645ff2799e23e59f57
 Content-length: 18
 
 changed2
 changed2
 
 
+Node-path: trunk/changeddir/link
+Node-kind: file
+Node-action: change
+Text-content-length: 15
+Text-content-md5: 19b47078b08789b4af5bc8d78b09f051
+Text-content-sha1: 697d35a9a0857889666f1cae1baa9e294b4cf36f
+Content-length: 15
+
+link ../changed
+
+Node-path: trunk/changedlink
+Node-kind: file
+Node-action: change
+Text-content-length: 17
+Text-content-md5: 78d7d7c917f0f0355f01f23508cc0a0a
+Text-content-sha1: 6d7057bfb5ba8dffc0184f491e4fa43ec1904cdd
+Content-length: 17
+
+link changeddir/f
+
 Node-path: trunk/groupdir/a
 Node-kind: file
 Node-action: change
 Text-content-length: 4
 Text-content-md5: 0d227f1abf8c2932d342e9b99cc957eb
+Text-content-sha1: d7c8127a20a396cff08af086a1c695b0636f0c29
 Content-length: 4
 
 a
 a
 
 
+Node-path: trunk/groupdir/linka
+Node-kind: file
+Node-action: change
+Text-content-length: 9
+Text-content-md5: 37f1cfbed04f4354d8e706a1f1f626b6
+Text-content-sha1: 7e368116b09c906ec1b989cefe328fd6dec4f759
+Content-length: 9
+
+link ../a
+
 Node-path: trunk/deleteddir
 Node-action: delete
 
@@ -323,22 +560,26 @@ Node-path: trunk/deletedfile
 Node-action: delete
 
 
+Node-path: trunk/deletedlink
+Node-action: delete
+
+
 Revision-number: 4
-Prop-content-length: 116
-Content-length: 116
+Prop-content-length: 120
+Content-length: 120
 
-K 7
-svn:log
-V 14
-create branch1
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:42.184704Z
+2014-04-07T22:34:17.595148Z
+K 7
+svn:log
+V 14
+create branch1
 PROPS-END
 
 Node-path: branches/branch1
@@ -346,14 +587,6 @@ Node-kind: dir
 Node-action: add
 Node-copyfrom-rev: 1
 Node-copyfrom-path: trunk
-Prop-content-length: 34
-Content-length: 34
-
-K 13
-svn:mergeinfo
-V 0
-
-PROPS-END
 
 
 Node-path: branches/branch1/a
@@ -362,6 +595,7 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/a
 Text-copy-source-md5: 60b725f10c9c85c70d97880dfe8191b3
+Text-copy-source-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
 
 
 Node-path: branches/branch1/b
@@ -370,6 +604,7 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/b
 Text-copy-source-md5: 3b5d5c3712955042212316173ccf37be
+Text-copy-source-sha1: 89e6c98d92887913cadf06b2adb97f26cde4849b
 
 
 Node-path: branches/branch1/changed
@@ -378,6 +613,7 @@ Node-action: add
 Node-copyfrom-rev: 3
 Node-copyfrom-path: trunk/changed
 Text-copy-source-md5: 1725f40a29aad369a39b0f96c82d50f9
+Text-copy-source-sha1: bd7078ed7302005a46b0f32b08cb81406df5d5cf
 
 
 Node-path: branches/branch1/changeddir
@@ -397,8 +633,33 @@ Node-action: add
 Node-copyfrom-rev: 3
 Node-copyfrom-path: trunk/changeddir/f
 Text-copy-source-md5: 984b8c4ab9193b7659b9f914897a949c
+Text-copy-source-sha1: df588cfa0799c1d4447646645ff2799e23e59f57
+
+
 
 
+Node-path: branches/branch1/changeddir/link
+Node-kind: file
+Node-action: delete
+
+Node-path: branches/branch1/changeddir/link
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 3
+Node-copyfrom-path: trunk/changeddir/link
+Text-copy-source-md5: 19b47078b08789b4af5bc8d78b09f051
+Text-copy-source-sha1: 697d35a9a0857889666f1cae1baa9e294b4cf36f
+
+
+
+
+Node-path: branches/branch1/changedlink
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 3
+Node-copyfrom-path: trunk/changedlink
+Text-copy-source-md5: 78d7d7c917f0f0355f01f23508cc0a0a
+Text-copy-source-sha1: 6d7057bfb5ba8dffc0184f491e4fa43ec1904cdd
 
 
 Node-path: branches/branch1/da
@@ -425,8 +686,42 @@ Node-action: add
 Node-copyfrom-rev: 3
 Node-copyfrom-path: trunk/groupdir/a
 Text-copy-source-md5: 0d227f1abf8c2932d342e9b99cc957eb
+Text-copy-source-sha1: d7c8127a20a396cff08af086a1c695b0636f0c29
+
+
+
+
+Node-path: branches/branch1/groupdir/linka
+Node-kind: file
+Node-action: delete
+
+Node-path: branches/branch1/groupdir/linka
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 3
+Node-copyfrom-path: trunk/groupdir/linka
+Text-copy-source-md5: 37f1cfbed04f4354d8e706a1f1f626b6
+Text-copy-source-sha1: 7e368116b09c906ec1b989cefe328fd6dec4f759
+
+
+
+
+Node-path: branches/branch1/linka
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/linka
+Text-copy-source-md5: c118dba188202a1efc975bef6064180b
+Text-copy-source-sha1: 41f94e4692313bf7f7c92aa600002f1dff93d6bf
 
 
+Node-path: branches/branch1/linkb
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/linkb
+Text-copy-source-md5: e9292b8c4fca95ac8c70b4ae040d0b79
+Text-copy-source-sha1: 7325442a5f7383205e66db563025d51535883784
 
 
 Node-path: branches/branch1/unchanged
@@ -435,6 +730,7 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/unchanged
 Text-copy-source-md5: 85ae5b04dd0a666efad8633d142a4635
+Text-copy-source-sha1: c654a5435f170cfad37e136fee9672ecc40afd4a
 
 
 Node-path: branches/branch1/unchangeddir
@@ -444,22 +740,31 @@ Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/unchangeddir
 
 
+Node-path: branches/branch1/unchangedlink
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/unchangedlink
+Text-copy-source-md5: 1aa9c01278c74a273e3117dc42426153
+Text-copy-source-sha1: 3f1a6ab03b820f0baab56c083f77bd9279db2486
+
+
 Revision-number: 5
-Prop-content-length: 106
-Content-length: 106
+Prop-content-length: 121
+Content-length: 121
 
-K 7
-svn:log
-V 5
-add c
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:43.175723Z
+2014-04-07T22:34:17.655921Z
+K 7
+svn:log
+V 15
+add c and linkc
 PROPS-END
 
 Node-path: branches/branch1/c
@@ -468,28 +773,45 @@ Node-action: add
 Prop-content-length: 10
 Text-content-length: 2
 Text-content-md5: 2cd6ee2c70b0bde53fbe6cac3c8b8bb1
+Text-content-sha1: 2b66fd261ee5c6cfc8de7fa466bab600bcfe4f69
 Content-length: 12
 
 PROPS-END
 c
 
 
+Node-path: branches/branch1/linkc
+Node-kind: file
+Node-action: add
+Prop-content-length: 33
+Text-content-length: 6
+Text-content-md5: aaa83258c434079cc82a5b4868340dc0
+Text-content-sha1: d347f561790aa523b963fc1714c64e1d158cc5d7
+Content-length: 39
+
+K 11
+svn:special
+V 1
+*
+PROPS-END
+link c
+
 Revision-number: 6
-Prop-content-length: 129
-Content-length: 129
+Prop-content-length: 154
+Content-length: 154
 
-K 7
-svn:log
-V 27
-rename and copy a, b and da
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:50.200094Z
+2014-04-07T22:34:17.901507Z
+K 7
+svn:log
+V 48
+rename and copy a, b, c and da, plus their links
 PROPS-END
 
 Node-path: branches/branch1/c1
@@ -498,34 +820,37 @@ Node-action: add
 Node-copyfrom-rev: 5
 Node-copyfrom-path: branches/branch1/c
 Text-copy-source-md5: 2cd6ee2c70b0bde53fbe6cac3c8b8bb1
-Prop-content-length: 34
+Text-copy-source-sha1: 2b66fd261ee5c6cfc8de7fa466bab600bcfe4f69
 Text-content-length: 4
 Text-content-md5: 63fad9092ad37713ebe26b3193f89c41
-Content-length: 38
-
-K 13
-svn:mergeinfo
-V 0
+Text-content-sha1: ccfb93b7bac6f1520f0adc0eebc2cafe9da80f42
+Content-length: 4
 
-PROPS-END
 c
 c
 
 
+Node-path: branches/branch1/linkc1
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 5
+Node-copyfrom-path: branches/branch1/linkc
+Text-copy-source-md5: aaa83258c434079cc82a5b4868340dc0
+Text-copy-source-sha1: d347f561790aa523b963fc1714c64e1d158cc5d7
+Text-content-length: 7
+Text-content-md5: ea7a177c3c3af680cf62010efe71275f
+Text-content-sha1: d780ef86a4c5016931861dc32373a1155755e404
+Content-length: 7
+
+link cc
+
 Node-path: trunk/a1
 Node-kind: file
 Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/a
 Text-copy-source-md5: 60b725f10c9c85c70d97880dfe8191b3
-Prop-content-length: 34
-Content-length: 34
-
-K 13
-svn:mergeinfo
-V 0
-
-PROPS-END
+Text-copy-source-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
 
 
 Node-path: trunk/a2
@@ -534,14 +859,7 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/a
 Text-copy-source-md5: 60b725f10c9c85c70d97880dfe8191b3
-Prop-content-length: 34
-Content-length: 34
-
-K 13
-svn:mergeinfo
-V 0
-
-PROPS-END
+Text-copy-source-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
 
 
 Node-path: trunk/b
@@ -549,6 +867,7 @@ Node-kind: file
 Node-action: change
 Text-content-length: 4
 Text-content-md5: 06ac26ed8b614fc0b141e4542aa067c2
+Text-content-sha1: f6980469e74f7125178e88ec571e06fe6ce86e95
 Content-length: 4
 
 b
@@ -561,16 +880,12 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/b
 Text-copy-source-md5: 3b5d5c3712955042212316173ccf37be
-Prop-content-length: 34
+Text-copy-source-sha1: 89e6c98d92887913cadf06b2adb97f26cde4849b
 Text-content-length: 4
 Text-content-md5: 33cb6785d50937d8d307ebb66d6259a7
-Content-length: 38
-
-K 13
-svn:mergeinfo
-V 0
+Text-content-sha1: 7a6478264aa11a0f4befef356c03e83f2b1f6eba
+Content-length: 4
 
-PROPS-END
 b
 c
 
@@ -580,14 +895,6 @@ Node-kind: dir
 Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/da
-Prop-content-length: 34
-Content-length: 34
-
-K 13
-svn:mergeinfo
-V 0
-
-PROPS-END
 
 
 Node-path: trunk/da2
@@ -595,16 +902,50 @@ Node-kind: dir
 Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/da
-Prop-content-length: 34
-Content-length: 34
 
-K 13
-svn:mergeinfo
-V 0
 
-PROPS-END
+Node-path: trunk/linka1
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/linka
+Text-copy-source-md5: c118dba188202a1efc975bef6064180b
+Text-copy-source-sha1: 41f94e4692313bf7f7c92aa600002f1dff93d6bf
 
 
+Node-path: trunk/linka2
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/linka
+Text-copy-source-md5: c118dba188202a1efc975bef6064180b
+Text-copy-source-sha1: 41f94e4692313bf7f7c92aa600002f1dff93d6bf
+
+
+Node-path: trunk/linkb
+Node-kind: file
+Node-action: change
+Text-content-length: 7
+Text-content-md5: 00b18251bf95a42453612a62619254c0
+Text-content-sha1: 8d00f006e36676f00d40c3935b6992cbb8349c2b
+Content-length: 7
+
+link bb
+
+Node-path: trunk/linkb1
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/linkb
+Text-copy-source-md5: e9292b8c4fca95ac8c70b4ae040d0b79
+Text-copy-source-sha1: 7325442a5f7383205e66db563025d51535883784
+Text-content-length: 7
+Text-content-md5: 1c9f17365658cf9ea7904568eff11f27
+Text-content-sha1: 163de098ef857862584154ca26e3d028fb34ba45
+Content-length: 7
+
+link bc
+
 Node-path: trunk/a
 Node-action: delete
 
@@ -613,22 +954,26 @@ Node-path: trunk/da
 Node-action: delete
 
 
+Node-path: trunk/linka
+Node-action: delete
+
+
 Revision-number: 7
-Prop-content-length: 121
-Content-length: 121
+Prop-content-length: 125
+Content-length: 125
 
-K 7
-svn:log
-V 19
-copy b from branch1
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:52.154125Z
+2014-04-07T22:34:17.969842Z
+K 7
+svn:log
+V 19
+copy c from branch1
 PROPS-END
 
 Node-path: trunk/c
@@ -637,32 +982,34 @@ Node-action: add
 Node-copyfrom-rev: 5
 Node-copyfrom-path: branches/branch1/c
 Text-copy-source-md5: 2cd6ee2c70b0bde53fbe6cac3c8b8bb1
-Prop-content-length: 34
-Content-length: 34
+Text-copy-source-sha1: 2b66fd261ee5c6cfc8de7fa466bab600bcfe4f69
 
-K 13
-svn:mergeinfo
-V 0
 
-PROPS-END
+Node-path: trunk/linkc
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 5
+Node-copyfrom-path: branches/branch1/linkc
+Text-copy-source-md5: aaa83258c434079cc82a5b4868340dc0
+Text-copy-source-sha1: d347f561790aa523b963fc1714c64e1d158cc5d7
 
 
 Revision-number: 8
-Prop-content-length: 126
-Content-length: 126
+Prop-content-length: 130
+Content-length: 130
 
-K 7
-svn:log
-V 24
-copy stuff from the past
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:55.160439Z
+2014-04-07T22:34:18.068356Z
+K 7
+svn:log
+V 24
+copy stuff from the past
 PROPS-END
 
 Node-path: trunk/deleteddir
@@ -678,24 +1025,34 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/deletedfile
 Text-copy-source-md5: 4d742b2f247bec99b41a60acbebc149a
+Text-copy-source-sha1: 1ef5922542033869106719d682a87ed706af4ddd
+
+
+Node-path: trunk/deletedlink
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/deletedlink
+Text-copy-source-md5: e9292b8c4fca95ac8c70b4ae040d0b79
+Text-copy-source-sha1: 7325442a5f7383205e66db563025d51535883784
 
 
 Revision-number: 9
-Prop-content-length: 140
-Content-length: 140
+Prop-content-length: 144
+Content-length: 144
 
-K 7
-svn:log
-V 38
-copy stuff from the past before change
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:48:59.163460Z
+2014-04-07T22:34:18.201489Z
+K 7
+svn:log
+V 38
+copy stuff from the past before change
 PROPS-END
 
 Node-path: trunk/changed2
@@ -704,6 +1061,7 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/changed
 Text-copy-source-md5: ec1bebaea2c042beb68f7679ddd106a4
+Text-copy-source-sha1: 2f6933b5ee0f5fdd823d9717d8729f3c2523811b
 
 
 Node-path: trunk/changed3
@@ -712,8 +1070,10 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/changed
 Text-copy-source-md5: ec1bebaea2c042beb68f7679ddd106a4
+Text-copy-source-sha1: 2f6933b5ee0f5fdd823d9717d8729f3c2523811b
 Text-content-length: 17
 Text-content-md5: 7d93e8c4d61c2a7b05c20b7d8bf11f83
+Text-content-sha1: d78c3e7f04c44b599787ec534a3193357df1fa37
 Content-length: 17
 
 changed
@@ -727,22 +1087,45 @@ Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/changeddir
 
 
+Node-path: trunk/changedlink2
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/changedlink
+Text-copy-source-md5: d91fb1e1062e62a17f97b44932d454c4
+Text-copy-source-sha1: 8c147187742f58ed0cd8707ddd0c0942fe8b2616
+
+
+Node-path: trunk/changedlink3
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/changedlink
+Text-copy-source-md5: d91fb1e1062e62a17f97b44932d454c4
+Text-copy-source-sha1: 8c147187742f58ed0cd8707ddd0c0942fe8b2616
+Text-content-length: 13
+Text-content-md5: 0ad81e7d7fc35e744e0ad3dea0f158fe
+Text-content-sha1: bae4618ecddda5e6ab6e5fa3b116f5d14dc3464b
+Content-length: 13
+
+link changed3
+
 Revision-number: 10
-Prop-content-length: 136
-Content-length: 136
+Prop-content-length: 140
+Content-length: 140
 
-K 7
-svn:log
-V 34
-copy unchanged stuff from the past
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:49:02.160163Z
+2014-04-07T22:34:18.298821Z
+K 7
+svn:log
+V 34
+copy unchanged stuff from the past
 PROPS-END
 
 Node-path: trunk/unchanged2
@@ -751,6 +1134,7 @@ Node-action: add
 Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/unchanged
 Text-copy-source-md5: 85ae5b04dd0a666efad8633d142a4635
+Text-copy-source-sha1: c654a5435f170cfad37e136fee9672ecc40afd4a
 
 
 Node-path: trunk/unchangeddir2
@@ -760,22 +1144,31 @@ Node-copyfrom-rev: 2
 Node-copyfrom-path: trunk/unchangeddir
 
 
+Node-path: trunk/unchangedlink2
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/unchangedlink
+Text-copy-source-md5: 1aa9c01278c74a273e3117dc42426153
+Text-copy-source-sha1: 3f1a6ab03b820f0baab56c083f77bd9279db2486
+
+
 Revision-number: 11
-Prop-content-length: 129
-Content-length: 129
+Prop-content-length: 133
+Content-length: 133
 
-K 7
-svn:log
-V 27
-copy groupdir from the past
 K 10
 svn:author
-V 7
-pmezard
+V 10
+dschleimer
 K 8
 svn:date
 V 27
-2008-12-05T22:49:04.157303Z
+2014-04-07T22:34:18.370254Z
+K 7
+svn:log
+V 27
+copy groupdir from the past
 PROPS-END
 
 Node-path: trunk/groupdir2
--- a/tests/test_fetch_renames.py
+++ b/tests/test_fetch_renames.py
@@ -25,22 +25,33 @@ class TestFetchRenames(test_util.TestBas
         copies = {
             4: {
                 'a1': ('a', 'a\n'),
+                'linka1': ('linka', 'a'),
                 'a2': ('a', 'a\n'),
+                'linka2': ('linka', 'a'),
                 'b1': ('b', 'b\nc\n'),
+                'linkb1': ('linkb', 'bc'),
                 'da1/daf': ('da/daf', 'c\n'),
+                'da1/dalink': ('da/dalink', 'daf'),
                 'da1/db/dbf': ('da/db/dbf', 'd\n'),
+                'da1/db/dblink': ('da/db/dblink', '../daf'),
                 'da2/daf': ('da/daf', 'c\n'),
+                'da2/dalink': ('da/dalink', 'daf'),
                 'da2/db/dbf': ('da/db/dbf', 'd\n'),
+                'da2/db/dblink': ('da/db/dblink', '../daf'),
                 },
             5: {
                 'c1': ('c', 'c\nc\n'),
+                'linkc1': ('linkc', 'cc'),
                 },
             9: {
                 'unchanged2': ('unchanged', 'unchanged\n'),
+                'unchangedlink2': ('unchangedlink', 'unchanged'),
                 'unchangeddir2/f': ('unchangeddir/f', 'unchanged2\n'),
+                'unchangeddir2/link': ('unchangeddir/link', 'f'),
                 },
             10: {
-                 'groupdir2/b': ('groupdir/b', 'b\n')
+                'groupdir2/b': ('groupdir/b', 'b\n'),
+                'groupdir2/linkb': ('groupdir/linkb', 'b'),
                  },
             }
         for rev in repo: