Show More
@@ -1,245 +1,255 b'' | |||||
1 | # subrepo.py - sub-repository handling for Mercurial |
|
1 | # subrepo.py - sub-repository handling for Mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
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. |
|
6 | # GNU General Public License version 2, incorporated herein by reference. | |
7 |
|
7 | |||
8 | import errno, os |
|
8 | import errno, os | |
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | import config, util, node, error |
|
10 | import config, util, node, error | |
11 | hg = None |
|
11 | hg = None | |
12 |
|
12 | |||
13 | nullstate = ('', '') |
|
13 | nullstate = ('', '', 'empty') | |
14 |
|
14 | |||
15 | def state(ctx): |
|
15 | def state(ctx): | |
16 | p = config.config() |
|
16 | p = config.config() | |
17 | def read(f, sections=None, remap=None): |
|
17 | def read(f, sections=None, remap=None): | |
18 | if f in ctx: |
|
18 | if f in ctx: | |
19 | p.parse(f, ctx[f].data(), sections, remap, read) |
|
19 | p.parse(f, ctx[f].data(), sections, remap, read) | |
20 | else: |
|
20 | else: | |
21 | raise util.Abort(_("subrepo spec file %s not found") % f) |
|
21 | raise util.Abort(_("subrepo spec file %s not found") % f) | |
22 |
|
22 | |||
23 | if '.hgsub' in ctx: |
|
23 | if '.hgsub' in ctx: | |
24 | read('.hgsub') |
|
24 | read('.hgsub') | |
25 |
|
25 | |||
26 | rev = {} |
|
26 | rev = {} | |
27 | if '.hgsubstate' in ctx: |
|
27 | if '.hgsubstate' in ctx: | |
28 | try: |
|
28 | try: | |
29 | for l in ctx['.hgsubstate'].data().splitlines(): |
|
29 | for l in ctx['.hgsubstate'].data().splitlines(): | |
30 | revision, path = l.split(" ", 1) |
|
30 | revision, path = l.split(" ", 1) | |
31 | rev[path] = revision |
|
31 | rev[path] = revision | |
32 | except IOError, err: |
|
32 | except IOError, err: | |
33 | if err.errno != errno.ENOENT: |
|
33 | if err.errno != errno.ENOENT: | |
34 | raise |
|
34 | raise | |
35 |
|
35 | |||
36 | state = {} |
|
36 | state = {} | |
37 | for path, src in p[''].items(): |
|
37 | for path, src in p[''].items(): | |
38 | state[path] = (src, rev.get(path, '')) |
|
38 | kind = 'hg' | |
|
39 | if src.startswith('['): | |||
|
40 | if ']' not in src: | |||
|
41 | raise util.Abort(_('missing ] in subrepo source')) | |||
|
42 | kind, src = src.split(']', 1) | |||
|
43 | kind = kind[1:] | |||
|
44 | state[path] = (src, rev.get(path, ''), kind) | |||
39 |
|
45 | |||
40 | return state |
|
46 | return state | |
41 |
|
47 | |||
42 | def writestate(repo, state): |
|
48 | def writestate(repo, state): | |
43 | repo.wwrite('.hgsubstate', |
|
49 | repo.wwrite('.hgsubstate', | |
44 | ''.join(['%s %s\n' % (state[s][1], s) |
|
50 | ''.join(['%s %s\n' % (state[s][1], s) | |
45 | for s in sorted(state)]), '') |
|
51 | for s in sorted(state)]), '') | |
46 |
|
52 | |||
47 | def submerge(repo, wctx, mctx, actx): |
|
53 | def submerge(repo, wctx, mctx, actx): | |
48 | # working context, merging context, ancestor context |
|
54 | # working context, merging context, ancestor context | |
49 | if mctx == actx: # backwards? |
|
55 | if mctx == actx: # backwards? | |
50 | actx = wctx.p1() |
|
56 | actx = wctx.p1() | |
51 | s1 = wctx.substate |
|
57 | s1 = wctx.substate | |
52 | s2 = mctx.substate |
|
58 | s2 = mctx.substate | |
53 | sa = actx.substate |
|
59 | sa = actx.substate | |
54 | sm = {} |
|
60 | sm = {} | |
55 |
|
61 | |||
56 | repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx)) |
|
62 | repo.ui.debug("subrepo merge %s %s %s\n" % (wctx, mctx, actx)) | |
57 |
|
63 | |||
58 | def debug(s, msg, r=""): |
|
64 | def debug(s, msg, r=""): | |
59 | if r: |
|
65 | if r: | |
60 | r = "%s:%s" % r |
|
66 | r = "%s:%s:%s" % r | |
61 | repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) |
|
67 | repo.ui.debug(" subrepo %s: %s %s\n" % (s, msg, r)) | |
62 |
|
68 | |||
63 | for s, l in s1.items(): |
|
69 | for s, l in s1.items(): | |
64 | if wctx != actx and wctx.sub(s).dirty(): |
|
70 | if wctx != actx and wctx.sub(s).dirty(): | |
65 | l = (l[0], l[1] + "+") |
|
71 | l = (l[0], l[1] + "+") | |
66 | a = sa.get(s, nullstate) |
|
72 | a = sa.get(s, nullstate) | |
67 | if s in s2: |
|
73 | if s in s2: | |
68 | r = s2[s] |
|
74 | r = s2[s] | |
69 | if l == r or r == a: # no change or local is newer |
|
75 | if l == r or r == a: # no change or local is newer | |
70 | sm[s] = l |
|
76 | sm[s] = l | |
71 | continue |
|
77 | continue | |
72 | elif l == a: # other side changed |
|
78 | elif l == a: # other side changed | |
73 | debug(s, "other changed, get", r) |
|
79 | debug(s, "other changed, get", r) | |
74 | wctx.sub(s).get(r) |
|
80 | wctx.sub(s).get(r) | |
75 | sm[s] = r |
|
81 | sm[s] = r | |
76 | elif l[0] != r[0]: # sources differ |
|
82 | elif l[0] != r[0]: # sources differ | |
77 | if repo.ui.promptchoice( |
|
83 | if repo.ui.promptchoice( | |
78 | _(' subrepository sources for %s differ\n' |
|
84 | _(' subrepository sources for %s differ\n' | |
79 | 'use (l)ocal source (%s) or (r)emote source (%s)?') |
|
85 | 'use (l)ocal source (%s) or (r)emote source (%s)?') | |
80 | % (s, l[0], r[0]), |
|
86 | % (s, l[0], r[0]), | |
81 | (_('&Local'), _('&Remote')), 0): |
|
87 | (_('&Local'), _('&Remote')), 0): | |
82 | debug(s, "prompt changed, get", r) |
|
88 | debug(s, "prompt changed, get", r) | |
83 | wctx.sub(s).get(r) |
|
89 | wctx.sub(s).get(r) | |
84 | sm[s] = r |
|
90 | sm[s] = r | |
85 | elif l[1] == a[1]: # local side is unchanged |
|
91 | elif l[1] == a[1]: # local side is unchanged | |
86 | debug(s, "other side changed, get", r) |
|
92 | debug(s, "other side changed, get", r) | |
87 | wctx.sub(s).get(r) |
|
93 | wctx.sub(s).get(r) | |
88 | sm[s] = r |
|
94 | sm[s] = r | |
89 | else: |
|
95 | else: | |
90 | debug(s, "both sides changed, merge with", r) |
|
96 | debug(s, "both sides changed, merge with", r) | |
91 | wctx.sub(s).merge(r) |
|
97 | wctx.sub(s).merge(r) | |
92 | sm[s] = l |
|
98 | sm[s] = l | |
93 | elif l == a: # remote removed, local unchanged |
|
99 | elif l == a: # remote removed, local unchanged | |
94 | debug(s, "remote removed, remove") |
|
100 | debug(s, "remote removed, remove") | |
95 | wctx.sub(s).remove() |
|
101 | wctx.sub(s).remove() | |
96 | else: |
|
102 | else: | |
97 | if repo.ui.promptchoice( |
|
103 | if repo.ui.promptchoice( | |
98 | _(' local changed subrepository %s which remote removed\n' |
|
104 | _(' local changed subrepository %s which remote removed\n' | |
99 | 'use (c)hanged version or (d)elete?') % s, |
|
105 | 'use (c)hanged version or (d)elete?') % s, | |
100 | (_('&Changed'), _('&Delete')), 0): |
|
106 | (_('&Changed'), _('&Delete')), 0): | |
101 | debug(s, "prompt remove") |
|
107 | debug(s, "prompt remove") | |
102 | wctx.sub(s).remove() |
|
108 | wctx.sub(s).remove() | |
103 |
|
109 | |||
104 | for s, r in s2.items(): |
|
110 | for s, r in s2.items(): | |
105 | if s in s1: |
|
111 | if s in s1: | |
106 | continue |
|
112 | continue | |
107 | elif s not in sa: |
|
113 | elif s not in sa: | |
108 | debug(s, "remote added, get", r) |
|
114 | debug(s, "remote added, get", r) | |
109 | mctx.sub(s).get(r) |
|
115 | mctx.sub(s).get(r) | |
110 | sm[s] = r |
|
116 | sm[s] = r | |
111 | elif r != sa[s]: |
|
117 | elif r != sa[s]: | |
112 | if repo.ui.promptchoice( |
|
118 | if repo.ui.promptchoice( | |
113 | _(' remote changed subrepository %s which local removed\n' |
|
119 | _(' remote changed subrepository %s which local removed\n' | |
114 | 'use (c)hanged version or (d)elete?') % s, |
|
120 | 'use (c)hanged version or (d)elete?') % s, | |
115 | (_('&Changed'), _('&Delete')), 0) == 0: |
|
121 | (_('&Changed'), _('&Delete')), 0) == 0: | |
116 | debug(s, "prompt recreate", r) |
|
122 | debug(s, "prompt recreate", r) | |
117 | wctx.sub(s).get(r) |
|
123 | wctx.sub(s).get(r) | |
118 | sm[s] = r |
|
124 | sm[s] = r | |
119 |
|
125 | |||
120 | # record merged .hgsubstate |
|
126 | # record merged .hgsubstate | |
121 | writestate(repo, sm) |
|
127 | writestate(repo, sm) | |
122 |
|
128 | |||
123 | def _abssource(repo, push=False): |
|
129 | def _abssource(repo, push=False): | |
124 | if hasattr(repo, '_subparent'): |
|
130 | if hasattr(repo, '_subparent'): | |
125 | source = repo._subsource |
|
131 | source = repo._subsource | |
126 | if source.startswith('/') or '://' in source: |
|
132 | if source.startswith('/') or '://' in source: | |
127 | return source |
|
133 | return source | |
128 | parent = _abssource(repo._subparent) |
|
134 | parent = _abssource(repo._subparent) | |
129 | if '://' in parent: |
|
135 | if '://' in parent: | |
130 | if parent[-1] == '/': |
|
136 | if parent[-1] == '/': | |
131 | parent = parent[:-1] |
|
137 | parent = parent[:-1] | |
132 | return parent + '/' + source |
|
138 | return parent + '/' + source | |
133 | return os.path.join(parent, repo._subsource) |
|
139 | return os.path.join(parent, repo._subsource) | |
134 | if push and repo.ui.config('paths', 'default-push'): |
|
140 | if push and repo.ui.config('paths', 'default-push'): | |
135 | return repo.ui.config('paths', 'default-push', repo.root) |
|
141 | return repo.ui.config('paths', 'default-push', repo.root) | |
136 | return repo.ui.config('paths', 'default', repo.root) |
|
142 | return repo.ui.config('paths', 'default', repo.root) | |
137 |
|
143 | |||
138 | def subrepo(ctx, path): |
|
144 | def subrepo(ctx, path): | |
139 | # subrepo inherently violates our import layering rules |
|
145 | # subrepo inherently violates our import layering rules | |
140 | # because it wants to make repo objects from deep inside the stack |
|
146 | # because it wants to make repo objects from deep inside the stack | |
141 | # so we manually delay the circular imports to not break |
|
147 | # so we manually delay the circular imports to not break | |
142 | # scripts that don't use our demand-loading |
|
148 | # scripts that don't use our demand-loading | |
143 | global hg |
|
149 | global hg | |
144 | import hg as h |
|
150 | import hg as h | |
145 | hg = h |
|
151 | hg = h | |
146 |
|
152 | |||
147 | util.path_auditor(ctx._repo.root)(path) |
|
153 | util.path_auditor(ctx._repo.root)(path) | |
148 | state = ctx.substate.get(path, nullstate) |
|
154 | state = ctx.substate.get(path, nullstate) | |
149 | if state[0].startswith('['): # future expansion |
|
155 | if state[2] not in types: | |
150 |
raise |
|
156 | raise util.Abort(_('unknown subrepo type %s') % t) | |
151 |
return |
|
157 | return types[state[2]](ctx, path, state[:2]) | |
152 |
|
158 | |||
153 | # subrepo classes need to implement the following methods: |
|
159 | # subrepo classes need to implement the following methods: | |
154 | # __init__(self, ctx, path, state) |
|
160 | # __init__(self, ctx, path, state) | |
155 | # dirty(self): returns true if the dirstate of the subrepo |
|
161 | # dirty(self): returns true if the dirstate of the subrepo | |
156 | # does not match current stored state |
|
162 | # does not match current stored state | |
157 | # commit(self, text, user, date): commit the current changes |
|
163 | # commit(self, text, user, date): commit the current changes | |
158 | # to the subrepo with the given log message. Use given |
|
164 | # to the subrepo with the given log message. Use given | |
159 | # user and date if possible. Return the new state of the subrepo. |
|
165 | # user and date if possible. Return the new state of the subrepo. | |
160 | # remove(self): remove the subrepo (should verify the dirstate |
|
166 | # remove(self): remove the subrepo (should verify the dirstate | |
161 | # is not dirty first) |
|
167 | # is not dirty first) | |
162 | # get(self, state): run whatever commands are needed to put the |
|
168 | # get(self, state): run whatever commands are needed to put the | |
163 | # subrepo into this state |
|
169 | # subrepo into this state | |
164 | # merge(self, state): merge currently-saved state with the new state. |
|
170 | # merge(self, state): merge currently-saved state with the new state. | |
165 | # push(self, force): perform whatever action is analagous to 'hg push' |
|
171 | # push(self, force): perform whatever action is analagous to 'hg push' | |
166 | # This may be a no-op on some systems. |
|
172 | # This may be a no-op on some systems. | |
167 |
|
173 | |||
168 | class hgsubrepo(object): |
|
174 | class hgsubrepo(object): | |
169 | def __init__(self, ctx, path, state): |
|
175 | def __init__(self, ctx, path, state): | |
170 | self._path = path |
|
176 | self._path = path | |
171 | self._state = state |
|
177 | self._state = state | |
172 | r = ctx._repo |
|
178 | r = ctx._repo | |
173 | root = r.wjoin(path) |
|
179 | root = r.wjoin(path) | |
174 | if os.path.exists(os.path.join(root, '.hg')): |
|
180 | if os.path.exists(os.path.join(root, '.hg')): | |
175 | self._repo = hg.repository(r.ui, root) |
|
181 | self._repo = hg.repository(r.ui, root) | |
176 | else: |
|
182 | else: | |
177 | util.makedirs(root) |
|
183 | util.makedirs(root) | |
178 | self._repo = hg.repository(r.ui, root, create=True) |
|
184 | self._repo = hg.repository(r.ui, root, create=True) | |
179 | f = file(os.path.join(root, '.hg', 'hgrc'), 'w') |
|
185 | f = file(os.path.join(root, '.hg', 'hgrc'), 'w') | |
180 | f.write('[paths]\ndefault = %s\n' % state[0]) |
|
186 | f.write('[paths]\ndefault = %s\n' % state[0]) | |
181 | f.close() |
|
187 | f.close() | |
182 | self._repo._subparent = r |
|
188 | self._repo._subparent = r | |
183 | self._repo._subsource = state[0] |
|
189 | self._repo._subsource = state[0] | |
184 |
|
190 | |||
185 | def dirty(self): |
|
191 | def dirty(self): | |
186 | r = self._state[1] |
|
192 | r = self._state[1] | |
187 | if r == '': |
|
193 | if r == '': | |
188 | return True |
|
194 | return True | |
189 | w = self._repo[None] |
|
195 | w = self._repo[None] | |
190 | if w.p1() != self._repo[r]: # version checked out changed |
|
196 | if w.p1() != self._repo[r]: # version checked out changed | |
191 | return True |
|
197 | return True | |
192 | return w.dirty() # working directory changed |
|
198 | return w.dirty() # working directory changed | |
193 |
|
199 | |||
194 | def commit(self, text, user, date): |
|
200 | def commit(self, text, user, date): | |
195 | self._repo.ui.debug("committing subrepo %s\n" % self._path) |
|
201 | self._repo.ui.debug("committing subrepo %s\n" % self._path) | |
196 | n = self._repo.commit(text, user, date) |
|
202 | n = self._repo.commit(text, user, date) | |
197 | if not n: |
|
203 | if not n: | |
198 | return self._repo['.'].hex() # different version checked out |
|
204 | return self._repo['.'].hex() # different version checked out | |
199 | return node.hex(n) |
|
205 | return node.hex(n) | |
200 |
|
206 | |||
201 | def remove(self): |
|
207 | def remove(self): | |
202 | # we can't fully delete the repository as it may contain |
|
208 | # we can't fully delete the repository as it may contain | |
203 | # local-only history |
|
209 | # local-only history | |
204 | self._repo.ui.note(_('removing subrepo %s\n') % self._path) |
|
210 | self._repo.ui.note(_('removing subrepo %s\n') % self._path) | |
205 | hg.clean(self._repo, node.nullid, False) |
|
211 | hg.clean(self._repo, node.nullid, False) | |
206 |
|
212 | |||
207 | def _get(self, state): |
|
213 | def _get(self, state): | |
208 | source, revision = state |
|
214 | source, revision, kind = state | |
209 | try: |
|
215 | try: | |
210 | self._repo.lookup(revision) |
|
216 | self._repo.lookup(revision) | |
211 | except error.RepoError: |
|
217 | except error.RepoError: | |
212 | self._repo._subsource = source |
|
218 | self._repo._subsource = source | |
213 | self._repo.ui.status(_('pulling subrepo %s\n') % self._path) |
|
219 | self._repo.ui.status(_('pulling subrepo %s\n') % self._path) | |
214 | srcurl = _abssource(self._repo) |
|
220 | srcurl = _abssource(self._repo) | |
215 | other = hg.repository(self._repo.ui, srcurl) |
|
221 | other = hg.repository(self._repo.ui, srcurl) | |
216 | self._repo.pull(other) |
|
222 | self._repo.pull(other) | |
217 |
|
223 | |||
218 | def get(self, state): |
|
224 | def get(self, state): | |
219 | self._get(state) |
|
225 | self._get(state) | |
220 | source, revision = state |
|
226 | source, revision, kind = state | |
221 | self._repo.ui.debug("getting subrepo %s\n" % self._path) |
|
227 | self._repo.ui.debug("getting subrepo %s\n" % self._path) | |
222 | hg.clean(self._repo, revision, False) |
|
228 | hg.clean(self._repo, revision, False) | |
223 |
|
229 | |||
224 | def merge(self, state): |
|
230 | def merge(self, state): | |
225 | self._get(state) |
|
231 | self._get(state) | |
226 | cur = self._repo['.'] |
|
232 | cur = self._repo['.'] | |
227 | dst = self._repo[state[1]] |
|
233 | dst = self._repo[state[1]] | |
228 | if dst.ancestor(cur) == cur: |
|
234 | if dst.ancestor(cur) == cur: | |
229 | self._repo.ui.debug("updating subrepo %s\n" % self._path) |
|
235 | self._repo.ui.debug("updating subrepo %s\n" % self._path) | |
230 | hg.update(self._repo, state[1]) |
|
236 | hg.update(self._repo, state[1]) | |
231 | else: |
|
237 | else: | |
232 | self._repo.ui.debug("merging subrepo %s\n" % self._path) |
|
238 | self._repo.ui.debug("merging subrepo %s\n" % self._path) | |
233 | hg.merge(self._repo, state[1], remind=False) |
|
239 | hg.merge(self._repo, state[1], remind=False) | |
234 |
|
240 | |||
235 | def push(self, force): |
|
241 | def push(self, force): | |
236 | # push subrepos depth-first for coherent ordering |
|
242 | # push subrepos depth-first for coherent ordering | |
237 | c = self._repo[''] |
|
243 | c = self._repo[''] | |
238 | subs = c.substate # only repos that are committed |
|
244 | subs = c.substate # only repos that are committed | |
239 | for s in sorted(subs): |
|
245 | for s in sorted(subs): | |
240 | c.sub(s).push(force) |
|
246 | c.sub(s).push(force) | |
241 |
|
247 | |||
242 | self._repo.ui.status(_('pushing subrepo %s\n') % self._path) |
|
248 | self._repo.ui.status(_('pushing subrepo %s\n') % self._path) | |
243 | dsturl = _abssource(self._repo, True) |
|
249 | dsturl = _abssource(self._repo, True) | |
244 | other = hg.repository(self._repo.ui, dsturl) |
|
250 | other = hg.repository(self._repo.ui, dsturl) | |
245 | self._repo.push(other, force) |
|
251 | self._repo.push(other, force) | |
|
252 | ||||
|
253 | types = { | |||
|
254 | 'hg': hgsubrepo, | |||
|
255 | } |
@@ -1,106 +1,112 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | rm -rf sub |
|
3 | rm -rf sub | |
4 | mkdir sub |
|
4 | mkdir sub | |
5 | cd sub |
|
5 | cd sub | |
6 | hg init t |
|
6 | hg init t | |
7 | cd t |
|
7 | cd t | |
8 |
|
8 | |||
9 | echo % first revision, no sub |
|
9 | echo % first revision, no sub | |
10 | echo a > a |
|
10 | echo a > a | |
11 | hg ci -Am0 |
|
11 | hg ci -Am0 | |
12 |
|
12 | |||
13 | echo % add first sub |
|
13 | echo % add first sub | |
14 | echo s = s > .hgsub |
|
14 | echo s = s > .hgsub | |
15 | hg add .hgsub |
|
15 | hg add .hgsub | |
16 | hg init s |
|
16 | hg init s | |
17 | echo a > s/a |
|
17 | echo a > s/a | |
18 | hg -R s ci -Ams0 |
|
18 | hg -R s ci -Ams0 | |
19 | hg ci -m1 |
|
19 | hg ci -m1 | |
20 |
|
20 | |||
21 | echo % add sub sub |
|
21 | echo % add sub sub | |
22 | echo ss = ss > s/.hgsub |
|
22 | echo ss = ss > s/.hgsub | |
23 | hg init s/ss |
|
23 | hg init s/ss | |
24 | echo a > s/ss/a |
|
24 | echo a > s/ss/a | |
25 | hg -R s add s/.hgsub |
|
25 | hg -R s add s/.hgsub | |
26 | hg -R s/ss add s/ss/a |
|
26 | hg -R s/ss add s/ss/a | |
27 | hg ci -m2 |
|
27 | hg ci -m2 | |
28 |
|
28 | |||
29 | echo % bump sub rev |
|
29 | echo % bump sub rev | |
30 | echo b > s/a |
|
30 | echo b > s/a | |
31 | hg -R s ci -ms1 |
|
31 | hg -R s ci -ms1 | |
32 | hg ci -m3 |
|
32 | hg ci -m3 | |
33 |
|
33 | |||
34 | echo % leave sub dirty |
|
34 | echo % leave sub dirty | |
35 | echo c > s/a |
|
35 | echo c > s/a | |
36 | hg ci -m4 |
|
36 | hg ci -m4 | |
37 | hg tip -R s |
|
37 | hg tip -R s | |
38 |
|
38 | |||
39 | echo % check caching |
|
39 | echo % check caching | |
40 | hg co 0 |
|
40 | hg co 0 | |
41 | hg debugsub |
|
41 | hg debugsub | |
42 | echo % restore |
|
42 | echo % restore | |
43 | hg co |
|
43 | hg co | |
44 | hg debugsub |
|
44 | hg debugsub | |
45 |
|
45 | |||
46 | echo % new branch for merge tests |
|
46 | echo % new branch for merge tests | |
47 | hg co 1 |
|
47 | hg co 1 | |
48 | echo t = t >> .hgsub |
|
48 | echo t = t >> .hgsub | |
49 | hg init t |
|
49 | hg init t | |
50 | echo t > t/t |
|
50 | echo t > t/t | |
51 | hg -R t add t |
|
51 | hg -R t add t | |
52 | echo % 5 |
|
52 | echo % 5 | |
53 | hg ci -m5 # add sub |
|
53 | hg ci -m5 # add sub | |
54 | echo t2 > t/t |
|
54 | echo t2 > t/t | |
55 | echo % 6 |
|
55 | echo % 6 | |
56 | hg st -R s |
|
56 | hg st -R s | |
57 | hg ci -m6 # change sub |
|
57 | hg ci -m6 # change sub | |
58 | hg debugsub |
|
58 | hg debugsub | |
59 | echo t3 > t/t |
|
59 | echo t3 > t/t | |
60 | echo % 7 |
|
60 | echo % 7 | |
61 | hg ci -m7 # change sub again for conflict test |
|
61 | hg ci -m7 # change sub again for conflict test | |
62 | hg rm .hgsub |
|
62 | hg rm .hgsub | |
63 | echo % 8 |
|
63 | echo % 8 | |
64 | hg ci -m8 # remove sub |
|
64 | hg ci -m8 # remove sub | |
65 |
|
65 | |||
66 | echo % merge tests |
|
66 | echo % merge tests | |
67 | hg co -C 3 |
|
67 | hg co -C 3 | |
68 | hg merge 5 # test adding |
|
68 | hg merge 5 # test adding | |
69 | hg debugsub |
|
69 | hg debugsub | |
70 | hg ci -m9 |
|
70 | hg ci -m9 | |
71 | hg merge 6 --debug # test change |
|
71 | hg merge 6 --debug # test change | |
72 | hg debugsub |
|
72 | hg debugsub | |
73 | echo conflict > t/t |
|
73 | echo conflict > t/t | |
74 | hg ci -m10 |
|
74 | hg ci -m10 | |
75 | HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
75 | HGMERGE=internal:merge hg merge --debug 7 # test conflict | |
76 | echo % should conflict |
|
76 | echo % should conflict | |
77 | cat t/t |
|
77 | cat t/t | |
78 |
|
78 | |||
79 | echo % clone |
|
79 | echo % clone | |
80 | cd .. |
|
80 | cd .. | |
81 | hg clone t tc |
|
81 | hg clone t tc | |
82 | cd tc |
|
82 | cd tc | |
83 | hg debugsub |
|
83 | hg debugsub | |
84 |
|
84 | |||
85 | echo % push |
|
85 | echo % push | |
86 | echo bah > t/t |
|
86 | echo bah > t/t | |
87 | hg ci -m11 |
|
87 | hg ci -m11 | |
88 | hg push | sed 's/ .*sub/ ...sub/g' |
|
88 | hg push | sed 's/ .*sub/ ...sub/g' | |
89 |
|
89 | |||
90 | echo % push -f |
|
90 | echo % push -f | |
91 | echo bah > s/a |
|
91 | echo bah > s/a | |
92 | hg ci -m12 |
|
92 | hg ci -m12 | |
93 | hg push | sed 's/ .*sub/ ...sub/g' |
|
93 | hg push | sed 's/ .*sub/ ...sub/g' | |
94 | hg push -f | sed 's/ .*sub/ ...sub/g' |
|
94 | hg push -f | sed 's/ .*sub/ ...sub/g' | |
95 |
|
95 | |||
96 | echo % update |
|
96 | echo % update | |
97 | cd ../t |
|
97 | cd ../t | |
98 | hg up -C # discard our earlier merge |
|
98 | hg up -C # discard our earlier merge | |
99 | echo blah > t/t |
|
99 | echo blah > t/t | |
100 | hg ci -m13 |
|
100 | hg ci -m13 | |
101 |
|
101 | |||
102 | echo % pull |
|
102 | echo % pull | |
103 | cd ../tc |
|
103 | cd ../tc | |
104 | hg pull | sed 's/ .*sub/ ...sub/g' |
|
104 | hg pull | sed 's/ .*sub/ ...sub/g' | |
105 | hg up # should pull t |
|
105 | hg up # should pull t | |
106 | cat t/t |
|
106 | cat t/t | |
|
107 | ||||
|
108 | echo % bogus subrepo path aborts | |||
|
109 | echo 'bogus=[boguspath' >> .hgsub | |||
|
110 | hg ci -m 'bogus subrepo path' | |||
|
111 | ||||
|
112 | exit 0 |
@@ -1,203 +1,205 b'' | |||||
1 | % first revision, no sub |
|
1 | % first revision, no sub | |
2 | adding a |
|
2 | adding a | |
3 | % add first sub |
|
3 | % add first sub | |
4 | adding a |
|
4 | adding a | |
5 | committing subrepository s |
|
5 | committing subrepository s | |
6 | % add sub sub |
|
6 | % add sub sub | |
7 | committing subrepository s |
|
7 | committing subrepository s | |
8 | committing subrepository ss |
|
8 | committing subrepository ss | |
9 | % bump sub rev |
|
9 | % bump sub rev | |
10 | committing subrepository s |
|
10 | committing subrepository s | |
11 | % leave sub dirty |
|
11 | % leave sub dirty | |
12 | committing subrepository s |
|
12 | committing subrepository s | |
13 | changeset: 3:1c833a7a9e3a |
|
13 | changeset: 3:1c833a7a9e3a | |
14 | tag: tip |
|
14 | tag: tip | |
15 | user: test |
|
15 | user: test | |
16 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
16 | date: Thu Jan 01 00:00:00 1970 +0000 | |
17 | summary: 4 |
|
17 | summary: 4 | |
18 |
|
18 | |||
19 | % check caching |
|
19 | % check caching | |
20 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
20 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
21 | % restore |
|
21 | % restore | |
22 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
22 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
23 | path s |
|
23 | path s | |
24 | source s |
|
24 | source s | |
25 | revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e |
|
25 | revision 1c833a7a9e3a4445c711aaf0f012379cd0d4034e | |
26 | % new branch for merge tests |
|
26 | % new branch for merge tests | |
27 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
27 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
28 | adding t/t |
|
28 | adding t/t | |
29 | % 5 |
|
29 | % 5 | |
30 | committing subrepository t |
|
30 | committing subrepository t | |
31 | created new head |
|
31 | created new head | |
32 | % 6 |
|
32 | % 6 | |
33 | committing subrepository t |
|
33 | committing subrepository t | |
34 | path s |
|
34 | path s | |
35 | source s |
|
35 | source s | |
36 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
36 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 | |
37 | path t |
|
37 | path t | |
38 | source t |
|
38 | source t | |
39 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
39 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad | |
40 | % 7 |
|
40 | % 7 | |
41 | committing subrepository t |
|
41 | committing subrepository t | |
42 | % 8 |
|
42 | % 8 | |
43 | % merge tests |
|
43 | % merge tests | |
44 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
44 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
45 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
45 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
46 | (branch merge, don't forget to commit) |
|
46 | (branch merge, don't forget to commit) | |
47 | path s |
|
47 | path s | |
48 | source s |
|
48 | source s | |
49 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
49 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 | |
50 | path t |
|
50 | path t | |
51 | source t |
|
51 | source t | |
52 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 |
|
52 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 | |
53 | created new head |
|
53 | created new head | |
54 | searching for copies back to rev 2 |
|
54 | searching for copies back to rev 2 | |
55 | resolving manifests |
|
55 | resolving manifests | |
56 | overwrite None partial False |
|
56 | overwrite None partial False | |
57 | ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4 |
|
57 | ancestor 1f14a2e2d3ec local f0d2028bf86d+ remote 1831e14459c4 | |
58 | .hgsubstate: versions differ -> m |
|
58 | .hgsubstate: versions differ -> m | |
59 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec |
|
59 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec | |
60 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
60 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg | |
61 | getting subrepo t |
|
61 | getting subrepo t | |
62 | resolving manifests |
|
62 | resolving manifests | |
63 | overwrite True partial False |
|
63 | overwrite True partial False | |
64 | ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a |
|
64 | ancestor 60ca1237c194+ local 60ca1237c194+ remote 6747d179aa9a | |
65 | t: remote is newer -> g |
|
65 | t: remote is newer -> g | |
66 | getting t |
|
66 | getting t | |
67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
68 | (branch merge, don't forget to commit) |
|
68 | (branch merge, don't forget to commit) | |
69 | path s |
|
69 | path s | |
70 | source s |
|
70 | source s | |
71 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
71 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 | |
72 | path t |
|
72 | path t | |
73 | source t |
|
73 | source t | |
74 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
74 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad | |
75 | committing subrepository t |
|
75 | committing subrepository t | |
76 | searching for copies back to rev 2 |
|
76 | searching for copies back to rev 2 | |
77 | resolving manifests |
|
77 | resolving manifests | |
78 | overwrite None partial False |
|
78 | overwrite None partial False | |
79 | ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf |
|
79 | ancestor 1831e14459c4 local e45c8b14af55+ remote f94576341bcf | |
80 | .hgsubstate: versions differ -> m |
|
80 | .hgsubstate: versions differ -> m | |
81 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 |
|
81 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 | |
82 | subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 |
|
82 | subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg | |
83 | merging subrepo t |
|
83 | merging subrepo t | |
84 | searching for copies back to rev 2 |
|
84 | searching for copies back to rev 2 | |
85 | resolving manifests |
|
85 | resolving manifests | |
86 | overwrite None partial False |
|
86 | overwrite None partial False | |
87 | ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198 |
|
87 | ancestor 6747d179aa9a local 20a0db6fbf6c+ remote 7af322bc1198 | |
88 | t: versions differ -> m |
|
88 | t: versions differ -> m | |
89 | preserving t for resolve of t |
|
89 | preserving t for resolve of t | |
90 | picked tool 'internal:merge' for t (binary False symlink False) |
|
90 | picked tool 'internal:merge' for t (binary False symlink False) | |
91 | merging t |
|
91 | merging t | |
92 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
92 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a | |
93 | warning: conflicts during merge. |
|
93 | warning: conflicts during merge. | |
94 | merging t failed! |
|
94 | merging t failed! | |
95 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
95 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
96 | use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon |
|
96 | use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon | |
97 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
97 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
98 | (branch merge, don't forget to commit) |
|
98 | (branch merge, don't forget to commit) | |
99 | % should conflict |
|
99 | % should conflict | |
100 | <<<<<<< local |
|
100 | <<<<<<< local | |
101 | conflict |
|
101 | conflict | |
102 | ======= |
|
102 | ======= | |
103 | t3 |
|
103 | t3 | |
104 | >>>>>>> other |
|
104 | >>>>>>> other | |
105 | % clone |
|
105 | % clone | |
106 | updating to branch default |
|
106 | updating to branch default | |
107 | pulling subrepo s |
|
107 | pulling subrepo s | |
108 | requesting all changes |
|
108 | requesting all changes | |
109 | adding changesets |
|
109 | adding changesets | |
110 | adding manifests |
|
110 | adding manifests | |
111 | adding file changes |
|
111 | adding file changes | |
112 | added 4 changesets with 5 changes to 3 files |
|
112 | added 4 changesets with 5 changes to 3 files | |
113 | pulling subrepo ss |
|
113 | pulling subrepo ss | |
114 | requesting all changes |
|
114 | requesting all changes | |
115 | adding changesets |
|
115 | adding changesets | |
116 | adding manifests |
|
116 | adding manifests | |
117 | adding file changes |
|
117 | adding file changes | |
118 | added 1 changesets with 1 changes to 1 files |
|
118 | added 1 changesets with 1 changes to 1 files | |
119 | pulling subrepo t |
|
119 | pulling subrepo t | |
120 | requesting all changes |
|
120 | requesting all changes | |
121 | adding changesets |
|
121 | adding changesets | |
122 | adding manifests |
|
122 | adding manifests | |
123 | adding file changes |
|
123 | adding file changes | |
124 | added 4 changesets with 4 changes to 1 files (+1 heads) |
|
124 | added 4 changesets with 4 changes to 1 files (+1 heads) | |
125 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
125 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
126 | path s |
|
126 | path s | |
127 | source s |
|
127 | source s | |
128 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
128 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 | |
129 | path t |
|
129 | path t | |
130 | source t |
|
130 | source t | |
131 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e |
|
131 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e | |
132 | % push |
|
132 | % push | |
133 | committing subrepository t |
|
133 | committing subrepository t | |
134 | pushing ...sub/t |
|
134 | pushing ...sub/t | |
135 | pushing ...subrepo ss |
|
135 | pushing ...subrepo ss | |
136 | searching for changes |
|
136 | searching for changes | |
137 | no changes found |
|
137 | no changes found | |
138 | pushing ...subrepo s |
|
138 | pushing ...subrepo s | |
139 | searching for changes |
|
139 | searching for changes | |
140 | no changes found |
|
140 | no changes found | |
141 | pushing ...subrepo t |
|
141 | pushing ...subrepo t | |
142 | searching for changes |
|
142 | searching for changes | |
143 | adding changesets |
|
143 | adding changesets | |
144 | adding manifests |
|
144 | adding manifests | |
145 | adding file changes |
|
145 | adding file changes | |
146 | added 1 changesets with 1 changes to 1 files |
|
146 | added 1 changesets with 1 changes to 1 files | |
147 | searching for changes |
|
147 | searching for changes | |
148 | adding changesets |
|
148 | adding changesets | |
149 | adding manifests |
|
149 | adding manifests | |
150 | adding file changes |
|
150 | adding file changes | |
151 | added 1 changesets with 1 changes to 1 files |
|
151 | added 1 changesets with 1 changes to 1 files | |
152 | % push -f |
|
152 | % push -f | |
153 | committing subrepository s |
|
153 | committing subrepository s | |
154 | abort: push creates new remote heads! |
|
154 | abort: push creates new remote heads! | |
155 | pushing ...sub/t |
|
155 | pushing ...sub/t | |
156 | pushing ...subrepo ss |
|
156 | pushing ...subrepo ss | |
157 | searching for changes |
|
157 | searching for changes | |
158 | no changes found |
|
158 | no changes found | |
159 | pushing ...subrepo s |
|
159 | pushing ...subrepo s | |
160 | searching for changes |
|
160 | searching for changes | |
161 | (did you forget to merge? use push -f to force) |
|
161 | (did you forget to merge? use push -f to force) | |
162 | pushing ...subrepo t |
|
162 | pushing ...subrepo t | |
163 | searching for changes |
|
163 | searching for changes | |
164 | no changes found |
|
164 | no changes found | |
165 | searching for changes |
|
165 | searching for changes | |
166 | adding changesets |
|
166 | adding changesets | |
167 | adding manifests |
|
167 | adding manifests | |
168 | adding file changes |
|
168 | adding file changes | |
169 | added 1 changesets with 1 changes to 1 files |
|
169 | added 1 changesets with 1 changes to 1 files | |
170 | pushing ...sub/t |
|
170 | pushing ...sub/t | |
171 | pushing ...subrepo ss |
|
171 | pushing ...subrepo ss | |
172 | searching for changes |
|
172 | searching for changes | |
173 | no changes found |
|
173 | no changes found | |
174 | pushing ...subrepo s |
|
174 | pushing ...subrepo s | |
175 | searching for changes |
|
175 | searching for changes | |
176 | adding changesets |
|
176 | adding changesets | |
177 | adding manifests |
|
177 | adding manifests | |
178 | adding file changes |
|
178 | adding file changes | |
179 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
179 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
180 | pushing ...subrepo t |
|
180 | pushing ...subrepo t | |
181 | searching for changes |
|
181 | searching for changes | |
182 | no changes found |
|
182 | no changes found | |
183 | searching for changes |
|
183 | searching for changes | |
184 | no changes found |
|
184 | no changes found | |
185 | % update |
|
185 | % update | |
186 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
186 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
187 | committing subrepository t |
|
187 | committing subrepository t | |
188 | % pull |
|
188 | % pull | |
189 | pulling ...sub/t |
|
189 | pulling ...sub/t | |
190 | searching for changes |
|
190 | searching for changes | |
191 | adding changesets |
|
191 | adding changesets | |
192 | adding manifests |
|
192 | adding manifests | |
193 | adding file changes |
|
193 | adding file changes | |
194 | added 1 changesets with 1 changes to 1 files |
|
194 | added 1 changesets with 1 changes to 1 files | |
195 | (run 'hg update' to get a working copy) |
|
195 | (run 'hg update' to get a working copy) | |
196 | pulling subrepo t |
|
196 | pulling subrepo t | |
197 | searching for changes |
|
197 | searching for changes | |
198 | adding changesets |
|
198 | adding changesets | |
199 | adding manifests |
|
199 | adding manifests | |
200 | adding file changes |
|
200 | adding file changes | |
201 | added 1 changesets with 1 changes to 1 files |
|
201 | added 1 changesets with 1 changes to 1 files | |
202 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
202 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
203 | blah |
|
203 | blah | |
|
204 | % bogus subrepo path aborts | |||
|
205 | abort: missing ] in subrepo source |
General Comments 0
You need to be logged in to leave comments.
Login now