/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/revision.py

  • Committer: Martin Pool
  • Date: 2006-06-20 03:30:14 UTC
  • mfrom: (1793 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1797.
  • Revision ID: mbp@sourcefrog.net-20060620033014-e19ce470e2ce6561
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        self._check_properties()
52
52
        self.parent_ids = []
53
53
        self.parent_sha1s = []
 
54
        """Not used anymore - legacy from for 4."""
54
55
        self.__dict__.update(args)
55
56
 
56
57
    def __repr__(self):
101
102
        reversed_result.reverse()
102
103
        return reversed_result
103
104
 
 
105
    def get_summary(self):
 
106
        """Get the first line of the log message for this revision.
 
107
        """
 
108
        return self.message.split('\n', 1)[0]
 
109
 
104
110
 
105
111
def is_ancestor(revision_id, candidate_id, branch):
106
112
    """Return true if candidate_id is an ancestor of revision_id.
399
405
    def unlock(self):
400
406
        for source in self._revision_sources:
401
407
            source.unlock()
 
408
 
 
409
 
 
410
@deprecated_function(zero_eight)
 
411
def get_intervening_revisions(ancestor_id, rev_id, rev_source,
 
412
                              revision_history=None):
 
413
    """Find the longest line of descent from maybe_ancestor to revision.
 
414
    Revision history is followed where possible.
 
415
 
 
416
    If ancestor_id == rev_id, list will be empty.
 
417
    Otherwise, rev_id will be the last entry.  ancestor_id will never appear.
 
418
    If ancestor_id is not an ancestor, NotAncestor will be thrown
 
419
    """
 
420
    root, ancestors, descendants = revision_graph(rev_id, rev_source)
 
421
    if len(descendants) == 0:
 
422
        raise NoSuchRevision(rev_source, rev_id)
 
423
    if ancestor_id not in descendants:
 
424
        rev_source.get_revision(ancestor_id)
 
425
        raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
 
426
    root_descendants = all_descendants(descendants, ancestor_id)
 
427
    root_descendants.add(ancestor_id)
 
428
    if rev_id not in root_descendants:
 
429
        raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
 
430
    distances = node_distances(descendants, ancestors, ancestor_id,
 
431
                               root_descendants=root_descendants)
 
432
 
 
433
    def best_ancestor(rev_id):
 
434
        best = None
 
435
        for anc_id in ancestors[rev_id]:
 
436
            try:
 
437
                distance = distances[anc_id]
 
438
            except KeyError:
 
439
                continue
 
440
            if revision_history is not None and anc_id in revision_history:
 
441
                return anc_id
 
442
            elif best is None or distance > best[1]:
 
443
                best = (anc_id, distance)
 
444
        return best[0]
 
445
 
 
446
    next = rev_id
 
447
    path = []
 
448
    while next != ancestor_id:
 
449
        path.append(next)
 
450
        next = best_ancestor(next)
 
451
    path.reverse()
 
452
    return path