/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2007-02-25 11:11:00 UTC
  • mto: This revision was merged to the branch mainline in revision 2309.
  • Revision ID: mbp@sourcefrog.net-20070225111100-iqd6o1x34mv0a60g
Report conflicting tags from push.
Factor out PushResult.report()

Show diffs side-by-side

added added

removed removed

Lines of Context:
2059
2059
######################################################################
2060
2060
# results of operations
2061
2061
 
2062
 
class PullResult(object):
 
2062
 
 
2063
class _Result(object):
 
2064
 
 
2065
    def _show_tag_conficts(self, to_file):
 
2066
        if not getattr(self, 'tag_conflicts', None):
 
2067
            return
 
2068
        to_file.write('Conflicting tags:\n')
 
2069
        for name, value1, value2 in self.tag_conflicts:
 
2070
            to_file.write('    %s\n' % (name, ))
 
2071
 
 
2072
 
 
2073
class PullResult(_Result):
2063
2074
 
2064
2075
    def __int__(self):
2065
2076
        # DEPRECATED: pull used to return the change in revno
2066
2077
        return self.new_revno - self.old_revno
2067
2078
 
2068
2079
 
2069
 
class PushResult(object):
 
2080
class PushResult(_Result):
 
2081
    """Describes the result of a Branch.push operation"""
2070
2082
 
2071
2083
    def __int__(self):
2072
2084
        # DEPRECATED: push used to return the change in revno
2073
2085
        return self.new_revno - self.old_revno
2074
2086
 
 
2087
    def report(self, to_file):
 
2088
        """Write a human-readable description of the result."""
 
2089
        if self.old_revid == self.new_revid:
 
2090
            to_file.write('No new revisions to push.\n')
 
2091
        else:
 
2092
            to_file.write('Pushed up to revision %d.\n' % self.new_revno)
 
2093
        self._show_tag_conficts(to_file)
 
2094
 
2075
2095
 
2076
2096
class BranchCheckResult(object):
2077
2097
    """Results of checking branch consistency.