~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Aaron Bentley
  • Date: 2005-09-14 16:37:24 UTC
  • mto: (1185.1.16)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: abentley@panoramicfeedback.com-20050914163724-24852cc764d1bcf4
Added ancestor revision namepsace

Show diffs side-by-side

added added

removed removed

Lines of Context:
1091
1091
                    return (i+1,)
1092
1092
    REVISION_NAMESPACES['date:'] = _namespace_date
1093
1093
 
 
1094
 
 
1095
    def _namespace_ancestor(self, revs, revision):
 
1096
        from revision import common_ancestor, MultipleRevisionSources
 
1097
        other_branch = find_branch(_trim_namespace('ancestor', revision))
 
1098
        revision_a = self.last_patch()
 
1099
        revision_b = other_branch.last_patch()
 
1100
        for r, b in ((revision_a, self), (revision_b, other_branch)):
 
1101
            if r is None:
 
1102
                raise bzrlib.errors.NoCommits(b)
 
1103
        revision_source = MultipleRevisionSources(self, other_branch)
 
1104
        result = common_ancestor(revision_a, revision_b, revision_source)
 
1105
        try:
 
1106
            revno = self.revision_id_to_revno(result)
 
1107
        except bzrlib.errors.NoSuchRevision:
 
1108
            revno = None
 
1109
        return revno,result
 
1110
        
 
1111
 
 
1112
    REVISION_NAMESPACES['ancestor:'] = _namespace_ancestor
 
1113
 
1094
1114
    def revision_tree(self, revision_id):
1095
1115
        """Return Tree for a revision on this branch.
1096
1116
 
1541
1561
    
1542
1562
    from_location = pull_loc(branch_from)
1543
1563
    br_to.set_parent(pull_loc(branch_from))
 
1564
    return br_to
1544
1565
 
 
1566
def _trim_namespace(namespace, spec):
 
1567
    full_namespace = namespace + ':'
 
1568
    assert spec.startswith(full_namespace)
 
1569
    return spec[len(full_namespace):]