comparison upmana/mercurial/hbisect.py @ 28:ff154cf3350c ornery-orc

Traipse 'OpenRPG' {100203-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Stable) New Features: New Bookmarks Feature New 'boot' command to remote admin New confirmation window for sent nodes Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG New Zoom Mouse plugin added New Images added to Plugin UI Switching to Element Tree New Map efficiency, from FlexiRPG New Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) New Portable Mercurial New Tip of the Day, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added New Dieroller structure from Core New DieRoller portability for odd Dice New 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added New vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Included for Mythos roller also New Warhammer FRPG Die Roller (Special thanks to Puu-san for the support) New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Beta!) New Grids act more like Spreadsheets in Use mode, with Auto Calc Fixes: Fix to allow for portability to an OpenSUSE linux OS Fix to mplay_client for Fedora and OpenSUSE Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fix to Whiteboard ID to prevent random line or text deleting. Fixes to Server, Remote Server, and Server GUI Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and now reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode Fix made Image Fetching. New fetching image and new failed image Fix to whiteboard ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml
author sirebral
date Wed, 03 Feb 2010 22:16:49 -0600
parents
children
comparison
equal deleted inserted replaced
27:51428d30c59e 28:ff154cf3350c
1 # changelog bisection for mercurial
2 #
3 # Copyright 2007 Matt Mackall
4 # Copyright 2005, 2006 Benoit Boissinot <benoit.boissinot@ens-lyon.org>
5 #
6 # Inspired by git bisect, extension skeleton taken from mq.py.
7 #
8 # This software may be used and distributed according to the terms of the
9 # GNU General Public License version 2, incorporated herein by reference.
10
11 import os
12 from i18n import _
13 from node import short, hex
14 import util
15
16 def bisect(changelog, state):
17 """find the next node (if any) for testing during a bisect search.
18 returns a (nodes, number, good) tuple.
19
20 'nodes' is the final result of the bisect if 'number' is 0.
21 Otherwise 'number' indicates the remaining possible candidates for
22 the search and 'nodes' contains the next bisect target.
23 'good' is True if bisect is searching for a first good changeset, False
24 if searching for a first bad one.
25 """
26
27 clparents = changelog.parentrevs
28 skip = set([changelog.rev(n) for n in state['skip']])
29
30 def buildancestors(bad, good):
31 # only the earliest bad revision matters
32 badrev = min([changelog.rev(n) for n in bad])
33 goodrevs = [changelog.rev(n) for n in good]
34 # build ancestors array
35 ancestors = [[]] * (len(changelog) + 1) # an extra for [-1]
36
37 # clear good revs from array
38 for node in goodrevs:
39 ancestors[node] = None
40 for rev in xrange(len(changelog), -1, -1):
41 if ancestors[rev] is None:
42 for prev in clparents(rev):
43 ancestors[prev] = None
44
45 if ancestors[badrev] is None:
46 return badrev, None
47 return badrev, ancestors
48
49 good = 0
50 badrev, ancestors = buildancestors(state['bad'], state['good'])
51 if not ancestors: # looking for bad to good transition?
52 good = 1
53 badrev, ancestors = buildancestors(state['good'], state['bad'])
54 bad = changelog.node(badrev)
55 if not ancestors: # now we're confused
56 raise util.Abort(_("Inconsistent state, %s:%s is good and bad")
57 % (badrev, short(bad)))
58
59 # build children dict
60 children = {}
61 visit = [badrev]
62 candidates = []
63 while visit:
64 rev = visit.pop(0)
65 if ancestors[rev] == []:
66 candidates.append(rev)
67 for prev in clparents(rev):
68 if prev != -1:
69 if prev in children:
70 children[prev].append(rev)
71 else:
72 children[prev] = [rev]
73 visit.append(prev)
74
75 candidates.sort()
76 # have we narrowed it down to one entry?
77 # or have all other possible candidates besides 'bad' have been skipped?
78 tot = len(candidates)
79 unskipped = [c for c in candidates if (c not in skip) and (c != badrev)]
80 if tot == 1 or not unskipped:
81 return ([changelog.node(rev) for rev in candidates], 0, good)
82 perfect = tot // 2
83
84 # find the best node to test
85 best_rev = None
86 best_len = -1
87 poison = set()
88 for rev in candidates:
89 if rev in poison:
90 # poison children
91 poison.update(children.get(rev, []))
92 continue
93
94 a = ancestors[rev] or [rev]
95 ancestors[rev] = None
96
97 x = len(a) # number of ancestors
98 y = tot - x # number of non-ancestors
99 value = min(x, y) # how good is this test?
100 if value > best_len and rev not in skip:
101 best_len = value
102 best_rev = rev
103 if value == perfect: # found a perfect candidate? quit early
104 break
105
106 if y < perfect and rev not in skip: # all downhill from here?
107 # poison children
108 poison.update(children.get(rev, []))
109 continue
110
111 for c in children.get(rev, []):
112 if ancestors[c]:
113 ancestors[c] = list(set(ancestors[c] + a))
114 else:
115 ancestors[c] = a + [c]
116
117 assert best_rev is not None
118 best_node = changelog.node(best_rev)
119
120 return ([best_node], tot, good)
121
122
123 def load_state(repo):
124 state = {'good': [], 'bad': [], 'skip': []}
125 if os.path.exists(repo.join("bisect.state")):
126 for l in repo.opener("bisect.state"):
127 kind, node = l[:-1].split()
128 node = repo.lookup(node)
129 if kind not in state:
130 raise util.Abort(_("unknown bisect kind %s") % kind)
131 state[kind].append(node)
132 return state
133
134
135 def save_state(repo, state):
136 f = repo.opener("bisect.state", "w", atomictemp=True)
137 wlock = repo.wlock()
138 try:
139 for kind in state:
140 for node in state[kind]:
141 f.write("%s %s\n" % (kind, hex(node)))
142 f.rename()
143 finally:
144 wlock.release()
145