changeset 650:53423381c540

hg2git: call _handle_subrepos when .hgsubstate is removed Now that _handle_subrepos can handle .hgsubstate being removed, we should use it for that. The test changes make sure that the SHAs roundtrip.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 12 Feb 2014 22:55:16 -0800
parents bd63cdfbc1de
children 59f8ef69afb8
files hggit/hg2git.py tests/test-git-submodules.t
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/hg2git.py
+++ b/hggit/hg2git.py
@@ -112,6 +112,13 @@
 
         # We first process file removals so we can prune dead trees.
         for path in removed:
+            if path == '.hgsubstate':
+                self._handle_subrepos(newctx, dirty_trees)
+                continue
+
+            if path == '.hgsub':
+                continue
+
             self._remove_path(path, dirty_trees)
 
         # For every file that changed or was added, we need to calculate the
--- a/tests/test-git-submodules.t
+++ b/tests/test-git-submodules.t
@@ -100,6 +100,15 @@
    delete mode 160000 alpha
    delete mode 160000 subrepo2
 
+  $ git log --pretty=oneline
+  d3c472800f9d11baa6615971a3179fd441869173 remove all subrepos
+  88171163bf4795b5570924e51d5f8ede33f8bc28 replace file with subrepo
+  f6436a472da00f581d8d257e9bbaf3c358a5e88c replace subrepo with file
+  6e219527869fa40eb6ffbdd013cd86d576b26b01 add another subrepo
+  a000567ceefbd9a2ce364e0dea6e298010b02b6d change subrepo commit
+  e42b08b3cb7069b4594a4ee1d9cb641ee47b2355 add subrepo
+  7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 add alpha
+
   $ cd ..
 
   $ hg clone gitrepo2 hgrepo | grep -v '^updating'
@@ -192,3 +201,15 @@
   .hgsubstate: no such file in rev 827c0345b7d1
   [1]
 
+  $ hg gclear
+  clearing out the git cache data
+  $ hg gexport
+  $ cd .hg/git
+  $ git log --pretty=oneline
+  d3c472800f9d11baa6615971a3179fd441869173 remove all subrepos
+  88171163bf4795b5570924e51d5f8ede33f8bc28 replace file with subrepo
+  f6436a472da00f581d8d257e9bbaf3c358a5e88c replace subrepo with file
+  6e219527869fa40eb6ffbdd013cd86d576b26b01 add another subrepo
+  a000567ceefbd9a2ce364e0dea6e298010b02b6d change subrepo commit
+  e42b08b3cb7069b4594a4ee1d9cb641ee47b2355 add subrepo
+  7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 add alpha