Mercurial > traipse
comparison upmana/mercurial/subrepo.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 # subrepo.py - sub-repository handling for Mercurial | |
2 # | |
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> | |
4 # | |
5 # This software may be used and distributed according to the terms of the | |
6 # GNU General Public License version 2, incorporated herein by reference. | |
7 | |
8 import errno, os | |
9 from i18n import _ | |
10 import config, util, node, error | |
11 localrepo = hg = None | |
12 | |
13 nullstate = ('', '') | |
14 | |
15 def state(ctx): | |
16 p = config.config() | |
17 def read(f, sections=None, remap=None): | |
18 if f in ctx: | |
19 try: | |
20 p.parse(f, ctx[f].data(), sections, remap) | |
21 except IOError, err: | |
22 if err.errno != errno.ENOENT: | |
23 raise | |
24 read('.hgsub') | |
25 | |
26 rev = {} | |
27 if '.hgsubstate' in ctx: | |
28 try: | |
29 for l in ctx['.hgsubstate'].data().splitlines(): | |
30 revision, path = l.split() | |
31 rev[path] = revision | |
32 except IOError, err: | |
33 if err.errno != errno.ENOENT: | |
34 raise | |
35 | |
36 state = {} | |
37 for path, src in p[''].items(): | |
38 state[path] = (src, rev.get(path, '')) | |
39 | |
40 return state | |
41 | |
42 def writestate(repo, state): | |
43 repo.wwrite('.hgsubstate', | |
44 ''.join(['%s %s\n' % (state[s][1], s) | |
45 for s in sorted(state)]), '') | |
46 | |
47 def submerge(repo, wctx, mctx, actx): | |
48 if mctx == actx: # backwards? | |
49 actx = wctx.p1() | |
50 s1 = wctx.substate | |
51 s2 = mctx.substate | |
52 sa = actx.substate | |
53 sm = {} | |
54 | |
55 for s, l in s1.items(): | |
56 a = sa.get(s, nullstate) | |
57 if s in s2: | |
58 r = s2[s] | |
59 if l == r or r == a: # no change or local is newer | |
60 sm[s] = l | |
61 continue | |
62 elif l == a: # other side changed | |
63 wctx.sub(s).get(r) | |
64 sm[s] = r | |
65 elif l[0] != r[0]: # sources differ | |
66 if repo.ui.prompt( | |
67 _(' subrepository sources for %s differ\n' | |
68 'use (l)ocal source (%s) or (r)emote source (%s)?') | |
69 % (s, l[0], r[0]), | |
70 (_('&Local'), _('&Remote')), _('l')) == _('r'): | |
71 wctx.sub(s).get(r) | |
72 sm[s] = r | |
73 elif l[1] == a[1]: # local side is unchanged | |
74 wctx.sub(s).get(r) | |
75 sm[s] = r | |
76 else: | |
77 wctx.sub(s).merge(r) | |
78 sm[s] = l | |
79 elif l == a: # remote removed, local unchanged | |
80 wctx.sub(s).remove() | |
81 else: | |
82 if repo.ui.prompt( | |
83 _(' local changed subrepository %s which remote removed\n' | |
84 'use (c)hanged version or (d)elete?') % s, | |
85 (_('&Changed'), _('&Delete')), _('c')) == _('d'): | |
86 wctx.sub(s).remove() | |
87 | |
88 for s, r in s2.items(): | |
89 if s in s1: | |
90 continue | |
91 elif s not in sa: | |
92 wctx.sub(s).get(r) | |
93 sm[s] = r | |
94 elif r != sa[s]: | |
95 if repo.ui.prompt( | |
96 _(' remote changed subrepository %s which local removed\n' | |
97 'use (c)hanged version or (d)elete?') % s, | |
98 (_('&Changed'), _('&Delete')), _('c')) == _('c'): | |
99 wctx.sub(s).get(r) | |
100 sm[s] = r | |
101 | |
102 # record merged .hgsubstate | |
103 writestate(repo, sm) | |
104 | |
105 def _abssource(repo, push=False): | |
106 if hasattr(repo, '_subparent'): | |
107 source = repo._subsource | |
108 if source.startswith('/') or '://' in source: | |
109 return source | |
110 parent = _abssource(repo._subparent) | |
111 if '://' in parent: | |
112 if parent[-1] == '/': | |
113 parent = parent[:-1] | |
114 return parent + '/' + source | |
115 return os.path.join(parent, repo._subsource) | |
116 if push and repo.ui.config('paths', 'default-push'): | |
117 return repo.ui.config('paths', 'default-push', repo.root) | |
118 return repo.ui.config('paths', 'default', repo.root) | |
119 | |
120 def subrepo(ctx, path): | |
121 # subrepo inherently violates our import layering rules | |
122 # because it wants to make repo objects from deep inside the stack | |
123 # so we manually delay the circular imports to not break | |
124 # scripts that don't use our demand-loading | |
125 global localrepo, hg | |
126 import localrepo as l, hg as h | |
127 localrepo = l | |
128 hg = h | |
129 | |
130 util.path_auditor(ctx._repo.root)(path) | |
131 state = ctx.substate.get(path, nullstate) | |
132 if state[0].startswith('['): # future expansion | |
133 raise error.Abort('unknown subrepo source %s' % state[0]) | |
134 return hgsubrepo(ctx, path, state) | |
135 | |
136 class hgsubrepo(object): | |
137 def __init__(self, ctx, path, state): | |
138 self._path = path | |
139 self._state = state | |
140 r = ctx._repo | |
141 root = r.wjoin(path) | |
142 if os.path.exists(os.path.join(root, '.hg')): | |
143 self._repo = localrepo.localrepository(r.ui, root) | |
144 else: | |
145 util.makedirs(root) | |
146 self._repo = localrepo.localrepository(r.ui, root, create=True) | |
147 self._repo._subparent = r | |
148 self._repo._subsource = state[0] | |
149 | |
150 def dirty(self): | |
151 r = self._state[1] | |
152 if r == '': | |
153 return True | |
154 w = self._repo[None] | |
155 if w.p1() != self._repo[r]: # version checked out changed | |
156 return True | |
157 return w.dirty() # working directory changed | |
158 | |
159 def commit(self, text, user, date): | |
160 n = self._repo.commit(text, user, date) | |
161 if not n: | |
162 return self._repo['.'].hex() # different version checked out | |
163 return node.hex(n) | |
164 | |
165 def remove(self): | |
166 # we can't fully delete the repository as it may contain | |
167 # local-only history | |
168 self._repo.ui.note(_('removing subrepo %s\n') % self._path) | |
169 hg.clean(self._repo, node.nullid, False) | |
170 | |
171 def get(self, state): | |
172 source, revision = state | |
173 try: | |
174 self._repo.lookup(revision) | |
175 except error.RepoError: | |
176 self._repo._subsource = source | |
177 self._repo.ui.status(_('pulling subrepo %s\n') % self._path) | |
178 srcurl = _abssource(self._repo) | |
179 other = hg.repository(self._repo.ui, srcurl) | |
180 self._repo.pull(other) | |
181 | |
182 hg.clean(self._repo, revision, False) | |
183 | |
184 def merge(self, state): | |
185 hg.merge(self._repo, state[1], remind=False) | |
186 | |
187 def push(self, force): | |
188 # push subrepos depth-first for coherent ordering | |
189 c = self._repo[''] | |
190 subs = c.substate # only repos that are committed | |
191 for s in sorted(subs): | |
192 c.sub(s).push(force) | |
193 | |
194 self._repo.ui.status(_('pushing subrepo %s\n') % self._path) | |
195 dsturl = _abssource(self._repo, True) | |
196 other = hg.repository(self._repo.ui, dsturl) | |
197 self._repo.push(other, force) | |
198 |