1 | def _get_mergebotstate(ticket): |
---|
2 | if hasattr(ticket, '_old') and 'mergebotstate' in ticket._old: |
---|
3 | state = ticket._old['mergebotstate'] |
---|
4 | else: |
---|
5 | try: |
---|
6 | state = ticket['mergebotstate'] |
---|
7 | except KeyError: |
---|
8 | state = "" |
---|
9 | if state == "--": |
---|
10 | state = "" |
---|
11 | return state |
---|
12 | |
---|
13 | # FIXME: If a ticket has another ticket as its version (#123), then we need to |
---|
14 | # make sure that the other ticket has an existing branch ('branched' mergebot |
---|
15 | # state) before we allow any actions. |
---|
16 | # More accurately, we need to determine if, after all queued actions upon which |
---|
17 | # it would depend complete successfully, that these operations would be |
---|
18 | # allowed. |
---|
19 | def is_branchable(ticket): |
---|
20 | state = _get_mergebotstate(ticket) |
---|
21 | return state == "" or state == "merged" |
---|
22 | |
---|
23 | def is_rebranchable(ticket): |
---|
24 | # TODO: we should be able to tell if trunk (or version) has had commits |
---|
25 | # since we branched, and only mark it as rebranchable if there have |
---|
26 | # been. |
---|
27 | state = _get_mergebotstate(ticket) |
---|
28 | return state in ["branched", "conflicts"] |
---|
29 | |
---|
30 | def is_mergeable(ticket): |
---|
31 | state = _get_mergebotstate(ticket) |
---|
32 | return state == "branched" |
---|
33 | |
---|
34 | def is_checkmergeable(ticket): |
---|
35 | state = _get_mergebotstate(ticket) |
---|
36 | return state == "branched" or state == "conflicts" |
---|
37 | |
---|