changeset 176:c4115b3918e9

Really delete the .hgsvnexternals file when explicitely removed
author Patrick Mezard <pmezard@gmail.com>
date Fri, 02 Jan 2009 15:54:06 -0600
parents 2412800b1258
children 71d170253a6f
files fetch_command.py hg_delta_editor.py tests/test_externals.py
diffstat 3 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/fetch_command.py
+++ b/fetch_command.py
@@ -558,6 +558,8 @@ def stupid_svn_server_pull_rev(ui, svn, 
 
             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)
--- a/hg_delta_editor.py
+++ b/hg_delta_editor.py
@@ -376,9 +376,12 @@ class HgChangeReceiver(delta.Editor):
         # 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
--- a/tests/test_externals.py
+++ b/tests/test_externals.py
@@ -127,6 +127,14 @@ class TestPushExternals(test_util.TestBa
         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)