Rev 1739: Store merges in .svn/bzr directory. in file:///data/jelmer/bzr-svn/trunk/
Jelmer Vernooij
jelmer at samba.org
Sun Aug 31 18:34:51 BST 2008
At file:///data/jelmer/bzr-svn/trunk/
------------------------------------------------------------
revno: 1739
revision-id: jelmer at samba.org-20080831173449-c53y7vv3g58ljoir
parent: jelmer at samba.org-20080831155628-hbxvag2iklaa2vu8
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sun 2008-08-31 19:34:49 +0200
message:
Store merges in .svn/bzr directory.
modified:
TODO todo-20060729211917-2kpobww0zyvvo0j2-1
mapping.py mapping.py-20080128201303-6cp01phc0dmc0kiv-1
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/mapping3/__init__.py __init__.py-20080831152358-oy04n53cpnh64aj6-1
tests/test_workingtree.py test_workingtree.py-20060622191524-0di7bc3q1ckdbybb-1
workingtree.py workingtree.py-20060306120941-b083cb0fdd4a69de
=== modified file 'TODO'
--- a/TODO 2008-08-31 15:31:04 +0000
+++ b/TODO 2008-08-31 17:34:49 +0000
@@ -13,8 +13,6 @@
- more blackbox tests
- svn-import without scheme specified should guess
- bzr missing
-- lookup_revision_id()'s result depends on the current branching scheme,
- causing weird errors when pushing
- add tests for objects returned by WorkingTree.pull(), Branch.pull()
.svn working trees:
=== modified file 'mapping.py'
--- a/mapping.py 2008-08-31 15:31:04 +0000
+++ b/mapping.py 2008-08-31 17:34:49 +0000
@@ -570,7 +570,7 @@
return {}
return parse_fileid_property(fileids)
- def record_merges(self, merges, fileprops):
+ def _record_merges(self, merges, fileprops):
"""Store the extra merges (non-LHS parents) in a file property.
:param merges: List of parents.
@@ -588,7 +588,7 @@
timestamp, timezone, committer, revprops)
if len(parent_ids) > 1:
- svn_fileprops.update(self.record_merges(parent_ids[1:], svn_fileprops))
+ svn_fileprops.update(self._record_merges(parent_ids[1:], svn_fileprops))
# Set appropriate property if revision id was specified by
# caller
@@ -658,7 +658,7 @@
return revprops[SVN_REVPROP_BZR_ROOT]
def get_revision_id(self, branch_path, revprops, fileprops):
- if not is_bzr_revision_revprops(revprops):
+ if not is_bzr_revision_revprops(revprops) or not SVN_REVPROP_BZR_REVISION_ID in revprops:
return (None, None)
revid = revprops[SVN_REVPROP_BZR_REVISION_ID]
revno = int(revprops[SVN_REVPROP_BZR_REVNO])
=== modified file 'repository.py'
--- a/repository.py 2008-08-31 14:41:53 +0000
+++ b/repository.py 2008-08-31 17:34:49 +0000
@@ -56,6 +56,15 @@
VirtualInventoryTexts, VirtualSignatureTexts)
def full_paths(find_children, paths, bp, from_bp, from_rev):
+ """Generate the changes creating a specified branch path.
+
+ :param find_children: Function that recursively lists all children
+ of a path in a revision.
+ :param paths: Paths dictionary to update
+ :param bp: Branch path to create.
+ :param from_bp: Path to look up children in
+ :param from_rev: Revision to look up children in.
+ """
for c in find_children(from_bp, from_rev):
path = c.replace(from_bp, bp+"/", 1).replace("//", "/")
paths[path] = ('A', None, -1)
@@ -152,7 +161,6 @@
return rev
-
def __hash__(self):
return hash((self.__class__, self.repository.uuid, self.branch_path, self.revnum))
=== modified file 'tests/mapping3/__init__.py'
--- a/tests/mapping3/__init__.py 2008-08-31 15:31:04 +0000
+++ b/tests/mapping3/__init__.py 2008-08-31 17:34:49 +0000
@@ -13,6 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import sha1
+
from bzrlib.tests import TestCase
from bzrlib.plugins.svn.mapping3 import BzrSvnMappingv3FileProps
=== modified file 'tests/test_workingtree.py'
--- a/tests/test_workingtree.py 2008-08-30 23:45:11 +0000
+++ b/tests/test_workingtree.py 2008-08-31 17:34:49 +0000
@@ -333,7 +333,7 @@
repos_url = self.make_client('a', 'dc')
self.build_tree({"dc/bl": "data"})
tree = WorkingTree.open("dc")
- self.assertEqual((Branch.open(repos_url).last_revision(),), tree.get_parent_ids())
+ self.assertEqual([Branch.open(repos_url).last_revision()], tree.get_parent_ids())
def test_delta(self):
self.make_client('a', 'dc')
@@ -449,9 +449,9 @@
tree = WorkingTree.open("dc")
tree.set_pending_merges(["a", "c"])
- self.assertEqual((lhs_parent_id, "a", "c"), tree.get_parent_ids())
+ self.assertEqual([lhs_parent_id, "a", "c"], tree.get_parent_ids())
tree.set_pending_merges([])
- self.assertEqual((lhs_parent_id,), tree.get_parent_ids())
+ self.assertEqual([lhs_parent_id], tree.get_parent_ids())
def test_set_pending_merges_prop(self):
self.make_client('a', 'dc')
=== modified file 'workingtree.py'
--- a/workingtree.py 2008-08-31 13:44:01 +0000
+++ b/workingtree.py 2008-08-31 17:34:49 +0000
@@ -412,7 +412,7 @@
wc.process_committed(self.abspath(path).rstrip("/"),
False, self.branch.lookup_revision_id(newrevtree.inventory[id].revision),
svn_revprops[properties.PROP_REVISION_DATE],
- svn_revprops[properties.PROP_REVISION_AUTHOR])
+ svn_revprops.get(properties.PROP_REVISION_AUTHOR, ""))
child_path = os.path.join(path, name.decode("utf-8"))
@@ -429,11 +429,15 @@
wc.process_committed(self.basedir,
False, self.branch.lookup_revision_id(newrevtree.inventory.root.revision),
svn_revprops[properties.PROP_REVISION_DATE],
- svn_revprops[properties.PROP_REVISION_AUTHOR])
+ svn_revprops.get(properties.PROP_REVISION_AUTHOR, ""))
update_settings(wc, "")
finally:
wc.close()
+ def set_parent_trees(self, parents_list, allow_leftmost_as_ghost=False):
+ """See MutableTree.set_parent_trees."""
+ self.set_parent_ids([rev for (rev, tree) in parents_list])
+
def smart_add(self, file_list, recurse=True, action=None, save=True):
assert isinstance(recurse, bool)
if action is None:
@@ -567,14 +571,6 @@
finally:
wc.close()
- def _get_changed_branch_props(self):
- wc = self._get_wc()
- try:
- (prop_changes, orig_props) = wc.get_prop_diffs(self.basedir)
- return dict(prop_changes)
- finally:
- wc.close()
-
def _set_branch_props(self, wc, fileprops):
for k,v in fileprops.items():
wc.prop_set(k, v, self.basedir)
@@ -597,47 +593,8 @@
def apply_inventory_delta(self, delta):
assert delta == []
- def set_pending_merges(self, merges):
- """See MutableTree.set_pending_merges()."""
- wc = self._get_wc(write_lock=True)
- try:
- base_fileprops = self._get_base_branch_props()
- fileprops = self.branch.mapping.record_merges(merges, base_fileprops)
-
- svk_merges = parse_svk_features(self._get_svk_merges(base_fileprops))
-
- # Set svk:merge
- for merge in merges:
- try:
- svk_merges.add(_revision_id_to_svk_feature(merge))
- except InvalidRevisionId:
- pass
-
- fileprops[SVN_PROP_SVK_MERGE] = serialize_svk_features(svk_merges)
- self._set_branch_props(wc, fileprops)
- finally:
- wc.close()
-
- def add_pending_merge(self, revid):
- merges = self.pending_merges()
- merges.append(revid)
- self.set_pending_merges(merges)
-
- def get_parent_ids(self):
- return (self.base_revid,) + self.pending_merges()
-
- def set_parent_ids(self, revision_ids, allow_lefmost_as_ghost=False):
- self.set_last_revision(revision_ids[0])
- if self.pending_merges() != revision_ids[1:]:
- self.set_pending_merges(revision_ids[1:])
-
- def pending_merges(self):
- wc = self._get_wc()
- try:
- return self.branch.mapping.get_rhs_parents(self.branch.get_branch_path(), {},
- self._get_changed_branch_props())
- finally:
- wc.close()
+ def _last_revision(self):
+ return self.base_revid
def path_content_summary(self, path, _lstat=os.lstat,
_mapper=osutils.file_kind_from_stat_mode):
More information about the bazaar-commits
mailing list