##// END OF EJS Templates
subrepo: prune empty directories when removing svn subrepo
Patrick Mezard -
r13015:82ca0c43 stable
parent child Browse files
Show More
@@ -564,7 +564,12 b' class svnsubrepo(abstractsubrepo):'
564 os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE)
564 os.chmod(path, stat.S_IMODE(s.st_mode) | stat.S_IWRITE)
565 os.remove(path)
565 os.remove(path)
566
566
567 shutil.rmtree(self._ctx._repo.wjoin(self._path), onerror=onerror)
567 path = self._ctx._repo.wjoin(self._path)
568 shutil.rmtree(path, onerror=onerror)
569 try:
570 os.removedirs(os.path.dirname(path))
571 except OSError:
572 pass
568
573
569 def get(self, state):
574 def get(self, state):
570 status = self._svncommand(['checkout', state[0], '--revision', state[1]])
575 status = self._svncommand(['checkout', state[0], '--revision', state[1]])
@@ -63,11 +63,15 b' first revision, no sub'
63
63
64 add first svn sub with leading whitespaces
64 add first svn sub with leading whitespaces
65
65
66 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
66 $ echo "s = [svn] $SVNREPO/src" >> .hgsub
67 $ echo "subdir/s = [svn] $SVNREPO/src" >> .hgsub
67 $ svn co --quiet "$SVNREPO"/src s
68 $ svn co --quiet "$SVNREPO"/src s
69 $ mkdir subdir
70 $ svn co --quiet "$SVNREPO"/src subdir/s
68 $ hg add .hgsub
71 $ hg add .hgsub
69 $ hg ci -m1
72 $ hg ci -m1
70 committing subrepository s
73 committing subrepository s
74 committing subrepository subdir/s
71
75
72 make sure we avoid empty commits (issue2445)
76 make sure we avoid empty commits (issue2445)
73
77
@@ -87,6 +91,9 b' debugsub'
87 path s
91 path s
88 source file://*/svn-repo/src (glob)
92 source file://*/svn-repo/src (glob)
89 revision 2
93 revision 2
94 path subdir/s
95 source file://*/svn-repo/src (glob)
96 revision 2
90
97
91 change file in svn and hg, commit
98 change file in svn and hg, commit
92
99
@@ -112,6 +119,9 b' change file in svn and hg, commit'
112 path s
119 path s
113 source file://*/svn-repo/src (glob)
120 source file://*/svn-repo/src (glob)
114 revision 3
121 revision 3
122 path subdir/s
123 source file://*/svn-repo/src (glob)
124 revision 2
115
125
116 $ echo a > s/a
126 $ echo a > s/a
117
127
@@ -170,9 +180,10 b' this commit fails because of externals c'
170 $ hg diff --subrepos -r 1:2 | grep -v diff
180 $ hg diff --subrepos -r 1:2 | grep -v diff
171 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
181 --- a/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
172 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
182 +++ b/.hgsubstate Thu Jan 01 00:00:00 1970 +0000
173 @@ -1,1 +1,1 @@
183 @@ -1,2 +1,2 @@
174 -2 s
184 -2 s
175 +3 s
185 +3 s
186 2 subdir/s
176 --- a/a Thu Jan 01 00:00:00 1970 +0000
187 --- a/a Thu Jan 01 00:00:00 1970 +0000
177 +++ b/a Thu Jan 01 00:00:00 1970 +0000
188 +++ b/a Thu Jan 01 00:00:00 1970 +0000
178 @@ -1,1 +1,2 @@
189 @@ -1,1 +1,2 @@
@@ -195,6 +206,14 b' clone'
195 $ cd ..
206 $ cd ..
196 $ hg clone t tc | fix_path
207 $ hg clone t tc | fix_path
197 updating to branch default
208 updating to branch default
209 A tc/subdir/s/alpha
210 U tc/subdir/s
211
212 Fetching external item into 'tc/subdir/s/externals'
213 A tc/subdir/s/externals/other
214 Checked out external at revision 1.
215
216 Checked out revision 2.
198 A tc/s/alpha
217 A tc/s/alpha
199 U tc/s
218 U tc/s
200
219
@@ -212,6 +231,9 b' debugsub in clone'
212 path s
231 path s
213 source file://*/svn-repo/src (glob)
232 source file://*/svn-repo/src (glob)
214 revision 3
233 revision 3
234 path subdir/s
235 source file://*/svn-repo/src (glob)
236 revision 2
215
237
216 verify subrepo is contained within the repo directory
238 verify subrepo is contained within the repo directory
217
239
@@ -222,3 +244,4 b' update to nullrev (must delete the subre'
222
244
223 $ hg up null
245 $ hg up null
224 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
246 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
247 $ ls
General Comments 0
You need to be logged in to leave comments. Login now