Rev 1437: Deal with tags that are used as a branch. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Sun Jul 6 13:37:57 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1437
revision-id: jelmer at samba.org-20080706123754-i70rhy95w2tlnkiv
parent: jelmer at samba.org-20080706021756-9fyp2q6741mpp051
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-07-06 14:37:54 +0200
message:
Deal with tags that are used as a branch.
modified:
repository.py repository.py-20060306123302-1f8c5069b3fe0265
tests/test_repository.py test_repos.py-20060508151940-ddc49a59257ca712
=== modified file 'repository.py'
--- a/repository.py 2008-07-05 01:12:40 +0000
+++ b/repository.py 2008-07-06 12:37:54 +0000
@@ -457,8 +457,8 @@
assert isinstance(path, str)
assert isinstance(revnum, int)
- iterator = self.iter_reverse_branch_changes(path, revnum, mapping=mapping,
- limit=2)
+ iterator = self.iter_reverse_branch_changes(path, revnum,
+ mapping=mapping, limit=2)
revmeta = iterator.next()
assert revmeta.branch_path == path
assert revmeta.revnum == revnum
@@ -739,12 +739,13 @@
it = self.iter_changes(bp, revnum, mapping, pb=pb, limit=2)
rev = revnum
paths = it.next()[1]
- del paths[bp]
- if not changes.changes_path(paths, bp, False):
- try:
- (bp, _, rev, _) = it.next()
- except StopIteration:
- pass
+ if paths.has_key(bp):
+ del paths[bp]
+ if not changes.changes_path(paths, bp, False):
+ try:
+ (bp, _, rev, _) = it.next()
+ except StopIteration:
+ pass
tags[nick] = self.generate_revision_id(rev, bp, mapping)
finally:
=== modified file 'tests/test_repository.py'
--- a/tests/test_repository.py 2008-07-03 18:53:23 +0000
+++ b/tests/test_repository.py 2008-07-06 12:37:54 +0000
@@ -402,20 +402,60 @@
branches[0].base)
def test_find_tags(self):
- repos_url = self.make_client('a', 'dc')
- self.build_tree({
- 'dc/tags/brancha': None,
- 'dc/tags/branchab': None,
- 'dc/tags/brancha/data': "data",
- "dc/tags/branchab/data":"data"})
- self.client_add("dc/tags")
- self.client_commit("dc", "My Message")
+ repos_url = self.make_repository('a')
+
+ dc = self.get_commit_editor(repos_url)
+ tags = dc.add_dir("tags")
+ tags.add_dir("tags/brancha").add_file("tags/brancha/data").modify()
+ tags.add_dir("tags/branchab").add_file("tags/branchab/data").modify()
+ dc.close()
+
repos = Repository.open(repos_url)
set_branching_scheme(repos, TrunkBranchingScheme())
tags = repos.find_tags()
self.assertEquals({"brancha": repos.generate_revision_id(1, "tags/brancha", repos.get_mapping()),
"branchab": repos.generate_revision_id(1, "tags/branchab", repos.get_mapping())}, tags)
+ def test_find_tags_unmodified(self):
+ repos_url = self.make_repository('a')
+
+ dc = self.get_commit_editor(repos_url)
+ dc.add_dir("trunk").add_file("trunk/data").modify()
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ tags = dc.add_dir("tags")
+ tags.add_dir("tags/brancha", "trunk")
+ dc.close()
+
+ repos = Repository.open(repos_url)
+ set_branching_scheme(repos, TrunkBranchingScheme())
+ tags = repos.find_tags()
+ self.assertEquals({"brancha": repos.generate_revision_id(1, "trunk", repos.get_mapping())}, tags)
+
+ def test_find_tags_modified(self):
+ repos_url = self.make_repository('a')
+
+ dc = self.get_commit_editor(repos_url)
+ dc.add_dir("trunk").add_file("trunk/data").modify()
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ tags = dc.add_dir("tags")
+ tags.add_dir("tags/brancha", "trunk")
+ dc.close()
+
+ dc = self.get_commit_editor(repos_url)
+ tags = dc.open_dir("tags")
+ brancha = tags.open_dir("tags/brancha")
+ brancha.add_file("tags/brancha/release-notes").modify()
+ dc.close()
+
+ repos = Repository.open(repos_url)
+ set_branching_scheme(repos, TrunkBranchingScheme())
+ tags = repos.find_tags()
+ self.assertEquals({"brancha": repos.generate_revision_id(3, "tags/brancha", repos.get_mapping())}, tags)
+
def test_find_branchpaths_moved(self):
repos_url = self.make_client("a", "dc")
self.build_tree({
More information about the bazaar-commits
mailing list