~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to fai.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 19:33:15 UTC
  • mto: (147.2.17)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: abentley@panoramicfeedback.com-20050929193315-0e7880a55be1adc1
Handled empty summary lines

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
__docformat__ = "restructuredtext"
23
23
__doc__ = "Utility functions to be used by commands"
24
24
 
25
 
def direct_merges(merges, excludes=[]):
 
25
def direct_merges(merges):
26
26
    """Get a list of direct merges, from a list of direct and indirect
27
27
    
28
28
    :param merges: Iterator of merge patchlogs
30
30
    :return: The direct merges
31
31
    :rtype: list of `pybaz.Patchlog`
32
32
    """
33
 
    indirect = set()
 
33
    indirect = []
 
34
    direct = []
34
35
    logs = list(merges)
35
36
    if not logs:
36
37
        return []
37
38
    for log in logs:
38
 
        try:
39
 
            this_indirect = set([str(f) for f in log.new_patches 
40
 
                                 if f != log.revision and 
41
 
                                     str(f) not in indirect])
42
 
        except pybaz.errors.NamespaceError:
43
 
            print
44
 
            print "log ", log, " unusable, attempting to use archive copy."
45
 
            log = pybaz.Revision(str(log.revision)).patchlog
46
 
            this_indirect = set([str(f) for f in log.new_patches 
47
 
                                 if f != log.revision and 
48
 
                                     str(f) not in indirect])
49
 
        indirect.update(this_indirect)
 
39
        indirect.extend([f for f in log.new_patches if f != log.revision])
50
40
        if log.continuation_of is not None:
51
41
            # continuations list everything in new_patches
52
42
            continue
71
61
                        found = True
72
62
                print "ancestor of %s is %s" % (log.revision, ancestor)
73
63
        if ancestor is not None:
74
 
            indirect.add(str(ancestor))
75
 
    return [log.revision for log in logs if not str(log.revision) in indirect
76
 
            and log.revision not in excludes]
77
 
 
 
64
            indirect.append(ancestor)
 
65
    return [log for log in logs if not log.revision in indirect]
78
66
 
79
67
def namespace_previous(revision):
80
68
    if revision.patchlevel == 'base-0':