~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

 * bzr add now lists how many files were ignored per glob.  add --verbose
   lists the specific files.  (Aaron Bentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import bzrlib.errors
21
21
from bzrlib.graph import node_distances, select_farthest, all_descendants
22
22
from bzrlib.osutils import contains_whitespace
23
 
from bzrlib.progress import DummyProgress
24
23
 
25
24
NULL_REVISION="null:"
26
25
 
79
78
                raise ValueError("invalid property value %r for %r" % 
80
79
                                 (name, value))
81
80
 
82
 
    def get_history(self, repository):
83
 
        """Return the canonical line-of-history for this revision.
84
 
 
85
 
        If ghosts are present this may differ in result from a ghost-free
86
 
        repository.
87
 
        """
88
 
        current_revision = self
89
 
        reversed_result = []
90
 
        while current_revision is not None:
91
 
            reversed_result.append(current_revision.revision_id)
92
 
            if not len (current_revision.parent_ids):
93
 
                reversed_result.append(None)
94
 
                current_revision = None
95
 
            else:
96
 
                next_revision_id = current_revision.parent_ids[0]
97
 
                current_revision = repository.get_revision(next_revision_id)
98
 
        reversed_result.reverse()
99
 
        return reversed_result
100
 
 
101
81
 
102
82
def is_ancestor(revision_id, candidate_id, branch):
103
83
    """Return true if candidate_id is an ancestor of revision_id.
108
88
    revisions_source is an object supporting a get_revision operation that
109
89
    behaves like Branch's.
110
90
    """
111
 
    return candidate_id in branch.repository.get_ancestry(revision_id)
 
91
    return candidate_id in branch.get_ancestry(revision_id)
112
92
 
113
93
 
114
94
def iter_ancestors(revision_id, revision_source, only_present=False):
280
260
    return root, ancestors, descendants, common
281
261
 
282
262
 
283
 
def common_ancestor(revision_a, revision_b, revision_source, 
284
 
                    pb=DummyProgress()):
 
263
def common_ancestor(revision_a, revision_b, revision_source):
285
264
    try:
286
 
        try:
287
 
            pb.update('Picking ancestor', 1, 3)
288
 
            root, ancestors, descendants, common = \
289
 
                combined_graph(revision_a, revision_b, revision_source)
290
 
        except bzrlib.errors.NoCommonRoot:
291
 
            raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
292
 
            
293
 
        pb.update('Picking ancestor', 2, 3)
294
 
        distances = node_distances (descendants, ancestors, root)
295
 
        pb.update('Picking ancestor', 3, 2)
296
 
        farthest = select_farthest(distances, common)
297
 
        if farthest is None or farthest == NULL_REVISION:
298
 
            raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
299
 
    finally:
300
 
        pb.clear()
 
265
        root, ancestors, descendants, common = \
 
266
            combined_graph(revision_a, revision_b, revision_source)
 
267
    except bzrlib.errors.NoCommonRoot:
 
268
        raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
 
269
        
 
270
    distances = node_distances (descendants, ancestors, root)
 
271
    farthest = select_farthest(distances, common)
 
272
    if farthest is None or farthest == NULL_REVISION:
 
273
        raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
301
274
    return farthest
302
275
 
303
276