Rev 2257: Report conflicting tags from push. in http://sourcefrog.net/bzr/tags
Martin Pool
mbp at sourcefrog.net
Sun Feb 25 11:11:00 GMT 2007
At http://sourcefrog.net/bzr/tags
------------------------------------------------------------
revno: 2257
revision-id: mbp at sourcefrog.net-20070225111100-iqd6o1x34mv0a60g
parent: mbp at sourcefrog.net-20070225105125-32o9nqxk062ncix0
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: tags
timestamp: Sun 2007-02-25 22:11:00 +1100
message:
Report conflicting tags from push.
Factor out PushResult.report()
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2007-02-25 10:51:25 +0000
+++ b/bzrlib/branch.py 2007-02-25 11:11:00 +0000
@@ -2059,19 +2059,39 @@
######################################################################
# results of operations
-class PullResult(object):
+
+class _Result(object):
+
+ def _show_tag_conficts(self, to_file):
+ if not getattr(self, 'tag_conflicts', None):
+ return
+ to_file.write('Conflicting tags:\n')
+ for name, value1, value2 in self.tag_conflicts:
+ to_file.write(' %s\n' % (name, ))
+
+
+class PullResult(_Result):
def __int__(self):
# DEPRECATED: pull used to return the change in revno
return self.new_revno - self.old_revno
-class PushResult(object):
+class PushResult(_Result):
+ """Describes the result of a Branch.push operation"""
def __int__(self):
# DEPRECATED: push used to return the change in revno
return self.new_revno - self.old_revno
+ def report(self, to_file):
+ """Write a human-readable description of the result."""
+ if self.old_revid == self.new_revid:
+ to_file.write('No new revisions to push.\n')
+ else:
+ to_file.write('Pushed up to revision %d.\n' % self.new_revno)
+ self._show_tag_conficts(to_file)
+
class BranchCheckResult(object):
"""Results of checking branch consistency.
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2007-02-25 10:47:29 +0000
+++ b/bzrlib/builtins.py 2007-02-25 11:11:00 +0000
@@ -664,7 +664,6 @@
directory=None):
# FIXME: Way too big! Put this into a function called from the
# command.
- from bzrlib.tag import _merge_tags_if_possible
if directory is None:
directory = '.'
br_from = Branch.open_containing(directory)[0]
@@ -799,10 +798,7 @@
raise errors.BzrCommandError('These branches have diverged.'
' Try using "merge" and then "push".')
if push_result is not None:
- if push_result.old_revid == push_result.new_revid:
- note('No new revisions to push.\n')
- else:
- note('Pushed up to revision %d.' % push_result.new_revno)
+ push_result.report(self.outf)
elif verbose:
new_rh = br_to.revision_history()
if old_rh != new_rh:
=== modified file 'bzrlib/tests/blackbox/test_tags.py'
--- a/bzrlib/tests/blackbox/test_tags.py 2007-02-22 05:58:51 +0000
+++ b/bzrlib/tests/blackbox/test_tags.py 2007-02-25 11:11:00 +0000
@@ -104,5 +104,14 @@
self.assertContainsRe(out,
u'^\u30d0zaar *revid-1'.encode('utf-8'))
- def test_merge_conflicting_tags(self):
- pass
+ def test_conflicting_tags(self):
+ t1 = self.make_branch_and_tree('one')
+ t2 = self.make_branch_and_tree('two')
+ b1 = t1.branch
+ b2 = t2.branch
+ tagname = u'\u30d0zaar'
+ b1.tags.set_tag(tagname, 'revid1')
+ b2.tags.set_tag(tagname, 'revid2')
+ out, err = self.run_bzr('push', '-d', 'one', 'two', encoding='utf-8')
+ self.assertContainsRe(out,
+ 'Conflicting tags:\n.*' + tagname.encode('utf-8'))
More information about the bazaar-commits
mailing list