~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to fai.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 13:26:07 UTC
  • mto: (147.2.17)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: abentley@panoramicfeedback.com-20050929132607-822df5d29e8e595d
Committed debugging changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#    along with this program; if not, write to the Free Software
16
16
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
import pybaz
19
 
from pybaz.backends.baz import sequence_cmd
 
18
from bzrlib.plugins.bzrtools import pybaz
 
19
import pybaz.errors
 
20
from bzrlib.plugins.bzrtools.pybaz.backends.baz import sequence_cmd
20
21
import re
21
22
 
 
23
 
22
24
__docformat__ = "restructuredtext"
23
25
__doc__ = "Utility functions to be used by commands"
24
26
 
25
 
def direct_merges(merges, excludes=[]):
 
27
def direct_merges(merges):
26
28
    """Get a list of direct merges, from a list of direct and indirect
27
29
    
28
30
    :param merges: Iterator of merge patchlogs
30
32
    :return: The direct merges
31
33
    :rtype: list of `pybaz.Patchlog`
32
34
    """
33
 
    indirect = set()
 
35
    indirect = []
 
36
    direct = []
34
37
    logs = list(merges)
35
38
    if not logs:
36
39
        return []
37
40
    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)
 
41
        indirect.extend([f for f in log.new_patches if f != log.revision])
50
42
        if log.continuation_of is not None:
51
43
            # continuations list everything in new_patches
52
44
            continue
70
62
                    if tree_log.revision == log.revision:
71
63
                        found = True
72
64
                print "ancestor of %s is %s" % (log.revision, ancestor)
 
65
        except Exception, e:
 
66
            print repr(e.__class__)
 
67
            print repr(pybaz.errors.ExecProblem)
 
68
            print e.__class__ == pybaz.errors.ExecProblem
 
69
            raise
73
70
        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
 
 
 
71
            indirect.append(ancestor)
 
72
    return [log for log in logs if not log.revision in indirect]
78
73
 
79
74
def namespace_previous(revision):
80
75
    if revision.patchlevel == 'base-0':