Patrick Mézard avatar Patrick Mézard committed 64d9611

editor: do not record invalid path deletion

Comments (0)

Files changed (4)

hgsubversion/editor.py

                 'opened directory: %s != %s' % (self._opendirs[-1][0], baton))
 
     def _deletefile(self, path):
-        self._deleted.add(path)
+        if self.meta.is_path_valid(path):
+            self._deleted.add(path)
         if path in self._svncopies:
             del self._svncopies[path]
         self._missing.discard(path)

tests/fixtures/copies.sh

 svn up
 svn cp trunk/dir2 trunk/dir3
 svn ci -m 'copy dir2 to dir3'
+svn rm trunk/dir3/a
+svn cp trunk/dir2/a trunk/dir3/a
+svn ci -m 'copy and remove'
 cd ..
 
 svnadmin dump testrepo > ../copies.svndump

tests/fixtures/copies.svndump

 SVN-fs-dump-format-version: 2
 
-UUID: f9962aa6-eec5-4335-8af9-9ae89f4b18b2
+UUID: 6f377846-a035-4244-a154-e87a9351a653
 
 Revision-number: 0
 Prop-content-length: 56
 K 8
 svn:date
 V 27
-2012-10-14T14:22:33.372222Z
+2012-10-15T19:02:56.936694Z
 PROPS-END
 
 Revision-number: 1
 K 8
 svn:date
 V 27
-2012-10-14T14:22:33.393643Z
+2012-10-15T19:02:56.958201Z
 K 7
 svn:log
 V 4
 K 8
 svn:date
 V 27
-2012-10-14T14:22:35.042430Z
+2012-10-15T19:02:58.046478Z
 K 7
 svn:log
 V 21
 K 8
 svn:date
 V 27
-2012-10-14T14:22:38.041919Z
+2012-10-15T19:03:01.045897Z
 K 7
 svn:log
 V 17
 Node-copyfrom-path: trunk/dir2
 
 
+Revision-number: 4
+Prop-content-length: 117
+Content-length: 117
+
+K 10
+svn:author
+V 7
+pmezard
+K 8
+svn:date
+V 27
+2012-10-15T19:03:03.046654Z
+K 7
+svn:log
+V 15
+copy and remove
+PROPS-END
+
+Node-path: trunk/dir3/a
+Node-kind: file
+Node-action: delete
+
+Node-path: trunk/dir3/a
+Node-kind: file
+Node-action: add
+Node-copyfrom-rev: 2
+Node-copyfrom-path: trunk/dir2/a
+Text-copy-source-md5: dd8c6a395b5dd36c56d23275028f526c
+Text-copy-source-sha1: 05dec960e24d918b8a73a1c53bcbbaac2ee5c2e0
+
+
+
+

tests/test_fetch_mappings.py

         # directory.
         repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n",
                 failonmissing=False)
-        self.assertEqual(['dir/a', 'dir3/a'], list(repo['tip']))
+        self.assertEqual(['dir/a', 'dir3/a'], list(repo[2]))
 
     def test_file_map_exclude_copy_source_and_dest(self):
         # dir3 is excluded and copied from dir2 which is also excluded.
         # dir3 files should not be marked as missing and fetched.
         repo = self._loadwithfilemap('copies.svndump',
                 "exclude dir2\nexclude dir3\n")
-        self.assertEqual(['dir/a'], list(repo['tip']))
+        self.assertEqual(['dir/a'], list(repo[2]))
 
     def test_file_map_include_file_exclude_dir(self):
         # dir3 is excluded but we want dir3/a, which is also copied from
         repo = self._loadwithfilemap('copies.svndump',
                 "include .\nexclude dir2\nexclude dir3\ninclude dir3/a\n",
                 failonmissing=False)
-        self.assertEqual(['dir/a', 'dir3/a'], list(repo['tip']))
+        self.assertEqual(['dir/a', 'dir3/a'], list(repo[2]))
+
+    def test_file_map_delete_dest(self):
+        repo = self._loadwithfilemap('copies.svndump', 'exclude dir3\n')
+        self.assertEqual(['dir/a', 'dir2/a'], list(repo[3]))
 
     def test_branchmap(self, stupid=False):
         repo_path = self.load_svndump('branchmap.svndump')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.