Patrick Mézard avatar Patrick Mézard committed c4115b3

Really delete the .hgsvnexternals file when explicitely removed

Comments (0)

Files changed (3)

 
             def filectxfn(repo, memctx, path):
                 if path == '.hgsvnexternals':
+                    if not externals:
+                        raise IOError()
                     return context.memfilectx(path=path, data=externals.write(), 
                                               islink=False, isexec=False, copied=None)
                 return filectxfn2(repo, memctx, path)

hg_delta_editor.py

         # Register the file changes
         for bp, external in branches.iteritems():
             path = bp + '/.hgsvnexternals'
-            self.current_files[path] = external.write()
-            self.current_files_symlink[path] = False
-            self.current_files_exec[path] = False
+            if external:
+                self.current_files[path] = external.write()
+                self.current_files_symlink[path] = False
+                self.current_files_exec[path] = False
+            else:
+                self.delete_file(path)
 
     def commit_current_delta(self):
         if hasattr(self, '_exception_info'):  #pragma: no cover

tests/test_externals.py

         self.assertTrue('subdir2/a' in self.repo['tip'])
         self.assertTrue('subdir1/a' not in self.repo['tip'])
 
+        # Test externals removal
+        changes = [
+            ('.hgsvnexternals', None, None),
+            ]
+        self.commitchanges(changes)
+        self.pushrevisions(stupid)
+        self.assertchanges(changes, self.repo['tip'])
+
     def test_push_externals_stupid(self):
         self.test_push_externals(True)
 
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.