Rev 1543: Support uncommit. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Sun Aug 3 00:41:35 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1543
revision-id: jelmer at samba.org-20080802234133-84ivpqdwrmqootat
parent: jelmer at samba.org-20080802234120-jth9l6qbh7br1dlw
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-08-03 01:41:33 +0200
message:
Support uncommit.
modified:
NEWS news-20061231030336-h9fhq245ie0de8bs-1
__init__.py __init__.py-20051008155114-eae558e6cf149e1d
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
tests/test_branch.py test_branch.py-20060508162215-74ffeb5d608f8e20
=== modified file 'NEWS'
--- a/NEWS 2008-08-02 21:38:49 +0000
+++ b/NEWS 2008-08-02 23:41:33 +0000
@@ -44,7 +44,9 @@
* Much faster Repository.get_revision_delta(). (#127030)
- * Support push --overwrite. (#118787)
+ * Support bzr push --overwrite. (#118787)
+
+ * Support bzr uncommit.
BUG FIXES
=== modified file '__init__.py'
--- a/__init__.py 2008-08-02 21:38:49 +0000
+++ b/__init__.py 2008-08-02 23:41:33 +0000
@@ -18,10 +18,9 @@
Bazaar can be used with Subversion branches through the bzr-svn plugin.
-Most Bazaar commands should work fine with Subversion branches. The following
-commands at the moment do not:
-
- - bzr uncommit
+Most Bazaar commands should work fine with Subversion branches. To
+create new branches in Subversion using push, it is currently necessary
+to use the svn-push command rather than the standard push command.
bzr-svn also adds two new commands to Bazaar:
=== modified file 'branch.py'
--- a/branch.py 2008-08-02 23:28:23 +0000
+++ b/branch.py 2008-08-02 23:41:33 +0000
@@ -333,7 +333,10 @@
def set_revision_history(self, rev_history):
"""See Branch.set_revision_history()."""
- raise NotImplementedError(self.set_revision_history)
+ if rev_history == [] or not self.repository.has_revision(rev_history[-1]):
+ raise NotImplementedError("set_revision_history can't add ghosts")
+ push(self, self, rev_history[-1])
+ self._clear_cached_state()
def set_last_revision_info(self, revno, revid):
"""See Branch.set_last_revision_info()."""
=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py 2008-07-15 14:06:23 +0000
+++ b/tests/test_branch.py 2008-08-02 23:41:33 +0000
@@ -210,10 +210,44 @@
self.assertEqual(repos.generate_revision_id(2, "", mapping),
branch.last_revision())
+ def test_set_revision_history_empty(self):
+ repos_url = self.make_repository('a')
+ branch = Branch.open(repos_url)
+ self.assertRaises(NotImplementedError, branch.set_revision_history, [])
+
+ def test_set_revision_history_ghost(self):
+ repos_url = self.make_repository('a')
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.add_dir("trunk")
+ trunk.add_file('trunk/foo').modify()
+ dc.close()
+
+ branch = Branch.open(repos_url+"/trunk")
+ self.assertRaises(NotImplementedError, branch.set_revision_history, ["nonexistantt"])
+
def test_set_revision_history(self):
repos_url = self.make_repository('a')
- branch = Branch.open(repos_url)
- self.assertRaises(NotImplementedError, branch.set_revision_history, [])
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.add_dir("trunk")
+ trunk.add_file('trunk/foo').modify()
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.open_dir("trunk")
+ trunk.add_file('trunk/bla').modify()
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ trunk = dc.open_dir("trunk")
+ trunk.add_file('trunk/bar').modify()
+ dc.close()
+
+ branch = Branch.open(repos_url+"/trunk")
+ orig_history = branch.revision_history()
+ branch.set_revision_history(orig_history[:-1])
+ self.assertEquals(orig_history[:-1], branch.revision_history())
def test_break_lock(self):
repos_url = self.make_repository('a')
More information about the bazaar-commits
mailing list