~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2007-02-23 05:39:35 UTC
  • mto: (2220.2.35 tags)
  • mto: This revision was merged to the branch mainline in revision 2309.
  • Revision ID: mbp@sourcefrog.net-20070223053935-r601f8e1xwwljm21
Pull now returns a PullResult rather than just an integer.

Remove old Branch.is_control_file function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
399
399
        """Mirror source into this branch.
400
400
 
401
401
        This branch is considered to be 'local', having low latency.
 
402
 
 
403
        :returns: PullResult instance
402
404
        """
403
405
        raise NotImplementedError(self.pull)
404
406
 
1398
1400
        :param _run_hooks: Private parameter - allow disabling of
1399
1401
            hooks, used when pushing to a master branch.
1400
1402
        """
 
1403
        result = PullResult()
 
1404
        result.source = source
1401
1405
        source.lock_read()
1402
1406
        try:
1403
 
            old_count, old_tip = self.last_revision_info()
 
1407
            result.old_revno, result.old_revid = self.last_revision_info()
1404
1408
            try:
1405
1409
                self.update_revisions(source, stop_revision)
1406
1410
            except DivergedBranches:
1408
1412
                    raise
1409
1413
            if overwrite:
1410
1414
                self.set_revision_history(source.revision_history())
1411
 
            new_count, new_tip = self.last_revision_info()
 
1415
            result.new_revno, result.new_revid = self.last_revision_info()
1412
1416
            if _run_hooks:
1413
1417
                if _hook_master:
1414
 
                    _hook_local = self
 
1418
                    result.master = _hook_master
 
1419
                    result.local = self
1415
1420
                else:
1416
 
                    _hook_master = self
1417
 
                    _hook_local = None
 
1421
                    result.master = self
 
1422
                    result.local = None
1418
1423
                for hook in Branch.hooks['post_pull']:
1419
 
                    hook(source, _hook_local, _hook_master, old_count, old_tip,
1420
 
                        new_count, new_tip)
1421
 
            return new_count - old_count
 
1424
                    hook(result)
1422
1425
        finally:
1423
1426
            source.unlock()
 
1427
        return result
1424
1428
 
1425
1429
    def _get_parent_location(self):
1426
1430
        _locs = ['parent', 'pull', 'x-pull']
1914
1918
        return result
1915
1919
 
1916
1920
 
 
1921
######################################################################
 
1922
# results of operations
 
1923
 
 
1924
class PullResult(object):
 
1925
 
 
1926
    pass
 
1927
 
 
1928
 
1917
1929
class BranchCheckResult(object):
1918
1930
    """Results of checking branch consistency.
1919
1931
 
1934
1946
             self.branch._format)
1935
1947
 
1936
1948
 
1937
 
######################################################################
1938
 
# predicates
1939
 
 
1940
 
 
1941
 
@deprecated_function(zero_eight)
1942
 
def is_control_file(*args, **kwargs):
1943
 
    """See bzrlib.workingtree.is_control_file."""
1944
 
    from bzrlib import workingtree
1945
 
    return workingtree.is_control_file(*args, **kwargs)
1946
 
 
1947
 
 
1948
1949
class Converter5to6(object):
1949
1950
    """Perform an in-place upgrade of format 5 to format 6"""
1950
1951