Mercurial > hgsubversion
changeset 929:8417be758047
pushmod: keep the root svn dir when emptying the hg repo (issue359)
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sun, 09 Sep 2012 16:12:28 +0200 |
parents | d99ed94f4760 |
children | 5bacb9c63e3e |
files | hgsubversion/pushmod.py tests/test_push_command.py |
diffstat | 2 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/pushmod.py +++ b/hgsubversion/pushmod.py @@ -82,6 +82,11 @@ def _getdirchanges(svn, branchpath, pare added.append(d) for d in olddirs: + if not d: + # Do not remove the root directory when the hg repo becomes + # empty. hgsubversion cannot create branches, do not remove + # them. + continue if d not in newdirs and _isdir(svn, branchpath, d): deleted.append(d)
--- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -503,6 +503,25 @@ class PushTests(test_util.TestBase): self.commitchanges(changes, parent=par) self.pushrevisions() + def test_push_emptying_changeset(self): + r = self.repo['tip'] + changes = [ + ('alpha', None, None), + ('beta', None, None), + ] + parent = self.repo['tip'].rev() + self.commitchanges(changes, parent=parent) + self.pushrevisions() + self.assertEqual({}, self.repo['tip'].manifest()) + + # Try to re-add a file after emptying the branch + changes = [ + ('alpha', 'alpha', 'alpha'), + ] + self.commitchanges(changes, parent=self.repo['tip'].rev()) + self.pushrevisions() + self.assertEqual(['alpha'], list(self.repo['tip'].manifest())) + def suite(): test_classes = [PushTests, ] all_tests = []