Rev 1546: Merge initial support for pushing merged revisions. in file:///data/jelmer/bzr-svn/pushmerged/
Jelmer Vernooij
jelmer at samba.org
Sun Aug 3 05:38:53 BST 2008
At file:///data/jelmer/bzr-svn/pushmerged/
------------------------------------------------------------
revno: 1546
revision-id: jelmer at samba.org-20080803043852-tjf1qt7q86pe2t4m
parent: jelmer at samba.org-20080803002744-ldwouhqqbftwz5g8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pushmerged
timestamp: Sun 2008-08-03 06:38:52 +0200
message:
Merge initial support for pushing merged revisions.
modified:
branch.py svnbranch.py-20051017135706-11c749eb0dab04a7
commit.py commit.py-20060607190346-qvq128wgfubhhgm2-1
mapping3/__init__.py __init__.py-20080502174630-9324zh25kka98vlw-1
mapping3/scheme.py scheme.py-20060516195850-95181aae6b272f9e
=== modified file 'branch.py'
--- a/branch.py 2008-08-02 23:41:33 +0000
+++ b/branch.py 2008-08-03 04:38:52 +0000
@@ -30,7 +30,7 @@
from bzrlib.plugins.svn import core, wc
from bzrlib.plugins.svn.auth import create_auth_baton
from bzrlib.plugins.svn.client import Client, get_config
-from bzrlib.plugins.svn.commit import push
+from bzrlib.plugins.svn.commit import push, push_new
from bzrlib.plugins.svn.config import BranchConfig
from bzrlib.plugins.svn.core import SubversionException
from bzrlib.plugins.svn.errors import NotSvnBranchPath, ERR_FS_NO_SUCH_REVISION
@@ -506,11 +506,25 @@
self._push_missing_revisions(other, todo)
def _push_missing_revisions(self, other, todo):
+ push_merged = self.layout.push_merged_revisions(self.project)
+ if push_merged:
+ graph = other.repository.get_graph()
pb = ui.ui_factory.nested_progress_bar()
try:
for revid in todo:
pb.update("pushing revisions", todo.index(revid),
len(todo))
+ if push_merged:
+ parent_revids = graph.get_parent_map([revid])[revid]
+ if len(parent_revids) > 1:
+ # Push merged revisions
+ unique_ancestors = graph.find_unique_ancestors(parent_revids[1], [parent_revids[0]])
+ merged_revs = dict(zip(unique_ancestors, other.repository.get_revisions(unique_ancestors)))
+ for x in graph.iter_topo_order(unique_ancestors):
+ push_new(self.repository,
+ self.layout.get_branch_path(merged_revs[x].properties.get('nick') or "merged", self.project),
+ other, x)
+ self._clear_cached_state()
push(self, other, revid)
self._clear_cached_state()
finally:
=== modified file 'commit.py'
--- a/commit.py 2008-08-02 21:53:02 +0000
+++ b/commit.py 2008-08-03 04:38:52 +0000
@@ -854,6 +854,13 @@
return
mutter("pushing %r into svn", todo)
target_branch = None
+ layout = target_branch.repository.get_layout()
+ if layout.push_merged_revisions(target_branch.project):
+ push_merged = True
+ graph = target.repository.get_graph()
+ else:
+ push_merged = False
+ target_config = target_branch.get_config()
for revision_id in todo:
if pb is not None:
pb.update("pushing revisions", todo.index(revision_id), len(todo))
@@ -869,7 +876,16 @@
if target_branch.get_branch_path() != bp:
target_branch.set_branch_path(bp)
- push_revision_tree(target_branch, target_branch.get_config(), self.source,
+ if push_merged and len(rev.parent_ids) > 1:
+ # Push merged revisions
+ unique_ancestors = graph.find_unique_ancestors(revision_id, todo)
+ merged_revs = dict(zip(unique_ancestors, self.source.get_revisions(unique_ancestors)))
+ for x in graph.iter_topo_order(unique_ancestors):
+ push_revision_tree(layout.get_branch_path(merged_revs[x].properties['nick']), target_config,
+ self.source,
+ merged_revs[x].parent_ids[0], x, merged_revs[x])
+
+ push_revision_tree(target_branch, target_config, self.source,
parent_revid, revision_id, rev)
finally:
self.source.unlock()
=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py 2008-08-02 14:44:01 +0000
+++ b/mapping3/__init__.py 2008-08-03 04:38:52 +0000
@@ -112,6 +112,9 @@
def get_tag_path(self, name, project=""):
return self.scheme.get_tag_path(name)
+ def get_branch_path(self, name, project=""):
+ return self.scheme.get_branch_path(name, project)
+
def is_branch_parent(self, path):
# Na, na, na...
return self.scheme.is_branch_parent(path)
=== modified file 'mapping3/scheme.py'
--- a/mapping3/scheme.py 2008-07-23 00:35:03 +0000
+++ b/mapping3/scheme.py 2008-08-03 04:38:52 +0000
@@ -266,7 +266,7 @@
return urlutils.join("tags", name)
raise NotImplementedError
- def get_branch_path(self, name):
+ def get_branch_path(self, name, project=""):
# Only implemented for level 0
if self.level == 0:
if name == "trunk":
More information about the bazaar-commits
mailing list