Show More
@@ -1,635 +1,632 | |||||
1 | # hg.py - repository classes for mercurial |
|
1 | # hg.py - repository classes for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
4 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 |
|
8 | |||
9 | from i18n import _ |
|
9 | from i18n import _ | |
10 | from lock import release |
|
10 | from lock import release | |
11 | from node import hex, nullid |
|
11 | from node import hex, nullid | |
12 | import localrepo, bundlerepo, httppeer, sshpeer, statichttprepo, bookmarks |
|
12 | import localrepo, bundlerepo, httppeer, sshpeer, statichttprepo, bookmarks | |
13 | import lock, util, extensions, error, node, scmutil, phases, url |
|
13 | import lock, util, extensions, error, node, scmutil, phases, url | |
14 | import cmdutil, discovery |
|
14 | import cmdutil, discovery | |
15 | import merge as mergemod |
|
15 | import merge as mergemod | |
16 | import verify as verifymod |
|
16 | import verify as verifymod | |
17 | import errno, os, shutil |
|
17 | import errno, os, shutil | |
18 |
|
18 | |||
19 | def _local(path): |
|
19 | def _local(path): | |
20 | path = util.expandpath(util.urllocalpath(path)) |
|
20 | path = util.expandpath(util.urllocalpath(path)) | |
21 | return (os.path.isfile(path) and bundlerepo or localrepo) |
|
21 | return (os.path.isfile(path) and bundlerepo or localrepo) | |
22 |
|
22 | |||
23 | def addbranchrevs(lrepo, other, branches, revs): |
|
23 | def addbranchrevs(lrepo, other, branches, revs): | |
24 | peer = other.peer() # a courtesy to callers using a localrepo for other |
|
24 | peer = other.peer() # a courtesy to callers using a localrepo for other | |
25 | hashbranch, branches = branches |
|
25 | hashbranch, branches = branches | |
26 | if not hashbranch and not branches: |
|
26 | if not hashbranch and not branches: | |
27 | return revs or None, revs and revs[0] or None |
|
27 | return revs or None, revs and revs[0] or None | |
28 | revs = revs and list(revs) or [] |
|
28 | revs = revs and list(revs) or [] | |
29 | if not peer.capable('branchmap'): |
|
29 | if not peer.capable('branchmap'): | |
30 | if branches: |
|
30 | if branches: | |
31 | raise util.Abort(_("remote branch lookup not supported")) |
|
31 | raise util.Abort(_("remote branch lookup not supported")) | |
32 | revs.append(hashbranch) |
|
32 | revs.append(hashbranch) | |
33 | return revs, revs[0] |
|
33 | return revs, revs[0] | |
34 | branchmap = peer.branchmap() |
|
34 | branchmap = peer.branchmap() | |
35 |
|
35 | |||
36 | def primary(branch): |
|
36 | def primary(branch): | |
37 | if branch == '.': |
|
37 | if branch == '.': | |
38 | if not lrepo: |
|
38 | if not lrepo: | |
39 | raise util.Abort(_("dirstate branch not accessible")) |
|
39 | raise util.Abort(_("dirstate branch not accessible")) | |
40 | branch = lrepo.dirstate.branch() |
|
40 | branch = lrepo.dirstate.branch() | |
41 | if branch in branchmap: |
|
41 | if branch in branchmap: | |
42 | revs.extend(node.hex(r) for r in reversed(branchmap[branch])) |
|
42 | revs.extend(node.hex(r) for r in reversed(branchmap[branch])) | |
43 | return True |
|
43 | return True | |
44 | else: |
|
44 | else: | |
45 | return False |
|
45 | return False | |
46 |
|
46 | |||
47 | for branch in branches: |
|
47 | for branch in branches: | |
48 | if not primary(branch): |
|
48 | if not primary(branch): | |
49 | raise error.RepoLookupError(_("unknown branch '%s'") % branch) |
|
49 | raise error.RepoLookupError(_("unknown branch '%s'") % branch) | |
50 | if hashbranch: |
|
50 | if hashbranch: | |
51 | if not primary(hashbranch): |
|
51 | if not primary(hashbranch): | |
52 | revs.append(hashbranch) |
|
52 | revs.append(hashbranch) | |
53 | return revs, revs[0] |
|
53 | return revs, revs[0] | |
54 |
|
54 | |||
55 | def parseurl(path, branches=None): |
|
55 | def parseurl(path, branches=None): | |
56 | '''parse url#branch, returning (url, (branch, branches))''' |
|
56 | '''parse url#branch, returning (url, (branch, branches))''' | |
57 |
|
57 | |||
58 | u = util.url(path) |
|
58 | u = util.url(path) | |
59 | branch = None |
|
59 | branch = None | |
60 | if u.fragment: |
|
60 | if u.fragment: | |
61 | branch = u.fragment |
|
61 | branch = u.fragment | |
62 | u.fragment = None |
|
62 | u.fragment = None | |
63 | return str(u), (branch, branches or []) |
|
63 | return str(u), (branch, branches or []) | |
64 |
|
64 | |||
65 | schemes = { |
|
65 | schemes = { | |
66 | 'bundle': bundlerepo, |
|
66 | 'bundle': bundlerepo, | |
67 | 'file': _local, |
|
67 | 'file': _local, | |
68 | 'http': httppeer, |
|
68 | 'http': httppeer, | |
69 | 'https': httppeer, |
|
69 | 'https': httppeer, | |
70 | 'ssh': sshpeer, |
|
70 | 'ssh': sshpeer, | |
71 | 'static-http': statichttprepo, |
|
71 | 'static-http': statichttprepo, | |
72 | } |
|
72 | } | |
73 |
|
73 | |||
74 | def _peerlookup(path): |
|
74 | def _peerlookup(path): | |
75 | u = util.url(path) |
|
75 | u = util.url(path) | |
76 | scheme = u.scheme or 'file' |
|
76 | scheme = u.scheme or 'file' | |
77 | thing = schemes.get(scheme) or schemes['file'] |
|
77 | thing = schemes.get(scheme) or schemes['file'] | |
78 | try: |
|
78 | try: | |
79 | return thing(path) |
|
79 | return thing(path) | |
80 | except TypeError: |
|
80 | except TypeError: | |
81 | return thing |
|
81 | return thing | |
82 |
|
82 | |||
83 | def islocal(repo): |
|
83 | def islocal(repo): | |
84 | '''return true if repo or path is local''' |
|
84 | '''return true if repo or path is local''' | |
85 | if isinstance(repo, str): |
|
85 | if isinstance(repo, str): | |
86 | try: |
|
86 | try: | |
87 | return _peerlookup(repo).islocal(repo) |
|
87 | return _peerlookup(repo).islocal(repo) | |
88 | except AttributeError: |
|
88 | except AttributeError: | |
89 | return False |
|
89 | return False | |
90 | return repo.local() |
|
90 | return repo.local() | |
91 |
|
91 | |||
92 | def openpath(ui, path): |
|
92 | def openpath(ui, path): | |
93 | '''open path with open if local, url.open if remote''' |
|
93 | '''open path with open if local, url.open if remote''' | |
94 | if islocal(path): |
|
94 | if islocal(path): | |
95 | return util.posixfile(util.urllocalpath(path), 'rb') |
|
95 | return util.posixfile(util.urllocalpath(path), 'rb') | |
96 | else: |
|
96 | else: | |
97 | return url.open(ui, path) |
|
97 | return url.open(ui, path) | |
98 |
|
98 | |||
99 | def _peerorrepo(ui, path, create=False): |
|
99 | def _peerorrepo(ui, path, create=False): | |
100 | """return a repository object for the specified path""" |
|
100 | """return a repository object for the specified path""" | |
101 | obj = _peerlookup(path).instance(ui, path, create) |
|
101 | obj = _peerlookup(path).instance(ui, path, create) | |
102 | ui = getattr(obj, "ui", ui) |
|
102 | ui = getattr(obj, "ui", ui) | |
103 | for name, module in extensions.extensions(): |
|
103 | for name, module in extensions.extensions(): | |
104 | hook = getattr(module, 'reposetup', None) |
|
104 | hook = getattr(module, 'reposetup', None) | |
105 | if hook: |
|
105 | if hook: | |
106 | hook(ui, obj) |
|
106 | hook(ui, obj) | |
107 | return obj |
|
107 | return obj | |
108 |
|
108 | |||
109 | def repository(ui, path='', create=False): |
|
109 | def repository(ui, path='', create=False): | |
110 | """return a repository object for the specified path""" |
|
110 | """return a repository object for the specified path""" | |
111 | peer = _peerorrepo(ui, path, create) |
|
111 | peer = _peerorrepo(ui, path, create) | |
112 | repo = peer.local() |
|
112 | repo = peer.local() | |
113 | if not repo: |
|
113 | if not repo: | |
114 | raise util.Abort(_("repository '%s' is not local") % |
|
114 | raise util.Abort(_("repository '%s' is not local") % | |
115 | (path or peer.url())) |
|
115 | (path or peer.url())) | |
116 | return repo.filtered('visible') |
|
116 | return repo.filtered('visible') | |
117 |
|
117 | |||
118 | def peer(uiorrepo, opts, path, create=False): |
|
118 | def peer(uiorrepo, opts, path, create=False): | |
119 | '''return a repository peer for the specified path''' |
|
119 | '''return a repository peer for the specified path''' | |
120 | rui = remoteui(uiorrepo, opts) |
|
120 | rui = remoteui(uiorrepo, opts) | |
121 | return _peerorrepo(rui, path, create).peer() |
|
121 | return _peerorrepo(rui, path, create).peer() | |
122 |
|
122 | |||
123 | def defaultdest(source): |
|
123 | def defaultdest(source): | |
124 | '''return default destination of clone if none is given''' |
|
124 | '''return default destination of clone if none is given''' | |
125 | return os.path.basename(os.path.normpath(util.url(source).path)) |
|
125 | return os.path.basename(os.path.normpath(util.url(source).path)) | |
126 |
|
126 | |||
127 | def share(ui, source, dest=None, update=True): |
|
127 | def share(ui, source, dest=None, update=True): | |
128 | '''create a shared repository''' |
|
128 | '''create a shared repository''' | |
129 |
|
129 | |||
130 | if not islocal(source): |
|
130 | if not islocal(source): | |
131 | raise util.Abort(_('can only share local repositories')) |
|
131 | raise util.Abort(_('can only share local repositories')) | |
132 |
|
132 | |||
133 | if not dest: |
|
133 | if not dest: | |
134 | dest = defaultdest(source) |
|
134 | dest = defaultdest(source) | |
135 | else: |
|
135 | else: | |
136 | dest = ui.expandpath(dest) |
|
136 | dest = ui.expandpath(dest) | |
137 |
|
137 | |||
138 | if isinstance(source, str): |
|
138 | if isinstance(source, str): | |
139 | origsource = ui.expandpath(source) |
|
139 | origsource = ui.expandpath(source) | |
140 | source, branches = parseurl(origsource) |
|
140 | source, branches = parseurl(origsource) | |
141 | srcrepo = repository(ui, source) |
|
141 | srcrepo = repository(ui, source) | |
142 | rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None) |
|
142 | rev, checkout = addbranchrevs(srcrepo, srcrepo, branches, None) | |
143 | else: |
|
143 | else: | |
144 | srcrepo = source.local() |
|
144 | srcrepo = source.local() | |
145 | origsource = source = srcrepo.url() |
|
145 | origsource = source = srcrepo.url() | |
146 | checkout = None |
|
146 | checkout = None | |
147 |
|
147 | |||
148 | sharedpath = srcrepo.sharedpath # if our source is already sharing |
|
148 | sharedpath = srcrepo.sharedpath # if our source is already sharing | |
149 |
|
149 | |||
150 | root = os.path.realpath(dest) |
|
150 | root = os.path.realpath(dest) | |
151 | roothg = os.path.join(root, '.hg') |
|
151 | roothg = os.path.join(root, '.hg') | |
152 |
|
152 | |||
153 | if os.path.exists(roothg): |
|
153 | if os.path.exists(roothg): | |
154 | raise util.Abort(_('destination already exists')) |
|
154 | raise util.Abort(_('destination already exists')) | |
155 |
|
155 | |||
156 | if not os.path.isdir(root): |
|
156 | if not os.path.isdir(root): | |
157 | os.mkdir(root) |
|
157 | os.mkdir(root) | |
158 | util.makedir(roothg, notindexed=True) |
|
158 | util.makedir(roothg, notindexed=True) | |
159 |
|
159 | |||
160 | requirements = '' |
|
160 | requirements = '' | |
161 | try: |
|
161 | try: | |
162 | requirements = srcrepo.opener.read('requires') |
|
162 | requirements = srcrepo.opener.read('requires') | |
163 | except IOError, inst: |
|
163 | except IOError, inst: | |
164 | if inst.errno != errno.ENOENT: |
|
164 | if inst.errno != errno.ENOENT: | |
165 | raise |
|
165 | raise | |
166 |
|
166 | |||
167 | requirements += 'shared\n' |
|
167 | requirements += 'shared\n' | |
168 | util.writefile(os.path.join(roothg, 'requires'), requirements) |
|
168 | util.writefile(os.path.join(roothg, 'requires'), requirements) | |
169 | util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath) |
|
169 | util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath) | |
170 |
|
170 | |||
171 | r = repository(ui, root) |
|
171 | r = repository(ui, root) | |
172 |
|
172 | |||
173 | default = srcrepo.ui.config('paths', 'default') |
|
173 | default = srcrepo.ui.config('paths', 'default') | |
174 |
if |
|
174 | if default: | |
175 | # set default to source for being able to clone subrepos |
|
175 | fp = r.opener("hgrc", "w", text=True) | |
176 | default = os.path.abspath(util.urllocalpath(origsource)) |
|
176 | fp.write("[paths]\n") | |
177 | fp = r.opener("hgrc", "w", text=True) |
|
177 | fp.write("default = %s\n" % default) | |
178 | fp.write("[paths]\n") |
|
178 | fp.close() | |
179 | fp.write("default = %s\n" % default) |
|
|||
180 | fp.close() |
|
|||
181 | r.ui.setconfig('paths', 'default', default) |
|
|||
182 |
|
179 | |||
183 | if update: |
|
180 | if update: | |
184 | r.ui.status(_("updating working directory\n")) |
|
181 | r.ui.status(_("updating working directory\n")) | |
185 | if update is not True: |
|
182 | if update is not True: | |
186 | checkout = update |
|
183 | checkout = update | |
187 | for test in (checkout, 'default', 'tip'): |
|
184 | for test in (checkout, 'default', 'tip'): | |
188 | if test is None: |
|
185 | if test is None: | |
189 | continue |
|
186 | continue | |
190 | try: |
|
187 | try: | |
191 | uprev = r.lookup(test) |
|
188 | uprev = r.lookup(test) | |
192 | break |
|
189 | break | |
193 | except error.RepoLookupError: |
|
190 | except error.RepoLookupError: | |
194 | continue |
|
191 | continue | |
195 | _update(r, uprev) |
|
192 | _update(r, uprev) | |
196 |
|
193 | |||
197 | def copystore(ui, srcrepo, destpath): |
|
194 | def copystore(ui, srcrepo, destpath): | |
198 | '''copy files from store of srcrepo in destpath |
|
195 | '''copy files from store of srcrepo in destpath | |
199 |
|
196 | |||
200 | returns destlock |
|
197 | returns destlock | |
201 | ''' |
|
198 | ''' | |
202 | destlock = None |
|
199 | destlock = None | |
203 | try: |
|
200 | try: | |
204 | hardlink = None |
|
201 | hardlink = None | |
205 | num = 0 |
|
202 | num = 0 | |
206 | srcpublishing = srcrepo.ui.configbool('phases', 'publish', True) |
|
203 | srcpublishing = srcrepo.ui.configbool('phases', 'publish', True) | |
207 | for f in srcrepo.store.copylist(): |
|
204 | for f in srcrepo.store.copylist(): | |
208 | if srcpublishing and f.endswith('phaseroots'): |
|
205 | if srcpublishing and f.endswith('phaseroots'): | |
209 | continue |
|
206 | continue | |
210 | src = os.path.join(srcrepo.sharedpath, f) |
|
207 | src = os.path.join(srcrepo.sharedpath, f) | |
211 | dst = os.path.join(destpath, f) |
|
208 | dst = os.path.join(destpath, f) | |
212 | dstbase = os.path.dirname(dst) |
|
209 | dstbase = os.path.dirname(dst) | |
213 | if dstbase and not os.path.exists(dstbase): |
|
210 | if dstbase and not os.path.exists(dstbase): | |
214 | os.mkdir(dstbase) |
|
211 | os.mkdir(dstbase) | |
215 | if os.path.exists(src): |
|
212 | if os.path.exists(src): | |
216 | if dst.endswith('data'): |
|
213 | if dst.endswith('data'): | |
217 | # lock to avoid premature writing to the target |
|
214 | # lock to avoid premature writing to the target | |
218 | destlock = lock.lock(os.path.join(dstbase, "lock")) |
|
215 | destlock = lock.lock(os.path.join(dstbase, "lock")) | |
219 | hardlink, n = util.copyfiles(src, dst, hardlink) |
|
216 | hardlink, n = util.copyfiles(src, dst, hardlink) | |
220 | num += n |
|
217 | num += n | |
221 | if hardlink: |
|
218 | if hardlink: | |
222 | ui.debug("linked %d files\n" % num) |
|
219 | ui.debug("linked %d files\n" % num) | |
223 | else: |
|
220 | else: | |
224 | ui.debug("copied %d files\n" % num) |
|
221 | ui.debug("copied %d files\n" % num) | |
225 | return destlock |
|
222 | return destlock | |
226 | except: # re-raises |
|
223 | except: # re-raises | |
227 | release(destlock) |
|
224 | release(destlock) | |
228 | raise |
|
225 | raise | |
229 |
|
226 | |||
230 | def clone(ui, peeropts, source, dest=None, pull=False, rev=None, |
|
227 | def clone(ui, peeropts, source, dest=None, pull=False, rev=None, | |
231 | update=True, stream=False, branch=None): |
|
228 | update=True, stream=False, branch=None): | |
232 | """Make a copy of an existing repository. |
|
229 | """Make a copy of an existing repository. | |
233 |
|
230 | |||
234 | Create a copy of an existing repository in a new directory. The |
|
231 | Create a copy of an existing repository in a new directory. The | |
235 | source and destination are URLs, as passed to the repository |
|
232 | source and destination are URLs, as passed to the repository | |
236 | function. Returns a pair of repository peers, the source and |
|
233 | function. Returns a pair of repository peers, the source and | |
237 | newly created destination. |
|
234 | newly created destination. | |
238 |
|
235 | |||
239 | The location of the source is added to the new repository's |
|
236 | The location of the source is added to the new repository's | |
240 | .hg/hgrc file, as the default to be used for future pulls and |
|
237 | .hg/hgrc file, as the default to be used for future pulls and | |
241 | pushes. |
|
238 | pushes. | |
242 |
|
239 | |||
243 | If an exception is raised, the partly cloned/updated destination |
|
240 | If an exception is raised, the partly cloned/updated destination | |
244 | repository will be deleted. |
|
241 | repository will be deleted. | |
245 |
|
242 | |||
246 | Arguments: |
|
243 | Arguments: | |
247 |
|
244 | |||
248 | source: repository object or URL |
|
245 | source: repository object or URL | |
249 |
|
246 | |||
250 | dest: URL of destination repository to create (defaults to base |
|
247 | dest: URL of destination repository to create (defaults to base | |
251 | name of source repository) |
|
248 | name of source repository) | |
252 |
|
249 | |||
253 | pull: always pull from source repository, even in local case |
|
250 | pull: always pull from source repository, even in local case | |
254 |
|
251 | |||
255 | stream: stream raw data uncompressed from repository (fast over |
|
252 | stream: stream raw data uncompressed from repository (fast over | |
256 | LAN, slow over WAN) |
|
253 | LAN, slow over WAN) | |
257 |
|
254 | |||
258 | rev: revision to clone up to (implies pull=True) |
|
255 | rev: revision to clone up to (implies pull=True) | |
259 |
|
256 | |||
260 | update: update working directory after clone completes, if |
|
257 | update: update working directory after clone completes, if | |
261 | destination is local repository (True means update to default rev, |
|
258 | destination is local repository (True means update to default rev, | |
262 | anything else is treated as a revision) |
|
259 | anything else is treated as a revision) | |
263 |
|
260 | |||
264 | branch: branches to clone |
|
261 | branch: branches to clone | |
265 | """ |
|
262 | """ | |
266 |
|
263 | |||
267 | if isinstance(source, str): |
|
264 | if isinstance(source, str): | |
268 | origsource = ui.expandpath(source) |
|
265 | origsource = ui.expandpath(source) | |
269 | source, branch = parseurl(origsource, branch) |
|
266 | source, branch = parseurl(origsource, branch) | |
270 | srcpeer = peer(ui, peeropts, source) |
|
267 | srcpeer = peer(ui, peeropts, source) | |
271 | else: |
|
268 | else: | |
272 | srcpeer = source.peer() # in case we were called with a localrepo |
|
269 | srcpeer = source.peer() # in case we were called with a localrepo | |
273 | branch = (None, branch or []) |
|
270 | branch = (None, branch or []) | |
274 | origsource = source = srcpeer.url() |
|
271 | origsource = source = srcpeer.url() | |
275 | rev, checkout = addbranchrevs(srcpeer, srcpeer, branch, rev) |
|
272 | rev, checkout = addbranchrevs(srcpeer, srcpeer, branch, rev) | |
276 |
|
273 | |||
277 | if dest is None: |
|
274 | if dest is None: | |
278 | dest = defaultdest(source) |
|
275 | dest = defaultdest(source) | |
279 | ui.status(_("destination directory: %s\n") % dest) |
|
276 | ui.status(_("destination directory: %s\n") % dest) | |
280 | else: |
|
277 | else: | |
281 | dest = ui.expandpath(dest) |
|
278 | dest = ui.expandpath(dest) | |
282 |
|
279 | |||
283 | dest = util.urllocalpath(dest) |
|
280 | dest = util.urllocalpath(dest) | |
284 | source = util.urllocalpath(source) |
|
281 | source = util.urllocalpath(source) | |
285 |
|
282 | |||
286 | if not dest: |
|
283 | if not dest: | |
287 | raise util.Abort(_("empty destination path is not valid")) |
|
284 | raise util.Abort(_("empty destination path is not valid")) | |
288 | if os.path.exists(dest): |
|
285 | if os.path.exists(dest): | |
289 | if not os.path.isdir(dest): |
|
286 | if not os.path.isdir(dest): | |
290 | raise util.Abort(_("destination '%s' already exists") % dest) |
|
287 | raise util.Abort(_("destination '%s' already exists") % dest) | |
291 | elif os.listdir(dest): |
|
288 | elif os.listdir(dest): | |
292 | raise util.Abort(_("destination '%s' is not empty") % dest) |
|
289 | raise util.Abort(_("destination '%s' is not empty") % dest) | |
293 |
|
290 | |||
294 | srclock = destlock = cleandir = None |
|
291 | srclock = destlock = cleandir = None | |
295 | srcrepo = srcpeer.local() |
|
292 | srcrepo = srcpeer.local() | |
296 | try: |
|
293 | try: | |
297 | abspath = origsource |
|
294 | abspath = origsource | |
298 | if islocal(origsource): |
|
295 | if islocal(origsource): | |
299 | abspath = os.path.abspath(util.urllocalpath(origsource)) |
|
296 | abspath = os.path.abspath(util.urllocalpath(origsource)) | |
300 |
|
297 | |||
301 | if islocal(dest): |
|
298 | if islocal(dest): | |
302 | cleandir = dest |
|
299 | cleandir = dest | |
303 |
|
300 | |||
304 | copy = False |
|
301 | copy = False | |
305 | if (srcrepo and srcrepo.cancopy() and islocal(dest) |
|
302 | if (srcrepo and srcrepo.cancopy() and islocal(dest) | |
306 | and not phases.hassecret(srcrepo)): |
|
303 | and not phases.hassecret(srcrepo)): | |
307 | copy = not pull and not rev |
|
304 | copy = not pull and not rev | |
308 |
|
305 | |||
309 | if copy: |
|
306 | if copy: | |
310 | try: |
|
307 | try: | |
311 | # we use a lock here because if we race with commit, we |
|
308 | # we use a lock here because if we race with commit, we | |
312 | # can end up with extra data in the cloned revlogs that's |
|
309 | # can end up with extra data in the cloned revlogs that's | |
313 | # not pointed to by changesets, thus causing verify to |
|
310 | # not pointed to by changesets, thus causing verify to | |
314 | # fail |
|
311 | # fail | |
315 | srclock = srcrepo.lock(wait=False) |
|
312 | srclock = srcrepo.lock(wait=False) | |
316 | except error.LockError: |
|
313 | except error.LockError: | |
317 | copy = False |
|
314 | copy = False | |
318 |
|
315 | |||
319 | if copy: |
|
316 | if copy: | |
320 | srcrepo.hook('preoutgoing', throw=True, source='clone') |
|
317 | srcrepo.hook('preoutgoing', throw=True, source='clone') | |
321 | hgdir = os.path.realpath(os.path.join(dest, ".hg")) |
|
318 | hgdir = os.path.realpath(os.path.join(dest, ".hg")) | |
322 | if not os.path.exists(dest): |
|
319 | if not os.path.exists(dest): | |
323 | os.mkdir(dest) |
|
320 | os.mkdir(dest) | |
324 | else: |
|
321 | else: | |
325 | # only clean up directories we create ourselves |
|
322 | # only clean up directories we create ourselves | |
326 | cleandir = hgdir |
|
323 | cleandir = hgdir | |
327 | try: |
|
324 | try: | |
328 | destpath = hgdir |
|
325 | destpath = hgdir | |
329 | util.makedir(destpath, notindexed=True) |
|
326 | util.makedir(destpath, notindexed=True) | |
330 | except OSError, inst: |
|
327 | except OSError, inst: | |
331 | if inst.errno == errno.EEXIST: |
|
328 | if inst.errno == errno.EEXIST: | |
332 | cleandir = None |
|
329 | cleandir = None | |
333 | raise util.Abort(_("destination '%s' already exists") |
|
330 | raise util.Abort(_("destination '%s' already exists") | |
334 | % dest) |
|
331 | % dest) | |
335 | raise |
|
332 | raise | |
336 |
|
333 | |||
337 | destlock = copystore(ui, srcrepo, destpath) |
|
334 | destlock = copystore(ui, srcrepo, destpath) | |
338 |
|
335 | |||
339 | # Recomputing branch cache might be slow on big repos, |
|
336 | # Recomputing branch cache might be slow on big repos, | |
340 | # so just copy it |
|
337 | # so just copy it | |
341 | dstcachedir = os.path.join(destpath, 'cache') |
|
338 | dstcachedir = os.path.join(destpath, 'cache') | |
342 | srcbranchcache = srcrepo.sjoin('cache/branchheads') |
|
339 | srcbranchcache = srcrepo.sjoin('cache/branchheads') | |
343 | dstbranchcache = os.path.join(dstcachedir, 'branchheads') |
|
340 | dstbranchcache = os.path.join(dstcachedir, 'branchheads') | |
344 | if os.path.exists(srcbranchcache): |
|
341 | if os.path.exists(srcbranchcache): | |
345 | if not os.path.exists(dstcachedir): |
|
342 | if not os.path.exists(dstcachedir): | |
346 | os.mkdir(dstcachedir) |
|
343 | os.mkdir(dstcachedir) | |
347 | util.copyfile(srcbranchcache, dstbranchcache) |
|
344 | util.copyfile(srcbranchcache, dstbranchcache) | |
348 |
|
345 | |||
349 | # we need to re-init the repo after manually copying the data |
|
346 | # we need to re-init the repo after manually copying the data | |
350 | # into it |
|
347 | # into it | |
351 | destpeer = peer(srcrepo, peeropts, dest) |
|
348 | destpeer = peer(srcrepo, peeropts, dest) | |
352 | srcrepo.hook('outgoing', source='clone', |
|
349 | srcrepo.hook('outgoing', source='clone', | |
353 | node=node.hex(node.nullid)) |
|
350 | node=node.hex(node.nullid)) | |
354 | else: |
|
351 | else: | |
355 | try: |
|
352 | try: | |
356 | destpeer = peer(srcrepo or ui, peeropts, dest, create=True) |
|
353 | destpeer = peer(srcrepo or ui, peeropts, dest, create=True) | |
357 | # only pass ui when no srcrepo |
|
354 | # only pass ui when no srcrepo | |
358 | except OSError, inst: |
|
355 | except OSError, inst: | |
359 | if inst.errno == errno.EEXIST: |
|
356 | if inst.errno == errno.EEXIST: | |
360 | cleandir = None |
|
357 | cleandir = None | |
361 | raise util.Abort(_("destination '%s' already exists") |
|
358 | raise util.Abort(_("destination '%s' already exists") | |
362 | % dest) |
|
359 | % dest) | |
363 | raise |
|
360 | raise | |
364 |
|
361 | |||
365 | revs = None |
|
362 | revs = None | |
366 | if rev: |
|
363 | if rev: | |
367 | if not srcpeer.capable('lookup'): |
|
364 | if not srcpeer.capable('lookup'): | |
368 | raise util.Abort(_("src repository does not support " |
|
365 | raise util.Abort(_("src repository does not support " | |
369 | "revision lookup and so doesn't " |
|
366 | "revision lookup and so doesn't " | |
370 | "support clone by revision")) |
|
367 | "support clone by revision")) | |
371 | revs = [srcpeer.lookup(r) for r in rev] |
|
368 | revs = [srcpeer.lookup(r) for r in rev] | |
372 | checkout = revs[0] |
|
369 | checkout = revs[0] | |
373 | if destpeer.local(): |
|
370 | if destpeer.local(): | |
374 | destpeer.local().clone(srcpeer, heads=revs, stream=stream) |
|
371 | destpeer.local().clone(srcpeer, heads=revs, stream=stream) | |
375 | elif srcrepo: |
|
372 | elif srcrepo: | |
376 | srcrepo.push(destpeer, revs=revs) |
|
373 | srcrepo.push(destpeer, revs=revs) | |
377 | else: |
|
374 | else: | |
378 | raise util.Abort(_("clone from remote to remote not supported")) |
|
375 | raise util.Abort(_("clone from remote to remote not supported")) | |
379 |
|
376 | |||
380 | cleandir = None |
|
377 | cleandir = None | |
381 |
|
378 | |||
382 | # clone all bookmarks except divergent ones |
|
379 | # clone all bookmarks except divergent ones | |
383 | destrepo = destpeer.local() |
|
380 | destrepo = destpeer.local() | |
384 | if destrepo and srcpeer.capable("pushkey"): |
|
381 | if destrepo and srcpeer.capable("pushkey"): | |
385 | rb = srcpeer.listkeys('bookmarks') |
|
382 | rb = srcpeer.listkeys('bookmarks') | |
386 | marks = destrepo._bookmarks |
|
383 | marks = destrepo._bookmarks | |
387 | for k, n in rb.iteritems(): |
|
384 | for k, n in rb.iteritems(): | |
388 | try: |
|
385 | try: | |
389 | m = destrepo.lookup(n) |
|
386 | m = destrepo.lookup(n) | |
390 | marks[k] = m |
|
387 | marks[k] = m | |
391 | except error.RepoLookupError: |
|
388 | except error.RepoLookupError: | |
392 | pass |
|
389 | pass | |
393 | if rb: |
|
390 | if rb: | |
394 | marks.write() |
|
391 | marks.write() | |
395 | elif srcrepo and destpeer.capable("pushkey"): |
|
392 | elif srcrepo and destpeer.capable("pushkey"): | |
396 | for k, n in srcrepo._bookmarks.iteritems(): |
|
393 | for k, n in srcrepo._bookmarks.iteritems(): | |
397 | destpeer.pushkey('bookmarks', k, '', hex(n)) |
|
394 | destpeer.pushkey('bookmarks', k, '', hex(n)) | |
398 |
|
395 | |||
399 | if destrepo: |
|
396 | if destrepo: | |
400 | fp = destrepo.opener("hgrc", "w", text=True) |
|
397 | fp = destrepo.opener("hgrc", "w", text=True) | |
401 | fp.write("[paths]\n") |
|
398 | fp.write("[paths]\n") | |
402 | u = util.url(abspath) |
|
399 | u = util.url(abspath) | |
403 | u.passwd = None |
|
400 | u.passwd = None | |
404 | defaulturl = str(u) |
|
401 | defaulturl = str(u) | |
405 | fp.write("default = %s\n" % defaulturl) |
|
402 | fp.write("default = %s\n" % defaulturl) | |
406 | fp.close() |
|
403 | fp.close() | |
407 |
|
404 | |||
408 | destrepo.ui.setconfig('paths', 'default', defaulturl) |
|
405 | destrepo.ui.setconfig('paths', 'default', defaulturl) | |
409 |
|
406 | |||
410 | if update: |
|
407 | if update: | |
411 | if update is not True: |
|
408 | if update is not True: | |
412 | checkout = srcpeer.lookup(update) |
|
409 | checkout = srcpeer.lookup(update) | |
413 | uprev = None |
|
410 | uprev = None | |
414 | status = None |
|
411 | status = None | |
415 | if checkout is not None: |
|
412 | if checkout is not None: | |
416 | try: |
|
413 | try: | |
417 | uprev = destrepo.lookup(checkout) |
|
414 | uprev = destrepo.lookup(checkout) | |
418 | except error.RepoLookupError: |
|
415 | except error.RepoLookupError: | |
419 | pass |
|
416 | pass | |
420 | if uprev is None: |
|
417 | if uprev is None: | |
421 | try: |
|
418 | try: | |
422 | uprev = destrepo._bookmarks['@'] |
|
419 | uprev = destrepo._bookmarks['@'] | |
423 | update = '@' |
|
420 | update = '@' | |
424 | bn = destrepo[uprev].branch() |
|
421 | bn = destrepo[uprev].branch() | |
425 | if bn == 'default': |
|
422 | if bn == 'default': | |
426 | status = _("updating to bookmark @\n") |
|
423 | status = _("updating to bookmark @\n") | |
427 | else: |
|
424 | else: | |
428 | status = _("updating to bookmark @ on branch %s\n" |
|
425 | status = _("updating to bookmark @ on branch %s\n" | |
429 | % bn) |
|
426 | % bn) | |
430 | except KeyError: |
|
427 | except KeyError: | |
431 | try: |
|
428 | try: | |
432 | uprev = destrepo.branchtip('default') |
|
429 | uprev = destrepo.branchtip('default') | |
433 | except error.RepoLookupError: |
|
430 | except error.RepoLookupError: | |
434 | uprev = destrepo.lookup('tip') |
|
431 | uprev = destrepo.lookup('tip') | |
435 | if not status: |
|
432 | if not status: | |
436 | bn = destrepo[uprev].branch() |
|
433 | bn = destrepo[uprev].branch() | |
437 | status = _("updating to branch %s\n") % bn |
|
434 | status = _("updating to branch %s\n") % bn | |
438 | destrepo.ui.status(status) |
|
435 | destrepo.ui.status(status) | |
439 | _update(destrepo, uprev) |
|
436 | _update(destrepo, uprev) | |
440 | if update in destrepo._bookmarks: |
|
437 | if update in destrepo._bookmarks: | |
441 | bookmarks.setcurrent(destrepo, update) |
|
438 | bookmarks.setcurrent(destrepo, update) | |
442 |
|
439 | |||
443 | return srcpeer, destpeer |
|
440 | return srcpeer, destpeer | |
444 | finally: |
|
441 | finally: | |
445 | release(srclock, destlock) |
|
442 | release(srclock, destlock) | |
446 | if cleandir is not None: |
|
443 | if cleandir is not None: | |
447 | shutil.rmtree(cleandir, True) |
|
444 | shutil.rmtree(cleandir, True) | |
448 | if srcpeer is not None: |
|
445 | if srcpeer is not None: | |
449 | srcpeer.close() |
|
446 | srcpeer.close() | |
450 |
|
447 | |||
451 | def _showstats(repo, stats): |
|
448 | def _showstats(repo, stats): | |
452 | repo.ui.status(_("%d files updated, %d files merged, " |
|
449 | repo.ui.status(_("%d files updated, %d files merged, " | |
453 | "%d files removed, %d files unresolved\n") % stats) |
|
450 | "%d files removed, %d files unresolved\n") % stats) | |
454 |
|
451 | |||
455 | def updaterepo(repo, node, overwrite): |
|
452 | def updaterepo(repo, node, overwrite): | |
456 | """Update the working directory to node. |
|
453 | """Update the working directory to node. | |
457 |
|
454 | |||
458 | When overwrite is set, changes are clobbered, merged else |
|
455 | When overwrite is set, changes are clobbered, merged else | |
459 |
|
456 | |||
460 | returns stats (see pydoc mercurial.merge.applyupdates)""" |
|
457 | returns stats (see pydoc mercurial.merge.applyupdates)""" | |
461 | return mergemod.update(repo, node, False, overwrite, None) |
|
458 | return mergemod.update(repo, node, False, overwrite, None) | |
462 |
|
459 | |||
463 | def update(repo, node): |
|
460 | def update(repo, node): | |
464 | """update the working directory to node, merging linear changes""" |
|
461 | """update the working directory to node, merging linear changes""" | |
465 | stats = updaterepo(repo, node, False) |
|
462 | stats = updaterepo(repo, node, False) | |
466 | _showstats(repo, stats) |
|
463 | _showstats(repo, stats) | |
467 | if stats[3]: |
|
464 | if stats[3]: | |
468 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) |
|
465 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) | |
469 | return stats[3] > 0 |
|
466 | return stats[3] > 0 | |
470 |
|
467 | |||
471 | # naming conflict in clone() |
|
468 | # naming conflict in clone() | |
472 | _update = update |
|
469 | _update = update | |
473 |
|
470 | |||
474 | def clean(repo, node, show_stats=True): |
|
471 | def clean(repo, node, show_stats=True): | |
475 | """forcibly switch the working directory to node, clobbering changes""" |
|
472 | """forcibly switch the working directory to node, clobbering changes""" | |
476 | stats = updaterepo(repo, node, True) |
|
473 | stats = updaterepo(repo, node, True) | |
477 | if show_stats: |
|
474 | if show_stats: | |
478 | _showstats(repo, stats) |
|
475 | _showstats(repo, stats) | |
479 | return stats[3] > 0 |
|
476 | return stats[3] > 0 | |
480 |
|
477 | |||
481 | def merge(repo, node, force=None, remind=True): |
|
478 | def merge(repo, node, force=None, remind=True): | |
482 | """Branch merge with node, resolving changes. Return true if any |
|
479 | """Branch merge with node, resolving changes. Return true if any | |
483 | unresolved conflicts.""" |
|
480 | unresolved conflicts.""" | |
484 | stats = mergemod.update(repo, node, True, force, False) |
|
481 | stats = mergemod.update(repo, node, True, force, False) | |
485 | _showstats(repo, stats) |
|
482 | _showstats(repo, stats) | |
486 | if stats[3]: |
|
483 | if stats[3]: | |
487 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " |
|
484 | repo.ui.status(_("use 'hg resolve' to retry unresolved file merges " | |
488 | "or 'hg update -C .' to abandon\n")) |
|
485 | "or 'hg update -C .' to abandon\n")) | |
489 | elif remind: |
|
486 | elif remind: | |
490 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
|
487 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) | |
491 | return stats[3] > 0 |
|
488 | return stats[3] > 0 | |
492 |
|
489 | |||
493 | def _incoming(displaychlist, subreporecurse, ui, repo, source, |
|
490 | def _incoming(displaychlist, subreporecurse, ui, repo, source, | |
494 | opts, buffered=False): |
|
491 | opts, buffered=False): | |
495 | """ |
|
492 | """ | |
496 | Helper for incoming / gincoming. |
|
493 | Helper for incoming / gincoming. | |
497 | displaychlist gets called with |
|
494 | displaychlist gets called with | |
498 | (remoterepo, incomingchangesetlist, displayer) parameters, |
|
495 | (remoterepo, incomingchangesetlist, displayer) parameters, | |
499 | and is supposed to contain only code that can't be unified. |
|
496 | and is supposed to contain only code that can't be unified. | |
500 | """ |
|
497 | """ | |
501 | source, branches = parseurl(ui.expandpath(source), opts.get('branch')) |
|
498 | source, branches = parseurl(ui.expandpath(source), opts.get('branch')) | |
502 | other = peer(repo, opts, source) |
|
499 | other = peer(repo, opts, source) | |
503 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) |
|
500 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) | |
504 | revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev')) |
|
501 | revs, checkout = addbranchrevs(repo, other, branches, opts.get('rev')) | |
505 |
|
502 | |||
506 | if revs: |
|
503 | if revs: | |
507 | revs = [other.lookup(rev) for rev in revs] |
|
504 | revs = [other.lookup(rev) for rev in revs] | |
508 | other, chlist, cleanupfn = bundlerepo.getremotechanges(ui, repo, other, |
|
505 | other, chlist, cleanupfn = bundlerepo.getremotechanges(ui, repo, other, | |
509 | revs, opts["bundle"], opts["force"]) |
|
506 | revs, opts["bundle"], opts["force"]) | |
510 | try: |
|
507 | try: | |
511 | if not chlist: |
|
508 | if not chlist: | |
512 | ui.status(_("no changes found\n")) |
|
509 | ui.status(_("no changes found\n")) | |
513 | return subreporecurse() |
|
510 | return subreporecurse() | |
514 |
|
511 | |||
515 | displayer = cmdutil.show_changeset(ui, other, opts, buffered) |
|
512 | displayer = cmdutil.show_changeset(ui, other, opts, buffered) | |
516 |
|
513 | |||
517 | # XXX once graphlog extension makes it into core, |
|
514 | # XXX once graphlog extension makes it into core, | |
518 | # should be replaced by a if graph/else |
|
515 | # should be replaced by a if graph/else | |
519 | displaychlist(other, chlist, displayer) |
|
516 | displaychlist(other, chlist, displayer) | |
520 |
|
517 | |||
521 | displayer.close() |
|
518 | displayer.close() | |
522 | finally: |
|
519 | finally: | |
523 | cleanupfn() |
|
520 | cleanupfn() | |
524 | subreporecurse() |
|
521 | subreporecurse() | |
525 | return 0 # exit code is zero since we found incoming changes |
|
522 | return 0 # exit code is zero since we found incoming changes | |
526 |
|
523 | |||
527 | def incoming(ui, repo, source, opts): |
|
524 | def incoming(ui, repo, source, opts): | |
528 | def subreporecurse(): |
|
525 | def subreporecurse(): | |
529 | ret = 1 |
|
526 | ret = 1 | |
530 | if opts.get('subrepos'): |
|
527 | if opts.get('subrepos'): | |
531 | ctx = repo[None] |
|
528 | ctx = repo[None] | |
532 | for subpath in sorted(ctx.substate): |
|
529 | for subpath in sorted(ctx.substate): | |
533 | sub = ctx.sub(subpath) |
|
530 | sub = ctx.sub(subpath) | |
534 | ret = min(ret, sub.incoming(ui, source, opts)) |
|
531 | ret = min(ret, sub.incoming(ui, source, opts)) | |
535 | return ret |
|
532 | return ret | |
536 |
|
533 | |||
537 | def display(other, chlist, displayer): |
|
534 | def display(other, chlist, displayer): | |
538 | limit = cmdutil.loglimit(opts) |
|
535 | limit = cmdutil.loglimit(opts) | |
539 | if opts.get('newest_first'): |
|
536 | if opts.get('newest_first'): | |
540 | chlist.reverse() |
|
537 | chlist.reverse() | |
541 | count = 0 |
|
538 | count = 0 | |
542 | for n in chlist: |
|
539 | for n in chlist: | |
543 | if limit is not None and count >= limit: |
|
540 | if limit is not None and count >= limit: | |
544 | break |
|
541 | break | |
545 | parents = [p for p in other.changelog.parents(n) if p != nullid] |
|
542 | parents = [p for p in other.changelog.parents(n) if p != nullid] | |
546 | if opts.get('no_merges') and len(parents) == 2: |
|
543 | if opts.get('no_merges') and len(parents) == 2: | |
547 | continue |
|
544 | continue | |
548 | count += 1 |
|
545 | count += 1 | |
549 | displayer.show(other[n]) |
|
546 | displayer.show(other[n]) | |
550 | return _incoming(display, subreporecurse, ui, repo, source, opts) |
|
547 | return _incoming(display, subreporecurse, ui, repo, source, opts) | |
551 |
|
548 | |||
552 | def _outgoing(ui, repo, dest, opts): |
|
549 | def _outgoing(ui, repo, dest, opts): | |
553 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
550 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
554 | dest, branches = parseurl(dest, opts.get('branch')) |
|
551 | dest, branches = parseurl(dest, opts.get('branch')) | |
555 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) |
|
552 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) | |
556 | revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) |
|
553 | revs, checkout = addbranchrevs(repo, repo, branches, opts.get('rev')) | |
557 | if revs: |
|
554 | if revs: | |
558 | revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] |
|
555 | revs = [repo.lookup(rev) for rev in scmutil.revrange(repo, revs)] | |
559 |
|
556 | |||
560 | other = peer(repo, opts, dest) |
|
557 | other = peer(repo, opts, dest) | |
561 | outgoing = discovery.findcommonoutgoing(repo.unfiltered(), other, revs, |
|
558 | outgoing = discovery.findcommonoutgoing(repo.unfiltered(), other, revs, | |
562 | force=opts.get('force')) |
|
559 | force=opts.get('force')) | |
563 | o = outgoing.missing |
|
560 | o = outgoing.missing | |
564 | if not o: |
|
561 | if not o: | |
565 | scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) |
|
562 | scmutil.nochangesfound(repo.ui, repo, outgoing.excluded) | |
566 | return None |
|
563 | return None | |
567 | return o |
|
564 | return o | |
568 |
|
565 | |||
569 | def outgoing(ui, repo, dest, opts): |
|
566 | def outgoing(ui, repo, dest, opts): | |
570 | def recurse(): |
|
567 | def recurse(): | |
571 | ret = 1 |
|
568 | ret = 1 | |
572 | if opts.get('subrepos'): |
|
569 | if opts.get('subrepos'): | |
573 | ctx = repo[None] |
|
570 | ctx = repo[None] | |
574 | for subpath in sorted(ctx.substate): |
|
571 | for subpath in sorted(ctx.substate): | |
575 | sub = ctx.sub(subpath) |
|
572 | sub = ctx.sub(subpath) | |
576 | ret = min(ret, sub.outgoing(ui, dest, opts)) |
|
573 | ret = min(ret, sub.outgoing(ui, dest, opts)) | |
577 | return ret |
|
574 | return ret | |
578 |
|
575 | |||
579 | limit = cmdutil.loglimit(opts) |
|
576 | limit = cmdutil.loglimit(opts) | |
580 | o = _outgoing(ui, repo, dest, opts) |
|
577 | o = _outgoing(ui, repo, dest, opts) | |
581 | if o is None: |
|
578 | if o is None: | |
582 | return recurse() |
|
579 | return recurse() | |
583 |
|
580 | |||
584 | if opts.get('newest_first'): |
|
581 | if opts.get('newest_first'): | |
585 | o.reverse() |
|
582 | o.reverse() | |
586 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
583 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
587 | count = 0 |
|
584 | count = 0 | |
588 | for n in o: |
|
585 | for n in o: | |
589 | if limit is not None and count >= limit: |
|
586 | if limit is not None and count >= limit: | |
590 | break |
|
587 | break | |
591 | parents = [p for p in repo.changelog.parents(n) if p != nullid] |
|
588 | parents = [p for p in repo.changelog.parents(n) if p != nullid] | |
592 | if opts.get('no_merges') and len(parents) == 2: |
|
589 | if opts.get('no_merges') and len(parents) == 2: | |
593 | continue |
|
590 | continue | |
594 | count += 1 |
|
591 | count += 1 | |
595 | displayer.show(repo[n]) |
|
592 | displayer.show(repo[n]) | |
596 | displayer.close() |
|
593 | displayer.close() | |
597 | recurse() |
|
594 | recurse() | |
598 | return 0 # exit code is zero since we found outgoing changes |
|
595 | return 0 # exit code is zero since we found outgoing changes | |
599 |
|
596 | |||
600 | def revert(repo, node, choose): |
|
597 | def revert(repo, node, choose): | |
601 | """revert changes to revision in node without updating dirstate""" |
|
598 | """revert changes to revision in node without updating dirstate""" | |
602 | return mergemod.update(repo, node, False, True, choose)[3] > 0 |
|
599 | return mergemod.update(repo, node, False, True, choose)[3] > 0 | |
603 |
|
600 | |||
604 | def verify(repo): |
|
601 | def verify(repo): | |
605 | """verify the consistency of a repository""" |
|
602 | """verify the consistency of a repository""" | |
606 | return verifymod.verify(repo) |
|
603 | return verifymod.verify(repo) | |
607 |
|
604 | |||
608 | def remoteui(src, opts): |
|
605 | def remoteui(src, opts): | |
609 | 'build a remote ui from ui or repo and opts' |
|
606 | 'build a remote ui from ui or repo and opts' | |
610 | if util.safehasattr(src, 'baseui'): # looks like a repository |
|
607 | if util.safehasattr(src, 'baseui'): # looks like a repository | |
611 | dst = src.baseui.copy() # drop repo-specific config |
|
608 | dst = src.baseui.copy() # drop repo-specific config | |
612 | src = src.ui # copy target options from repo |
|
609 | src = src.ui # copy target options from repo | |
613 | else: # assume it's a global ui object |
|
610 | else: # assume it's a global ui object | |
614 | dst = src.copy() # keep all global options |
|
611 | dst = src.copy() # keep all global options | |
615 |
|
612 | |||
616 | # copy ssh-specific options |
|
613 | # copy ssh-specific options | |
617 | for o in 'ssh', 'remotecmd': |
|
614 | for o in 'ssh', 'remotecmd': | |
618 | v = opts.get(o) or src.config('ui', o) |
|
615 | v = opts.get(o) or src.config('ui', o) | |
619 | if v: |
|
616 | if v: | |
620 | dst.setconfig("ui", o, v) |
|
617 | dst.setconfig("ui", o, v) | |
621 |
|
618 | |||
622 | # copy bundle-specific options |
|
619 | # copy bundle-specific options | |
623 | r = src.config('bundle', 'mainreporoot') |
|
620 | r = src.config('bundle', 'mainreporoot') | |
624 | if r: |
|
621 | if r: | |
625 | dst.setconfig('bundle', 'mainreporoot', r) |
|
622 | dst.setconfig('bundle', 'mainreporoot', r) | |
626 |
|
623 | |||
627 | # copy selected local settings to the remote ui |
|
624 | # copy selected local settings to the remote ui | |
628 | for sect in ('auth', 'hostfingerprints', 'http_proxy'): |
|
625 | for sect in ('auth', 'hostfingerprints', 'http_proxy'): | |
629 | for key, val in src.configitems(sect): |
|
626 | for key, val in src.configitems(sect): | |
630 | dst.setconfig(sect, key, val) |
|
627 | dst.setconfig(sect, key, val) | |
631 | v = src.config('web', 'cacerts') |
|
628 | v = src.config('web', 'cacerts') | |
632 | if v: |
|
629 | if v: | |
633 | dst.setconfig('web', 'cacerts', util.expandpath(v)) |
|
630 | dst.setconfig('web', 'cacerts', util.expandpath(v)) | |
634 |
|
631 | |||
635 | return dst |
|
632 | return dst |
@@ -1,1066 +1,1064 | |||||
1 | Let commit recurse into subrepos by default to match pre-2.0 behavior: |
|
1 | Let commit recurse into subrepos by default to match pre-2.0 behavior: | |
2 |
|
2 | |||
3 | $ echo "[ui]" >> $HGRCPATH |
|
3 | $ echo "[ui]" >> $HGRCPATH | |
4 | $ echo "commitsubrepos = Yes" >> $HGRCPATH |
|
4 | $ echo "commitsubrepos = Yes" >> $HGRCPATH | |
5 |
|
5 | |||
6 | $ hg init t |
|
6 | $ hg init t | |
7 | $ cd t |
|
7 | $ cd t | |
8 |
|
8 | |||
9 | first revision, no sub |
|
9 | first revision, no sub | |
10 |
|
10 | |||
11 | $ echo a > a |
|
11 | $ echo a > a | |
12 | $ hg ci -Am0 |
|
12 | $ hg ci -Am0 | |
13 | adding a |
|
13 | adding a | |
14 |
|
14 | |||
15 | add first sub |
|
15 | add first sub | |
16 |
|
16 | |||
17 | $ echo s = s > .hgsub |
|
17 | $ echo s = s > .hgsub | |
18 | $ hg add .hgsub |
|
18 | $ hg add .hgsub | |
19 | $ hg init s |
|
19 | $ hg init s | |
20 | $ echo a > s/a |
|
20 | $ echo a > s/a | |
21 |
|
21 | |||
22 | Issue2232: committing a subrepo without .hgsub |
|
22 | Issue2232: committing a subrepo without .hgsub | |
23 |
|
23 | |||
24 | $ hg ci -mbad s |
|
24 | $ hg ci -mbad s | |
25 | abort: can't commit subrepos without .hgsub |
|
25 | abort: can't commit subrepos without .hgsub | |
26 | [255] |
|
26 | [255] | |
27 |
|
27 | |||
28 | $ hg -R s ci -Ams0 |
|
28 | $ hg -R s ci -Ams0 | |
29 | adding a |
|
29 | adding a | |
30 | $ hg sum |
|
30 | $ hg sum | |
31 | parent: 0:f7b1eb17ad24 tip |
|
31 | parent: 0:f7b1eb17ad24 tip | |
32 | 0 |
|
32 | 0 | |
33 | branch: default |
|
33 | branch: default | |
34 | commit: 1 added, 1 subrepos |
|
34 | commit: 1 added, 1 subrepos | |
35 | update: (current) |
|
35 | update: (current) | |
36 | $ hg ci -m1 |
|
36 | $ hg ci -m1 | |
37 |
|
37 | |||
38 | Revert subrepo and test subrepo fileset keyword: |
|
38 | Revert subrepo and test subrepo fileset keyword: | |
39 |
|
39 | |||
40 | $ echo b > s/a |
|
40 | $ echo b > s/a | |
41 | $ hg revert "set:subrepo('glob:s*')" |
|
41 | $ hg revert "set:subrepo('glob:s*')" | |
42 | reverting subrepo s |
|
42 | reverting subrepo s | |
43 | reverting s/a (glob) |
|
43 | reverting s/a (glob) | |
44 | $ rm s/a.orig |
|
44 | $ rm s/a.orig | |
45 |
|
45 | |||
46 | Revert subrepo with no backup. The "reverting s/a" line is gone since |
|
46 | Revert subrepo with no backup. The "reverting s/a" line is gone since | |
47 | we're really running 'hg update' in the subrepo: |
|
47 | we're really running 'hg update' in the subrepo: | |
48 |
|
48 | |||
49 | $ echo b > s/a |
|
49 | $ echo b > s/a | |
50 | $ hg revert --no-backup s |
|
50 | $ hg revert --no-backup s | |
51 | reverting subrepo s |
|
51 | reverting subrepo s | |
52 |
|
52 | |||
53 | Issue2022: update -C |
|
53 | Issue2022: update -C | |
54 |
|
54 | |||
55 | $ echo b > s/a |
|
55 | $ echo b > s/a | |
56 | $ hg sum |
|
56 | $ hg sum | |
57 | parent: 1:7cf8cfea66e4 tip |
|
57 | parent: 1:7cf8cfea66e4 tip | |
58 | 1 |
|
58 | 1 | |
59 | branch: default |
|
59 | branch: default | |
60 | commit: 1 subrepos |
|
60 | commit: 1 subrepos | |
61 | update: (current) |
|
61 | update: (current) | |
62 | $ hg co -C 1 |
|
62 | $ hg co -C 1 | |
63 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
63 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
64 | $ hg sum |
|
64 | $ hg sum | |
65 | parent: 1:7cf8cfea66e4 tip |
|
65 | parent: 1:7cf8cfea66e4 tip | |
66 | 1 |
|
66 | 1 | |
67 | branch: default |
|
67 | branch: default | |
68 | commit: (clean) |
|
68 | commit: (clean) | |
69 | update: (current) |
|
69 | update: (current) | |
70 |
|
70 | |||
71 | commands that require a clean repo should respect subrepos |
|
71 | commands that require a clean repo should respect subrepos | |
72 |
|
72 | |||
73 | $ echo b >> s/a |
|
73 | $ echo b >> s/a | |
74 | $ hg backout tip |
|
74 | $ hg backout tip | |
75 | abort: uncommitted changes in subrepo s |
|
75 | abort: uncommitted changes in subrepo s | |
76 | [255] |
|
76 | [255] | |
77 | $ hg revert -C -R s s/a |
|
77 | $ hg revert -C -R s s/a | |
78 |
|
78 | |||
79 | add sub sub |
|
79 | add sub sub | |
80 |
|
80 | |||
81 | $ echo ss = ss > s/.hgsub |
|
81 | $ echo ss = ss > s/.hgsub | |
82 | $ hg init s/ss |
|
82 | $ hg init s/ss | |
83 | $ echo a > s/ss/a |
|
83 | $ echo a > s/ss/a | |
84 | $ hg -R s add s/.hgsub |
|
84 | $ hg -R s add s/.hgsub | |
85 | $ hg -R s/ss add s/ss/a |
|
85 | $ hg -R s/ss add s/ss/a | |
86 | $ hg sum |
|
86 | $ hg sum | |
87 | parent: 1:7cf8cfea66e4 tip |
|
87 | parent: 1:7cf8cfea66e4 tip | |
88 | 1 |
|
88 | 1 | |
89 | branch: default |
|
89 | branch: default | |
90 | commit: 1 subrepos |
|
90 | commit: 1 subrepos | |
91 | update: (current) |
|
91 | update: (current) | |
92 | $ hg ci -m2 |
|
92 | $ hg ci -m2 | |
93 | committing subrepository s |
|
93 | committing subrepository s | |
94 | committing subrepository s/ss (glob) |
|
94 | committing subrepository s/ss (glob) | |
95 | $ hg sum |
|
95 | $ hg sum | |
96 | parent: 2:df30734270ae tip |
|
96 | parent: 2:df30734270ae tip | |
97 | 2 |
|
97 | 2 | |
98 | branch: default |
|
98 | branch: default | |
99 | commit: (clean) |
|
99 | commit: (clean) | |
100 | update: (current) |
|
100 | update: (current) | |
101 |
|
101 | |||
102 | bump sub rev (and check it is ignored by ui.commitsubrepos) |
|
102 | bump sub rev (and check it is ignored by ui.commitsubrepos) | |
103 |
|
103 | |||
104 | $ echo b > s/a |
|
104 | $ echo b > s/a | |
105 | $ hg -R s ci -ms1 |
|
105 | $ hg -R s ci -ms1 | |
106 | $ hg --config ui.commitsubrepos=no ci -m3 |
|
106 | $ hg --config ui.commitsubrepos=no ci -m3 | |
107 |
|
107 | |||
108 | leave sub dirty (and check ui.commitsubrepos=no aborts the commit) |
|
108 | leave sub dirty (and check ui.commitsubrepos=no aborts the commit) | |
109 |
|
109 | |||
110 | $ echo c > s/a |
|
110 | $ echo c > s/a | |
111 | $ hg --config ui.commitsubrepos=no ci -m4 |
|
111 | $ hg --config ui.commitsubrepos=no ci -m4 | |
112 | abort: uncommitted changes in subrepo s |
|
112 | abort: uncommitted changes in subrepo s | |
113 | (use --subrepos for recursive commit) |
|
113 | (use --subrepos for recursive commit) | |
114 | [255] |
|
114 | [255] | |
115 | $ hg id |
|
115 | $ hg id | |
116 | f6affe3fbfaa+ tip |
|
116 | f6affe3fbfaa+ tip | |
117 | $ hg -R s ci -mc |
|
117 | $ hg -R s ci -mc | |
118 | $ hg id |
|
118 | $ hg id | |
119 | f6affe3fbfaa+ tip |
|
119 | f6affe3fbfaa+ tip | |
120 | $ echo d > s/a |
|
120 | $ echo d > s/a | |
121 | $ hg ci -m4 |
|
121 | $ hg ci -m4 | |
122 | committing subrepository s |
|
122 | committing subrepository s | |
123 | $ hg tip -R s |
|
123 | $ hg tip -R s | |
124 | changeset: 4:02dcf1d70411 |
|
124 | changeset: 4:02dcf1d70411 | |
125 | tag: tip |
|
125 | tag: tip | |
126 | user: test |
|
126 | user: test | |
127 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
127 | date: Thu Jan 01 00:00:00 1970 +0000 | |
128 | summary: 4 |
|
128 | summary: 4 | |
129 |
|
129 | |||
130 |
|
130 | |||
131 | check caching |
|
131 | check caching | |
132 |
|
132 | |||
133 | $ hg co 0 |
|
133 | $ hg co 0 | |
134 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
134 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
135 | $ hg debugsub |
|
135 | $ hg debugsub | |
136 |
|
136 | |||
137 | restore |
|
137 | restore | |
138 |
|
138 | |||
139 | $ hg co |
|
139 | $ hg co | |
140 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
140 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
141 | $ hg debugsub |
|
141 | $ hg debugsub | |
142 | path s |
|
142 | path s | |
143 | source s |
|
143 | source s | |
144 | revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef |
|
144 | revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef | |
145 |
|
145 | |||
146 | new branch for merge tests |
|
146 | new branch for merge tests | |
147 |
|
147 | |||
148 | $ hg co 1 |
|
148 | $ hg co 1 | |
149 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
149 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
150 | $ echo t = t >> .hgsub |
|
150 | $ echo t = t >> .hgsub | |
151 | $ hg init t |
|
151 | $ hg init t | |
152 | $ echo t > t/t |
|
152 | $ echo t > t/t | |
153 | $ hg -R t add t |
|
153 | $ hg -R t add t | |
154 | adding t/t (glob) |
|
154 | adding t/t (glob) | |
155 |
|
155 | |||
156 | 5 |
|
156 | 5 | |
157 |
|
157 | |||
158 | $ hg ci -m5 # add sub |
|
158 | $ hg ci -m5 # add sub | |
159 | committing subrepository t |
|
159 | committing subrepository t | |
160 | created new head |
|
160 | created new head | |
161 | $ echo t2 > t/t |
|
161 | $ echo t2 > t/t | |
162 |
|
162 | |||
163 | 6 |
|
163 | 6 | |
164 |
|
164 | |||
165 | $ hg st -R s |
|
165 | $ hg st -R s | |
166 | $ hg ci -m6 # change sub |
|
166 | $ hg ci -m6 # change sub | |
167 | committing subrepository t |
|
167 | committing subrepository t | |
168 | $ hg debugsub |
|
168 | $ hg debugsub | |
169 | path s |
|
169 | path s | |
170 | source s |
|
170 | source s | |
171 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 |
|
171 | revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 | |
172 | path t |
|
172 | path t | |
173 | source t |
|
173 | source t | |
174 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
174 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad | |
175 | $ echo t3 > t/t |
|
175 | $ echo t3 > t/t | |
176 |
|
176 | |||
177 | 7 |
|
177 | 7 | |
178 |
|
178 | |||
179 | $ hg ci -m7 # change sub again for conflict test |
|
179 | $ hg ci -m7 # change sub again for conflict test | |
180 | committing subrepository t |
|
180 | committing subrepository t | |
181 | $ hg rm .hgsub |
|
181 | $ hg rm .hgsub | |
182 |
|
182 | |||
183 | 8 |
|
183 | 8 | |
184 |
|
184 | |||
185 | $ hg ci -m8 # remove sub |
|
185 | $ hg ci -m8 # remove sub | |
186 |
|
186 | |||
187 | merge tests |
|
187 | merge tests | |
188 |
|
188 | |||
189 | $ hg co -C 3 |
|
189 | $ hg co -C 3 | |
190 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
190 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
191 | $ hg merge 5 # test adding |
|
191 | $ hg merge 5 # test adding | |
192 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
192 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
193 | (branch merge, don't forget to commit) |
|
193 | (branch merge, don't forget to commit) | |
194 | $ hg debugsub |
|
194 | $ hg debugsub | |
195 | path s |
|
195 | path s | |
196 | source s |
|
196 | source s | |
197 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
197 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 | |
198 | path t |
|
198 | path t | |
199 | source t |
|
199 | source t | |
200 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 |
|
200 | revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382 | |
201 | $ hg ci -m9 |
|
201 | $ hg ci -m9 | |
202 | created new head |
|
202 | created new head | |
203 | $ hg merge 6 --debug # test change |
|
203 | $ hg merge 6 --debug # test change | |
204 | searching for copies back to rev 2 |
|
204 | searching for copies back to rev 2 | |
205 | resolving manifests |
|
205 | resolving manifests | |
206 | overwrite: False, partial: False |
|
206 | overwrite: False, partial: False | |
207 | ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4 |
|
207 | ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4 | |
208 | .hgsubstate: versions differ -> m |
|
208 | .hgsubstate: versions differ -> m | |
209 | updating: .hgsubstate 1/1 files (100.00%) |
|
209 | updating: .hgsubstate 1/1 files (100.00%) | |
210 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec |
|
210 | subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec | |
211 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg |
|
211 | subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg | |
212 | getting subrepo t |
|
212 | getting subrepo t | |
213 | searching for copies back to rev 1 |
|
213 | searching for copies back to rev 1 | |
214 | resolving manifests |
|
214 | resolving manifests | |
215 | overwrite: False, partial: False |
|
215 | overwrite: False, partial: False | |
216 | ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a |
|
216 | ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a | |
217 | t: remote is newer -> g |
|
217 | t: remote is newer -> g | |
218 | updating: t 1/1 files (100.00%) |
|
218 | updating: t 1/1 files (100.00%) | |
219 | getting t |
|
219 | getting t | |
220 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
220 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
221 | (branch merge, don't forget to commit) |
|
221 | (branch merge, don't forget to commit) | |
222 | $ hg debugsub |
|
222 | $ hg debugsub | |
223 | path s |
|
223 | path s | |
224 | source s |
|
224 | source s | |
225 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
225 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 | |
226 | path t |
|
226 | path t | |
227 | source t |
|
227 | source t | |
228 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad |
|
228 | revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad | |
229 | $ echo conflict > t/t |
|
229 | $ echo conflict > t/t | |
230 | $ hg ci -m10 |
|
230 | $ hg ci -m10 | |
231 | committing subrepository t |
|
231 | committing subrepository t | |
232 | $ HGMERGE=internal:merge hg merge --debug 7 # test conflict |
|
232 | $ HGMERGE=internal:merge hg merge --debug 7 # test conflict | |
233 | searching for copies back to rev 2 |
|
233 | searching for copies back to rev 2 | |
234 | resolving manifests |
|
234 | resolving manifests | |
235 | overwrite: False, partial: False |
|
235 | overwrite: False, partial: False | |
236 | ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf |
|
236 | ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf | |
237 | .hgsubstate: versions differ -> m |
|
237 | .hgsubstate: versions differ -> m | |
238 | updating: .hgsubstate 1/1 files (100.00%) |
|
238 | updating: .hgsubstate 1/1 files (100.00%) | |
239 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 |
|
239 | subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4 | |
240 | subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg |
|
240 | subrepo t: both sides changed, merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg | |
241 | merging subrepo t |
|
241 | merging subrepo t | |
242 | searching for copies back to rev 2 |
|
242 | searching for copies back to rev 2 | |
243 | resolving manifests |
|
243 | resolving manifests | |
244 | overwrite: False, partial: False |
|
244 | overwrite: False, partial: False | |
245 | ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 |
|
245 | ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198 | |
246 | t: versions differ -> m |
|
246 | t: versions differ -> m | |
247 | preserving t for resolve of t |
|
247 | preserving t for resolve of t | |
248 | updating: t 1/1 files (100.00%) |
|
248 | updating: t 1/1 files (100.00%) | |
249 | picked tool 'internal:merge' for t (binary False symlink False) |
|
249 | picked tool 'internal:merge' for t (binary False symlink False) | |
250 | merging t |
|
250 | merging t | |
251 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a |
|
251 | my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a | |
252 | warning: conflicts during merge. |
|
252 | warning: conflicts during merge. | |
253 | merging t incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
253 | merging t incomplete! (edit conflicts, then use 'hg resolve --mark') | |
254 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
254 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
255 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
255 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
256 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
256 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
257 | (branch merge, don't forget to commit) |
|
257 | (branch merge, don't forget to commit) | |
258 |
|
258 | |||
259 | should conflict |
|
259 | should conflict | |
260 |
|
260 | |||
261 | $ cat t/t |
|
261 | $ cat t/t | |
262 | <<<<<<< local |
|
262 | <<<<<<< local | |
263 | conflict |
|
263 | conflict | |
264 | ======= |
|
264 | ======= | |
265 | t3 |
|
265 | t3 | |
266 | >>>>>>> other |
|
266 | >>>>>>> other | |
267 |
|
267 | |||
268 | clone |
|
268 | clone | |
269 |
|
269 | |||
270 | $ cd .. |
|
270 | $ cd .. | |
271 | $ hg clone t tc |
|
271 | $ hg clone t tc | |
272 | updating to branch default |
|
272 | updating to branch default | |
273 | cloning subrepo s from $TESTTMP/t/s (glob) |
|
273 | cloning subrepo s from $TESTTMP/t/s (glob) | |
274 | cloning subrepo s/ss from $TESTTMP/t/s/ss (glob) |
|
274 | cloning subrepo s/ss from $TESTTMP/t/s/ss (glob) | |
275 | cloning subrepo t from $TESTTMP/t/t (glob) |
|
275 | cloning subrepo t from $TESTTMP/t/t (glob) | |
276 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
276 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
277 | $ cd tc |
|
277 | $ cd tc | |
278 | $ hg debugsub |
|
278 | $ hg debugsub | |
279 | path s |
|
279 | path s | |
280 | source s |
|
280 | source s | |
281 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 |
|
281 | revision fc627a69481fcbe5f1135069e8a3881c023e4cf5 | |
282 | path t |
|
282 | path t | |
283 | source t |
|
283 | source t | |
284 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e |
|
284 | revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e | |
285 |
|
285 | |||
286 | push |
|
286 | push | |
287 |
|
287 | |||
288 | $ echo bah > t/t |
|
288 | $ echo bah > t/t | |
289 | $ hg ci -m11 |
|
289 | $ hg ci -m11 | |
290 | committing subrepository t |
|
290 | committing subrepository t | |
291 | $ hg push |
|
291 | $ hg push | |
292 | pushing to $TESTTMP/t (glob) |
|
292 | pushing to $TESTTMP/t (glob) | |
293 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
293 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) | |
294 | searching for changes |
|
294 | searching for changes | |
295 | no changes found |
|
295 | no changes found | |
296 | pushing subrepo s to $TESTTMP/t/s (glob) |
|
296 | pushing subrepo s to $TESTTMP/t/s (glob) | |
297 | searching for changes |
|
297 | searching for changes | |
298 | no changes found |
|
298 | no changes found | |
299 | pushing subrepo t to $TESTTMP/t/t (glob) |
|
299 | pushing subrepo t to $TESTTMP/t/t (glob) | |
300 | searching for changes |
|
300 | searching for changes | |
301 | adding changesets |
|
301 | adding changesets | |
302 | adding manifests |
|
302 | adding manifests | |
303 | adding file changes |
|
303 | adding file changes | |
304 | added 1 changesets with 1 changes to 1 files |
|
304 | added 1 changesets with 1 changes to 1 files | |
305 | searching for changes |
|
305 | searching for changes | |
306 | adding changesets |
|
306 | adding changesets | |
307 | adding manifests |
|
307 | adding manifests | |
308 | adding file changes |
|
308 | adding file changes | |
309 | added 1 changesets with 1 changes to 1 files |
|
309 | added 1 changesets with 1 changes to 1 files | |
310 |
|
310 | |||
311 | push -f |
|
311 | push -f | |
312 |
|
312 | |||
313 | $ echo bah > s/a |
|
313 | $ echo bah > s/a | |
314 | $ hg ci -m12 |
|
314 | $ hg ci -m12 | |
315 | committing subrepository s |
|
315 | committing subrepository s | |
316 | $ hg push |
|
316 | $ hg push | |
317 | pushing to $TESTTMP/t (glob) |
|
317 | pushing to $TESTTMP/t (glob) | |
318 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
318 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) | |
319 | searching for changes |
|
319 | searching for changes | |
320 | no changes found |
|
320 | no changes found | |
321 | pushing subrepo s to $TESTTMP/t/s (glob) |
|
321 | pushing subrepo s to $TESTTMP/t/s (glob) | |
322 | searching for changes |
|
322 | searching for changes | |
323 | abort: push creates new remote head 12a213df6fa9! (in subrepo s) |
|
323 | abort: push creates new remote head 12a213df6fa9! (in subrepo s) | |
324 | (did you forget to merge? use push -f to force) |
|
324 | (did you forget to merge? use push -f to force) | |
325 | [255] |
|
325 | [255] | |
326 | $ hg push -f |
|
326 | $ hg push -f | |
327 | pushing to $TESTTMP/t (glob) |
|
327 | pushing to $TESTTMP/t (glob) | |
328 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) |
|
328 | pushing subrepo s/ss to $TESTTMP/t/s/ss (glob) | |
329 | searching for changes |
|
329 | searching for changes | |
330 | no changes found |
|
330 | no changes found | |
331 | pushing subrepo s to $TESTTMP/t/s (glob) |
|
331 | pushing subrepo s to $TESTTMP/t/s (glob) | |
332 | searching for changes |
|
332 | searching for changes | |
333 | adding changesets |
|
333 | adding changesets | |
334 | adding manifests |
|
334 | adding manifests | |
335 | adding file changes |
|
335 | adding file changes | |
336 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
336 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
337 | pushing subrepo t to $TESTTMP/t/t (glob) |
|
337 | pushing subrepo t to $TESTTMP/t/t (glob) | |
338 | searching for changes |
|
338 | searching for changes | |
339 | no changes found |
|
339 | no changes found | |
340 | searching for changes |
|
340 | searching for changes | |
341 | adding changesets |
|
341 | adding changesets | |
342 | adding manifests |
|
342 | adding manifests | |
343 | adding file changes |
|
343 | adding file changes | |
344 | added 1 changesets with 1 changes to 1 files |
|
344 | added 1 changesets with 1 changes to 1 files | |
345 |
|
345 | |||
346 | update |
|
346 | update | |
347 |
|
347 | |||
348 | $ cd ../t |
|
348 | $ cd ../t | |
349 | $ hg up -C # discard our earlier merge |
|
349 | $ hg up -C # discard our earlier merge | |
350 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
350 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
351 | $ echo blah > t/t |
|
351 | $ echo blah > t/t | |
352 | $ hg ci -m13 |
|
352 | $ hg ci -m13 | |
353 | committing subrepository t |
|
353 | committing subrepository t | |
354 |
|
354 | |||
355 | pull |
|
355 | pull | |
356 |
|
356 | |||
357 | $ cd ../tc |
|
357 | $ cd ../tc | |
358 | $ hg pull |
|
358 | $ hg pull | |
359 | pulling from $TESTTMP/t (glob) |
|
359 | pulling from $TESTTMP/t (glob) | |
360 | searching for changes |
|
360 | searching for changes | |
361 | adding changesets |
|
361 | adding changesets | |
362 | adding manifests |
|
362 | adding manifests | |
363 | adding file changes |
|
363 | adding file changes | |
364 | added 1 changesets with 1 changes to 1 files |
|
364 | added 1 changesets with 1 changes to 1 files | |
365 | (run 'hg update' to get a working copy) |
|
365 | (run 'hg update' to get a working copy) | |
366 |
|
366 | |||
367 | should pull t |
|
367 | should pull t | |
368 |
|
368 | |||
369 | $ hg up |
|
369 | $ hg up | |
370 | pulling subrepo t from $TESTTMP/t/t (glob) |
|
370 | pulling subrepo t from $TESTTMP/t/t (glob) | |
371 | searching for changes |
|
371 | searching for changes | |
372 | adding changesets |
|
372 | adding changesets | |
373 | adding manifests |
|
373 | adding manifests | |
374 | adding file changes |
|
374 | adding file changes | |
375 | added 1 changesets with 1 changes to 1 files |
|
375 | added 1 changesets with 1 changes to 1 files | |
376 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
376 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
377 | $ cat t/t |
|
377 | $ cat t/t | |
378 | blah |
|
378 | blah | |
379 |
|
379 | |||
380 | bogus subrepo path aborts |
|
380 | bogus subrepo path aborts | |
381 |
|
381 | |||
382 | $ echo 'bogus=[boguspath' >> .hgsub |
|
382 | $ echo 'bogus=[boguspath' >> .hgsub | |
383 | $ hg ci -m 'bogus subrepo path' |
|
383 | $ hg ci -m 'bogus subrepo path' | |
384 | abort: missing ] in subrepo source |
|
384 | abort: missing ] in subrepo source | |
385 | [255] |
|
385 | [255] | |
386 |
|
386 | |||
387 | Issue1986: merge aborts when trying to merge a subrepo that |
|
387 | Issue1986: merge aborts when trying to merge a subrepo that | |
388 | shouldn't need merging |
|
388 | shouldn't need merging | |
389 |
|
389 | |||
390 | # subrepo layout |
|
390 | # subrepo layout | |
391 | # |
|
391 | # | |
392 | # o 5 br |
|
392 | # o 5 br | |
393 | # /| |
|
393 | # /| | |
394 | # o | 4 default |
|
394 | # o | 4 default | |
395 | # | | |
|
395 | # | | | |
396 | # | o 3 br |
|
396 | # | o 3 br | |
397 | # |/| |
|
397 | # |/| | |
398 | # o | 2 default |
|
398 | # o | 2 default | |
399 | # | | |
|
399 | # | | | |
400 | # | o 1 br |
|
400 | # | o 1 br | |
401 | # |/ |
|
401 | # |/ | |
402 | # o 0 default |
|
402 | # o 0 default | |
403 |
|
403 | |||
404 | $ cd .. |
|
404 | $ cd .. | |
405 | $ rm -rf sub |
|
405 | $ rm -rf sub | |
406 | $ hg init main |
|
406 | $ hg init main | |
407 | $ cd main |
|
407 | $ cd main | |
408 | $ hg init s |
|
408 | $ hg init s | |
409 | $ cd s |
|
409 | $ cd s | |
410 | $ echo a > a |
|
410 | $ echo a > a | |
411 | $ hg ci -Am1 |
|
411 | $ hg ci -Am1 | |
412 | adding a |
|
412 | adding a | |
413 | $ hg branch br |
|
413 | $ hg branch br | |
414 | marked working directory as branch br |
|
414 | marked working directory as branch br | |
415 | (branches are permanent and global, did you want a bookmark?) |
|
415 | (branches are permanent and global, did you want a bookmark?) | |
416 | $ echo a >> a |
|
416 | $ echo a >> a | |
417 | $ hg ci -m1 |
|
417 | $ hg ci -m1 | |
418 | $ hg up default |
|
418 | $ hg up default | |
419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
420 | $ echo b > b |
|
420 | $ echo b > b | |
421 | $ hg ci -Am1 |
|
421 | $ hg ci -Am1 | |
422 | adding b |
|
422 | adding b | |
423 | $ hg up br |
|
423 | $ hg up br | |
424 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
424 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
425 | $ hg merge tip |
|
425 | $ hg merge tip | |
426 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
426 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
427 | (branch merge, don't forget to commit) |
|
427 | (branch merge, don't forget to commit) | |
428 | $ hg ci -m1 |
|
428 | $ hg ci -m1 | |
429 | $ hg up 2 |
|
429 | $ hg up 2 | |
430 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
430 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
431 | $ echo c > c |
|
431 | $ echo c > c | |
432 | $ hg ci -Am1 |
|
432 | $ hg ci -Am1 | |
433 | adding c |
|
433 | adding c | |
434 | $ hg up 3 |
|
434 | $ hg up 3 | |
435 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
435 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
436 | $ hg merge 4 |
|
436 | $ hg merge 4 | |
437 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
437 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
438 | (branch merge, don't forget to commit) |
|
438 | (branch merge, don't forget to commit) | |
439 | $ hg ci -m1 |
|
439 | $ hg ci -m1 | |
440 |
|
440 | |||
441 | # main repo layout: |
|
441 | # main repo layout: | |
442 | # |
|
442 | # | |
443 | # * <-- try to merge default into br again |
|
443 | # * <-- try to merge default into br again | |
444 | # .`| |
|
444 | # .`| | |
445 | # . o 5 br --> substate = 5 |
|
445 | # . o 5 br --> substate = 5 | |
446 | # . | |
|
446 | # . | | |
447 | # o | 4 default --> substate = 4 |
|
447 | # o | 4 default --> substate = 4 | |
448 | # | | |
|
448 | # | | | |
449 | # | o 3 br --> substate = 2 |
|
449 | # | o 3 br --> substate = 2 | |
450 | # |/| |
|
450 | # |/| | |
451 | # o | 2 default --> substate = 2 |
|
451 | # o | 2 default --> substate = 2 | |
452 | # | | |
|
452 | # | | | |
453 | # | o 1 br --> substate = 3 |
|
453 | # | o 1 br --> substate = 3 | |
454 | # |/ |
|
454 | # |/ | |
455 | # o 0 default --> substate = 2 |
|
455 | # o 0 default --> substate = 2 | |
456 |
|
456 | |||
457 | $ cd .. |
|
457 | $ cd .. | |
458 | $ echo 's = s' > .hgsub |
|
458 | $ echo 's = s' > .hgsub | |
459 | $ hg -R s up 2 |
|
459 | $ hg -R s up 2 | |
460 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
460 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
461 | $ hg ci -Am1 |
|
461 | $ hg ci -Am1 | |
462 | adding .hgsub |
|
462 | adding .hgsub | |
463 | $ hg branch br |
|
463 | $ hg branch br | |
464 | marked working directory as branch br |
|
464 | marked working directory as branch br | |
465 | (branches are permanent and global, did you want a bookmark?) |
|
465 | (branches are permanent and global, did you want a bookmark?) | |
466 | $ echo b > b |
|
466 | $ echo b > b | |
467 | $ hg -R s up 3 |
|
467 | $ hg -R s up 3 | |
468 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
468 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
469 | $ hg ci -Am1 |
|
469 | $ hg ci -Am1 | |
470 | adding b |
|
470 | adding b | |
471 | $ hg up default |
|
471 | $ hg up default | |
472 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
472 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
473 | $ echo c > c |
|
473 | $ echo c > c | |
474 | $ hg ci -Am1 |
|
474 | $ hg ci -Am1 | |
475 | adding c |
|
475 | adding c | |
476 | $ hg up 1 |
|
476 | $ hg up 1 | |
477 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
477 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
478 | $ hg merge 2 |
|
478 | $ hg merge 2 | |
479 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
479 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
480 | (branch merge, don't forget to commit) |
|
480 | (branch merge, don't forget to commit) | |
481 | $ hg ci -m1 |
|
481 | $ hg ci -m1 | |
482 | $ hg up 2 |
|
482 | $ hg up 2 | |
483 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
483 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
484 | $ hg -R s up 4 |
|
484 | $ hg -R s up 4 | |
485 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
485 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
486 | $ echo d > d |
|
486 | $ echo d > d | |
487 | $ hg ci -Am1 |
|
487 | $ hg ci -Am1 | |
488 | adding d |
|
488 | adding d | |
489 | $ hg up 3 |
|
489 | $ hg up 3 | |
490 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
490 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
491 | $ hg -R s up 5 |
|
491 | $ hg -R s up 5 | |
492 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
492 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
493 | $ echo e > e |
|
493 | $ echo e > e | |
494 | $ hg ci -Am1 |
|
494 | $ hg ci -Am1 | |
495 | adding e |
|
495 | adding e | |
496 |
|
496 | |||
497 | $ hg up 5 |
|
497 | $ hg up 5 | |
498 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
498 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
499 | $ hg merge 4 # try to merge default into br again |
|
499 | $ hg merge 4 # try to merge default into br again | |
500 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
500 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
501 | (branch merge, don't forget to commit) |
|
501 | (branch merge, don't forget to commit) | |
502 | $ cd .. |
|
502 | $ cd .. | |
503 |
|
503 | |||
504 | test subrepo delete from .hgsubstate |
|
504 | test subrepo delete from .hgsubstate | |
505 |
|
505 | |||
506 | $ hg init testdelete |
|
506 | $ hg init testdelete | |
507 | $ mkdir testdelete/nested testdelete/nested2 |
|
507 | $ mkdir testdelete/nested testdelete/nested2 | |
508 | $ hg init testdelete/nested |
|
508 | $ hg init testdelete/nested | |
509 | $ hg init testdelete/nested2 |
|
509 | $ hg init testdelete/nested2 | |
510 | $ echo test > testdelete/nested/foo |
|
510 | $ echo test > testdelete/nested/foo | |
511 | $ echo test > testdelete/nested2/foo |
|
511 | $ echo test > testdelete/nested2/foo | |
512 | $ hg -R testdelete/nested add |
|
512 | $ hg -R testdelete/nested add | |
513 | adding testdelete/nested/foo (glob) |
|
513 | adding testdelete/nested/foo (glob) | |
514 | $ hg -R testdelete/nested2 add |
|
514 | $ hg -R testdelete/nested2 add | |
515 | adding testdelete/nested2/foo (glob) |
|
515 | adding testdelete/nested2/foo (glob) | |
516 | $ hg -R testdelete/nested ci -m test |
|
516 | $ hg -R testdelete/nested ci -m test | |
517 | $ hg -R testdelete/nested2 ci -m test |
|
517 | $ hg -R testdelete/nested2 ci -m test | |
518 | $ echo nested = nested > testdelete/.hgsub |
|
518 | $ echo nested = nested > testdelete/.hgsub | |
519 | $ echo nested2 = nested2 >> testdelete/.hgsub |
|
519 | $ echo nested2 = nested2 >> testdelete/.hgsub | |
520 | $ hg -R testdelete add |
|
520 | $ hg -R testdelete add | |
521 | adding testdelete/.hgsub (glob) |
|
521 | adding testdelete/.hgsub (glob) | |
522 | $ hg -R testdelete ci -m "nested 1 & 2 added" |
|
522 | $ hg -R testdelete ci -m "nested 1 & 2 added" | |
523 | $ echo nested = nested > testdelete/.hgsub |
|
523 | $ echo nested = nested > testdelete/.hgsub | |
524 | $ hg -R testdelete ci -m "nested 2 deleted" |
|
524 | $ hg -R testdelete ci -m "nested 2 deleted" | |
525 | $ cat testdelete/.hgsubstate |
|
525 | $ cat testdelete/.hgsubstate | |
526 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
526 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested | |
527 | $ hg -R testdelete remove testdelete/.hgsub |
|
527 | $ hg -R testdelete remove testdelete/.hgsub | |
528 | $ hg -R testdelete ci -m ".hgsub deleted" |
|
528 | $ hg -R testdelete ci -m ".hgsub deleted" | |
529 | $ cat testdelete/.hgsubstate |
|
529 | $ cat testdelete/.hgsubstate | |
530 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested |
|
530 | bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested | |
531 |
|
531 | |||
532 | test repository cloning |
|
532 | test repository cloning | |
533 |
|
533 | |||
534 | $ mkdir mercurial mercurial2 |
|
534 | $ mkdir mercurial mercurial2 | |
535 | $ hg init nested_absolute |
|
535 | $ hg init nested_absolute | |
536 | $ echo test > nested_absolute/foo |
|
536 | $ echo test > nested_absolute/foo | |
537 | $ hg -R nested_absolute add |
|
537 | $ hg -R nested_absolute add | |
538 | adding nested_absolute/foo (glob) |
|
538 | adding nested_absolute/foo (glob) | |
539 | $ hg -R nested_absolute ci -mtest |
|
539 | $ hg -R nested_absolute ci -mtest | |
540 | $ cd mercurial |
|
540 | $ cd mercurial | |
541 | $ hg init nested_relative |
|
541 | $ hg init nested_relative | |
542 | $ echo test2 > nested_relative/foo2 |
|
542 | $ echo test2 > nested_relative/foo2 | |
543 | $ hg -R nested_relative add |
|
543 | $ hg -R nested_relative add | |
544 | adding nested_relative/foo2 (glob) |
|
544 | adding nested_relative/foo2 (glob) | |
545 | $ hg -R nested_relative ci -mtest2 |
|
545 | $ hg -R nested_relative ci -mtest2 | |
546 | $ hg init main |
|
546 | $ hg init main | |
547 | $ echo "nested_relative = ../nested_relative" > main/.hgsub |
|
547 | $ echo "nested_relative = ../nested_relative" > main/.hgsub | |
548 | $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub |
|
548 | $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub | |
549 | $ hg -R main add |
|
549 | $ hg -R main add | |
550 | adding main/.hgsub (glob) |
|
550 | adding main/.hgsub (glob) | |
551 | $ hg -R main ci -m "add subrepos" |
|
551 | $ hg -R main ci -m "add subrepos" | |
552 | $ cd .. |
|
552 | $ cd .. | |
553 | $ hg clone mercurial/main mercurial2/main |
|
553 | $ hg clone mercurial/main mercurial2/main | |
554 | updating to branch default |
|
554 | updating to branch default | |
555 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
555 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
556 | $ cat mercurial2/main/nested_absolute/.hg/hgrc \ |
|
556 | $ cat mercurial2/main/nested_absolute/.hg/hgrc \ | |
557 | > mercurial2/main/nested_relative/.hg/hgrc |
|
557 | > mercurial2/main/nested_relative/.hg/hgrc | |
558 | [paths] |
|
558 | [paths] | |
559 | default = $TESTTMP/mercurial/nested_absolute |
|
559 | default = $TESTTMP/mercurial/nested_absolute | |
560 | [paths] |
|
560 | [paths] | |
561 | default = $TESTTMP/mercurial/nested_relative |
|
561 | default = $TESTTMP/mercurial/nested_relative | |
562 | $ rm -rf mercurial mercurial2 |
|
562 | $ rm -rf mercurial mercurial2 | |
563 |
|
563 | |||
564 | Issue1977: multirepo push should fail if subrepo push fails |
|
564 | Issue1977: multirepo push should fail if subrepo push fails | |
565 |
|
565 | |||
566 | $ hg init repo |
|
566 | $ hg init repo | |
567 | $ hg init repo/s |
|
567 | $ hg init repo/s | |
568 | $ echo a > repo/s/a |
|
568 | $ echo a > repo/s/a | |
569 | $ hg -R repo/s ci -Am0 |
|
569 | $ hg -R repo/s ci -Am0 | |
570 | adding a |
|
570 | adding a | |
571 | $ echo s = s > repo/.hgsub |
|
571 | $ echo s = s > repo/.hgsub | |
572 | $ hg -R repo ci -Am1 |
|
572 | $ hg -R repo ci -Am1 | |
573 | adding .hgsub |
|
573 | adding .hgsub | |
574 | $ hg clone repo repo2 |
|
574 | $ hg clone repo repo2 | |
575 | updating to branch default |
|
575 | updating to branch default | |
576 | cloning subrepo s from $TESTTMP/repo/s (glob) |
|
576 | cloning subrepo s from $TESTTMP/repo/s (glob) | |
577 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
577 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
578 | $ hg -q -R repo2 pull -u |
|
578 | $ hg -q -R repo2 pull -u | |
579 | $ echo 1 > repo2/s/a |
|
579 | $ echo 1 > repo2/s/a | |
580 | $ hg -R repo2/s ci -m2 |
|
580 | $ hg -R repo2/s ci -m2 | |
581 | $ hg -q -R repo2/s push |
|
581 | $ hg -q -R repo2/s push | |
582 | $ hg -R repo2/s up -C 0 |
|
582 | $ hg -R repo2/s up -C 0 | |
583 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
583 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
584 | $ echo 2 > repo2/s/b |
|
584 | $ echo 2 > repo2/s/b | |
585 | $ hg -R repo2/s ci -m3 -A |
|
585 | $ hg -R repo2/s ci -m3 -A | |
586 | adding b |
|
586 | adding b | |
587 | created new head |
|
587 | created new head | |
588 | $ hg -R repo2 ci -m3 |
|
588 | $ hg -R repo2 ci -m3 | |
589 | $ hg -q -R repo2 push |
|
589 | $ hg -q -R repo2 push | |
590 | abort: push creates new remote head cc505f09a8b2! (in subrepo s) |
|
590 | abort: push creates new remote head cc505f09a8b2! (in subrepo s) | |
591 | (did you forget to merge? use push -f to force) |
|
591 | (did you forget to merge? use push -f to force) | |
592 | [255] |
|
592 | [255] | |
593 | $ hg -R repo update |
|
593 | $ hg -R repo update | |
594 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
594 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
595 |
|
595 | |||
596 | test if untracked file is not overwritten |
|
596 | test if untracked file is not overwritten | |
597 |
|
597 | |||
598 | $ echo issue3276_ok > repo/s/b |
|
598 | $ echo issue3276_ok > repo/s/b | |
599 | $ hg -R repo2 push -f -q |
|
599 | $ hg -R repo2 push -f -q | |
600 | $ hg -R repo update |
|
600 | $ hg -R repo update | |
601 | b: untracked file differs |
|
601 | b: untracked file differs | |
602 | abort: untracked files in working directory differ from files in requested revision (in subrepo s) |
|
602 | abort: untracked files in working directory differ from files in requested revision (in subrepo s) | |
603 | [255] |
|
603 | [255] | |
604 |
|
604 | |||
605 | $ cat repo/s/b |
|
605 | $ cat repo/s/b | |
606 | issue3276_ok |
|
606 | issue3276_ok | |
607 | $ rm repo/s/b |
|
607 | $ rm repo/s/b | |
608 | $ hg -R repo revert --all |
|
608 | $ hg -R repo revert --all | |
609 | reverting repo/.hgsubstate (glob) |
|
609 | reverting repo/.hgsubstate (glob) | |
610 | reverting subrepo s |
|
610 | reverting subrepo s | |
611 | $ hg -R repo update |
|
611 | $ hg -R repo update | |
612 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
612 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
613 | $ cat repo/s/b |
|
613 | $ cat repo/s/b | |
614 | 2 |
|
614 | 2 | |
615 | $ rm -rf repo2 repo |
|
615 | $ rm -rf repo2 repo | |
616 |
|
616 | |||
617 |
|
617 | |||
618 | Issue1852 subrepos with relative paths always push/pull relative to default |
|
618 | Issue1852 subrepos with relative paths always push/pull relative to default | |
619 |
|
619 | |||
620 | Prepare a repo with subrepo |
|
620 | Prepare a repo with subrepo | |
621 |
|
621 | |||
622 | $ hg init issue1852a |
|
622 | $ hg init issue1852a | |
623 | $ cd issue1852a |
|
623 | $ cd issue1852a | |
624 | $ hg init sub/repo |
|
624 | $ hg init sub/repo | |
625 | $ echo test > sub/repo/foo |
|
625 | $ echo test > sub/repo/foo | |
626 | $ hg -R sub/repo add sub/repo/foo |
|
626 | $ hg -R sub/repo add sub/repo/foo | |
627 | $ echo sub/repo = sub/repo > .hgsub |
|
627 | $ echo sub/repo = sub/repo > .hgsub | |
628 | $ hg add .hgsub |
|
628 | $ hg add .hgsub | |
629 | $ hg ci -mtest |
|
629 | $ hg ci -mtest | |
630 | committing subrepository sub/repo (glob) |
|
630 | committing subrepository sub/repo (glob) | |
631 | $ echo test >> sub/repo/foo |
|
631 | $ echo test >> sub/repo/foo | |
632 | $ hg ci -mtest |
|
632 | $ hg ci -mtest | |
633 | committing subrepository sub/repo (glob) |
|
633 | committing subrepository sub/repo (glob) | |
634 | $ cd .. |
|
634 | $ cd .. | |
635 |
|
635 | |||
636 | Create repo without default path, pull top repo, and see what happens on update |
|
636 | Create repo without default path, pull top repo, and see what happens on update | |
637 |
|
637 | |||
638 | $ hg init issue1852b |
|
638 | $ hg init issue1852b | |
639 | $ hg -R issue1852b pull issue1852a |
|
639 | $ hg -R issue1852b pull issue1852a | |
640 | pulling from issue1852a |
|
640 | pulling from issue1852a | |
641 | requesting all changes |
|
641 | requesting all changes | |
642 | adding changesets |
|
642 | adding changesets | |
643 | adding manifests |
|
643 | adding manifests | |
644 | adding file changes |
|
644 | adding file changes | |
645 | added 2 changesets with 3 changes to 2 files |
|
645 | added 2 changesets with 3 changes to 2 files | |
646 | (run 'hg update' to get a working copy) |
|
646 | (run 'hg update' to get a working copy) | |
647 | $ hg -R issue1852b update |
|
647 | $ hg -R issue1852b update | |
648 | abort: default path for subrepository not found (in subrepo sub/repo) (glob) |
|
648 | abort: default path for subrepository not found (in subrepo sub/repo) (glob) | |
649 | [255] |
|
649 | [255] | |
650 |
|
650 | |||
651 | Pull -u now doesn't help |
|
651 | Pull -u now doesn't help | |
652 |
|
652 | |||
653 | $ hg -R issue1852b pull -u issue1852a |
|
653 | $ hg -R issue1852b pull -u issue1852a | |
654 | pulling from issue1852a |
|
654 | pulling from issue1852a | |
655 | searching for changes |
|
655 | searching for changes | |
656 | no changes found |
|
656 | no changes found | |
657 |
|
657 | |||
658 | Try the same, but with pull -u |
|
658 | Try the same, but with pull -u | |
659 |
|
659 | |||
660 | $ hg init issue1852c |
|
660 | $ hg init issue1852c | |
661 | $ hg -R issue1852c pull -r0 -u issue1852a |
|
661 | $ hg -R issue1852c pull -r0 -u issue1852a | |
662 | pulling from issue1852a |
|
662 | pulling from issue1852a | |
663 | adding changesets |
|
663 | adding changesets | |
664 | adding manifests |
|
664 | adding manifests | |
665 | adding file changes |
|
665 | adding file changes | |
666 | added 1 changesets with 2 changes to 2 files |
|
666 | added 1 changesets with 2 changes to 2 files | |
667 | cloning subrepo sub/repo from issue1852a/sub/repo (glob) |
|
667 | cloning subrepo sub/repo from issue1852a/sub/repo (glob) | |
668 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
668 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
669 |
|
669 | |||
670 | Try to push from the other side |
|
670 | Try to push from the other side | |
671 |
|
671 | |||
672 | $ hg -R issue1852a push `pwd`/issue1852c |
|
672 | $ hg -R issue1852a push `pwd`/issue1852c | |
673 | pushing to $TESTTMP/issue1852c |
|
673 | pushing to $TESTTMP/issue1852c | |
674 | pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob) |
|
674 | pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob) | |
675 | searching for changes |
|
675 | searching for changes | |
676 | no changes found |
|
676 | no changes found | |
677 | searching for changes |
|
677 | searching for changes | |
678 | adding changesets |
|
678 | adding changesets | |
679 | adding manifests |
|
679 | adding manifests | |
680 | adding file changes |
|
680 | adding file changes | |
681 | added 1 changesets with 1 changes to 1 files |
|
681 | added 1 changesets with 1 changes to 1 files | |
682 |
|
682 | |||
683 | Incoming and outgoing should not use the default path: |
|
683 | Incoming and outgoing should not use the default path: | |
684 |
|
684 | |||
685 | $ hg clone -q issue1852a issue1852d |
|
685 | $ hg clone -q issue1852a issue1852d | |
686 | $ hg -R issue1852d outgoing --subrepos issue1852c |
|
686 | $ hg -R issue1852d outgoing --subrepos issue1852c | |
687 | comparing with issue1852c |
|
687 | comparing with issue1852c | |
688 | searching for changes |
|
688 | searching for changes | |
689 | no changes found |
|
689 | no changes found | |
690 | comparing with issue1852c/sub/repo |
|
690 | comparing with issue1852c/sub/repo | |
691 | searching for changes |
|
691 | searching for changes | |
692 | no changes found |
|
692 | no changes found | |
693 | [1] |
|
693 | [1] | |
694 | $ hg -R issue1852d incoming --subrepos issue1852c |
|
694 | $ hg -R issue1852d incoming --subrepos issue1852c | |
695 | comparing with issue1852c |
|
695 | comparing with issue1852c | |
696 | searching for changes |
|
696 | searching for changes | |
697 | no changes found |
|
697 | no changes found | |
698 | comparing with issue1852c/sub/repo |
|
698 | comparing with issue1852c/sub/repo | |
699 | searching for changes |
|
699 | searching for changes | |
700 | no changes found |
|
700 | no changes found | |
701 | [1] |
|
701 | [1] | |
702 |
|
702 | |||
703 | Check status of files when none of them belong to the first |
|
703 | Check status of files when none of them belong to the first | |
704 | subrepository: |
|
704 | subrepository: | |
705 |
|
705 | |||
706 | $ hg init subrepo-status |
|
706 | $ hg init subrepo-status | |
707 | $ cd subrepo-status |
|
707 | $ cd subrepo-status | |
708 | $ hg init subrepo-1 |
|
708 | $ hg init subrepo-1 | |
709 | $ hg init subrepo-2 |
|
709 | $ hg init subrepo-2 | |
710 | $ cd subrepo-2 |
|
710 | $ cd subrepo-2 | |
711 | $ touch file |
|
711 | $ touch file | |
712 | $ hg add file |
|
712 | $ hg add file | |
713 | $ cd .. |
|
713 | $ cd .. | |
714 | $ echo subrepo-1 = subrepo-1 > .hgsub |
|
714 | $ echo subrepo-1 = subrepo-1 > .hgsub | |
715 | $ echo subrepo-2 = subrepo-2 >> .hgsub |
|
715 | $ echo subrepo-2 = subrepo-2 >> .hgsub | |
716 | $ hg add .hgsub |
|
716 | $ hg add .hgsub | |
717 | $ hg ci -m 'Added subrepos' |
|
717 | $ hg ci -m 'Added subrepos' | |
718 | committing subrepository subrepo-2 |
|
718 | committing subrepository subrepo-2 | |
719 | $ hg st subrepo-2/file |
|
719 | $ hg st subrepo-2/file | |
720 |
|
720 | |||
721 | Check that share works with subrepo |
|
721 | Check that share works with subrepo | |
722 | $ hg --config extensions.share= share . ../shared |
|
722 | $ hg --config extensions.share= share . ../shared | |
723 | updating working directory |
|
723 | updating working directory | |
724 | cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2 |
|
724 | cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2 | |
725 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
725 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
726 | $ test -f ../shared/subrepo-1/.hg/sharedpath |
|
726 | $ test -f ../shared/subrepo-1/.hg/sharedpath | |
727 | [1] |
|
727 | [1] | |
728 | $ hg -R ../shared in |
|
728 | $ hg -R ../shared in | |
729 | comparing with $TESTTMP/subrepo-status (glob) |
|
729 | abort: repository default not found! | |
730 | searching for changes |
|
730 | [255] | |
731 | no changes found |
|
|||
732 | [1] |
|
|||
733 | $ hg -R ../shared/subrepo-2 showconfig paths |
|
731 | $ hg -R ../shared/subrepo-2 showconfig paths | |
734 | paths.default=$TESTTMP/subrepo-status/subrepo-2 |
|
732 | paths.default=$TESTTMP/subrepo-status/subrepo-2 | |
735 | $ hg -R ../shared/subrepo-1 sum --remote |
|
733 | $ hg -R ../shared/subrepo-1 sum --remote | |
736 | parent: -1:000000000000 tip (empty repository) |
|
734 | parent: -1:000000000000 tip (empty repository) | |
737 | branch: default |
|
735 | branch: default | |
738 | commit: (clean) |
|
736 | commit: (clean) | |
739 | update: (current) |
|
737 | update: (current) | |
740 | remote: (synced) |
|
738 | remote: (synced) | |
741 |
|
739 | |||
742 | Check hg update --clean |
|
740 | Check hg update --clean | |
743 | $ cd $TESTTMP/t |
|
741 | $ cd $TESTTMP/t | |
744 | $ rm -r t/t.orig |
|
742 | $ rm -r t/t.orig | |
745 | $ hg status -S --all |
|
743 | $ hg status -S --all | |
746 | C .hgsub |
|
744 | C .hgsub | |
747 | C .hgsubstate |
|
745 | C .hgsubstate | |
748 | C a |
|
746 | C a | |
749 | C s/.hgsub |
|
747 | C s/.hgsub | |
750 | C s/.hgsubstate |
|
748 | C s/.hgsubstate | |
751 | C s/a |
|
749 | C s/a | |
752 | C s/ss/a |
|
750 | C s/ss/a | |
753 | C t/t |
|
751 | C t/t | |
754 | $ echo c1 > s/a |
|
752 | $ echo c1 > s/a | |
755 | $ cd s |
|
753 | $ cd s | |
756 | $ echo c1 > b |
|
754 | $ echo c1 > b | |
757 | $ echo c1 > c |
|
755 | $ echo c1 > c | |
758 | $ hg add b |
|
756 | $ hg add b | |
759 | $ cd .. |
|
757 | $ cd .. | |
760 | $ hg status -S |
|
758 | $ hg status -S | |
761 | M s/a |
|
759 | M s/a | |
762 | A s/b |
|
760 | A s/b | |
763 | ? s/c |
|
761 | ? s/c | |
764 | $ hg update -C |
|
762 | $ hg update -C | |
765 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
763 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
766 | $ hg status -S |
|
764 | $ hg status -S | |
767 | ? s/b |
|
765 | ? s/b | |
768 | ? s/c |
|
766 | ? s/c | |
769 |
|
767 | |||
770 | Sticky subrepositories, no changes |
|
768 | Sticky subrepositories, no changes | |
771 | $ cd $TESTTMP/t |
|
769 | $ cd $TESTTMP/t | |
772 | $ hg id |
|
770 | $ hg id | |
773 | 925c17564ef8 tip |
|
771 | 925c17564ef8 tip | |
774 | $ hg -R s id |
|
772 | $ hg -R s id | |
775 | 12a213df6fa9 tip |
|
773 | 12a213df6fa9 tip | |
776 | $ hg -R t id |
|
774 | $ hg -R t id | |
777 | 52c0adc0515a tip |
|
775 | 52c0adc0515a tip | |
778 | $ hg update 11 |
|
776 | $ hg update 11 | |
779 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
777 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
780 | $ hg id |
|
778 | $ hg id | |
781 | 365661e5936a |
|
779 | 365661e5936a | |
782 | $ hg -R s id |
|
780 | $ hg -R s id | |
783 | fc627a69481f |
|
781 | fc627a69481f | |
784 | $ hg -R t id |
|
782 | $ hg -R t id | |
785 | e95bcfa18a35 |
|
783 | e95bcfa18a35 | |
786 |
|
784 | |||
787 | Sticky subrepositorys, file changes |
|
785 | Sticky subrepositorys, file changes | |
788 | $ touch s/f1 |
|
786 | $ touch s/f1 | |
789 | $ touch t/f1 |
|
787 | $ touch t/f1 | |
790 | $ hg add -S s/f1 |
|
788 | $ hg add -S s/f1 | |
791 | $ hg add -S t/f1 |
|
789 | $ hg add -S t/f1 | |
792 | $ hg id |
|
790 | $ hg id | |
793 | 365661e5936a+ |
|
791 | 365661e5936a+ | |
794 | $ hg -R s id |
|
792 | $ hg -R s id | |
795 | fc627a69481f+ |
|
793 | fc627a69481f+ | |
796 | $ hg -R t id |
|
794 | $ hg -R t id | |
797 | e95bcfa18a35+ |
|
795 | e95bcfa18a35+ | |
798 | $ hg update tip |
|
796 | $ hg update tip | |
799 | subrepository sources for s differ |
|
797 | subrepository sources for s differ | |
800 | use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? |
|
798 | use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? | |
801 | l |
|
799 | l | |
802 | subrepository sources for t differ |
|
800 | subrepository sources for t differ | |
803 | use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? |
|
801 | use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? | |
804 | l |
|
802 | l | |
805 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
803 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
806 | $ hg id |
|
804 | $ hg id | |
807 | 925c17564ef8+ tip |
|
805 | 925c17564ef8+ tip | |
808 | $ hg -R s id |
|
806 | $ hg -R s id | |
809 | fc627a69481f+ |
|
807 | fc627a69481f+ | |
810 | $ hg -R t id |
|
808 | $ hg -R t id | |
811 | e95bcfa18a35+ |
|
809 | e95bcfa18a35+ | |
812 | $ hg update --clean tip |
|
810 | $ hg update --clean tip | |
813 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
811 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
814 |
|
812 | |||
815 | Sticky subrepository, revision updates |
|
813 | Sticky subrepository, revision updates | |
816 | $ hg id |
|
814 | $ hg id | |
817 | 925c17564ef8 tip |
|
815 | 925c17564ef8 tip | |
818 | $ hg -R s id |
|
816 | $ hg -R s id | |
819 | 12a213df6fa9 tip |
|
817 | 12a213df6fa9 tip | |
820 | $ hg -R t id |
|
818 | $ hg -R t id | |
821 | 52c0adc0515a tip |
|
819 | 52c0adc0515a tip | |
822 | $ cd s |
|
820 | $ cd s | |
823 | $ hg update -r -2 |
|
821 | $ hg update -r -2 | |
824 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
822 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
825 | $ cd ../t |
|
823 | $ cd ../t | |
826 | $ hg update -r 2 |
|
824 | $ hg update -r 2 | |
827 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
825 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
828 | $ cd .. |
|
826 | $ cd .. | |
829 | $ hg update 10 |
|
827 | $ hg update 10 | |
830 | subrepository sources for t differ (in checked out version) |
|
828 | subrepository sources for t differ (in checked out version) | |
831 | use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? |
|
829 | use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? | |
832 | l |
|
830 | l | |
833 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
831 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
834 | $ hg id |
|
832 | $ hg id | |
835 | e45c8b14af55+ |
|
833 | e45c8b14af55+ | |
836 | $ hg -R s id |
|
834 | $ hg -R s id | |
837 | 02dcf1d70411 |
|
835 | 02dcf1d70411 | |
838 | $ hg -R t id |
|
836 | $ hg -R t id | |
839 | 7af322bc1198 |
|
837 | 7af322bc1198 | |
840 |
|
838 | |||
841 | Sticky subrepository, file changes and revision updates |
|
839 | Sticky subrepository, file changes and revision updates | |
842 | $ touch s/f1 |
|
840 | $ touch s/f1 | |
843 | $ touch t/f1 |
|
841 | $ touch t/f1 | |
844 | $ hg add -S s/f1 |
|
842 | $ hg add -S s/f1 | |
845 | $ hg add -S t/f1 |
|
843 | $ hg add -S t/f1 | |
846 | $ hg id |
|
844 | $ hg id | |
847 | e45c8b14af55+ |
|
845 | e45c8b14af55+ | |
848 | $ hg -R s id |
|
846 | $ hg -R s id | |
849 | 02dcf1d70411+ |
|
847 | 02dcf1d70411+ | |
850 | $ hg -R t id |
|
848 | $ hg -R t id | |
851 | 7af322bc1198+ |
|
849 | 7af322bc1198+ | |
852 | $ hg update tip |
|
850 | $ hg update tip | |
853 | subrepository sources for s differ |
|
851 | subrepository sources for s differ | |
854 | use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? |
|
852 | use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? | |
855 | l |
|
853 | l | |
856 | subrepository sources for t differ |
|
854 | subrepository sources for t differ | |
857 | use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? |
|
855 | use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? | |
858 | l |
|
856 | l | |
859 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
857 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
860 | $ hg id |
|
858 | $ hg id | |
861 | 925c17564ef8+ tip |
|
859 | 925c17564ef8+ tip | |
862 | $ hg -R s id |
|
860 | $ hg -R s id | |
863 | 02dcf1d70411+ |
|
861 | 02dcf1d70411+ | |
864 | $ hg -R t id |
|
862 | $ hg -R t id | |
865 | 7af322bc1198+ |
|
863 | 7af322bc1198+ | |
866 |
|
864 | |||
867 | Sticky repository, update --clean |
|
865 | Sticky repository, update --clean | |
868 | $ hg update --clean tip |
|
866 | $ hg update --clean tip | |
869 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
867 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
870 | $ hg id |
|
868 | $ hg id | |
871 | 925c17564ef8 tip |
|
869 | 925c17564ef8 tip | |
872 | $ hg -R s id |
|
870 | $ hg -R s id | |
873 | 12a213df6fa9 tip |
|
871 | 12a213df6fa9 tip | |
874 | $ hg -R t id |
|
872 | $ hg -R t id | |
875 | 52c0adc0515a tip |
|
873 | 52c0adc0515a tip | |
876 |
|
874 | |||
877 | Test subrepo already at intended revision: |
|
875 | Test subrepo already at intended revision: | |
878 | $ cd s |
|
876 | $ cd s | |
879 | $ hg update fc627a69481f |
|
877 | $ hg update fc627a69481f | |
880 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
878 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
881 | $ cd .. |
|
879 | $ cd .. | |
882 | $ hg update 11 |
|
880 | $ hg update 11 | |
883 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
881 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
884 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
882 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
885 | $ hg id -n |
|
883 | $ hg id -n | |
886 | 11+ |
|
884 | 11+ | |
887 | $ hg -R s id |
|
885 | $ hg -R s id | |
888 | fc627a69481f |
|
886 | fc627a69481f | |
889 | $ hg -R t id |
|
887 | $ hg -R t id | |
890 | e95bcfa18a35 |
|
888 | e95bcfa18a35 | |
891 |
|
889 | |||
892 | Test that removing .hgsubstate doesn't break anything: |
|
890 | Test that removing .hgsubstate doesn't break anything: | |
893 |
|
891 | |||
894 | $ hg rm -f .hgsubstate |
|
892 | $ hg rm -f .hgsubstate | |
895 | $ hg ci -mrm |
|
893 | $ hg ci -mrm | |
896 | nothing changed |
|
894 | nothing changed | |
897 | [1] |
|
895 | [1] | |
898 | $ hg log -vr tip |
|
896 | $ hg log -vr tip | |
899 | changeset: 13:925c17564ef8 |
|
897 | changeset: 13:925c17564ef8 | |
900 | tag: tip |
|
898 | tag: tip | |
901 | user: test |
|
899 | user: test | |
902 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
900 | date: Thu Jan 01 00:00:00 1970 +0000 | |
903 | files: .hgsubstate |
|
901 | files: .hgsubstate | |
904 | description: |
|
902 | description: | |
905 | 13 |
|
903 | 13 | |
906 |
|
904 | |||
907 |
|
905 | |||
908 |
|
906 | |||
909 | Test that removing .hgsub removes .hgsubstate: |
|
907 | Test that removing .hgsub removes .hgsubstate: | |
910 |
|
908 | |||
911 | $ hg rm .hgsub |
|
909 | $ hg rm .hgsub | |
912 | $ hg ci -mrm2 |
|
910 | $ hg ci -mrm2 | |
913 | created new head |
|
911 | created new head | |
914 | $ hg log -vr tip |
|
912 | $ hg log -vr tip | |
915 | changeset: 14:2400bccd50af |
|
913 | changeset: 14:2400bccd50af | |
916 | tag: tip |
|
914 | tag: tip | |
917 | parent: 11:365661e5936a |
|
915 | parent: 11:365661e5936a | |
918 | user: test |
|
916 | user: test | |
919 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
917 | date: Thu Jan 01 00:00:00 1970 +0000 | |
920 | files: .hgsub .hgsubstate |
|
918 | files: .hgsub .hgsubstate | |
921 | description: |
|
919 | description: | |
922 | rm2 |
|
920 | rm2 | |
923 |
|
921 | |||
924 |
|
922 | |||
925 | Test issue3153: diff -S with deleted subrepos |
|
923 | Test issue3153: diff -S with deleted subrepos | |
926 |
|
924 | |||
927 | $ hg diff --nodates -S -c . |
|
925 | $ hg diff --nodates -S -c . | |
928 | diff -r 365661e5936a -r 2400bccd50af .hgsub |
|
926 | diff -r 365661e5936a -r 2400bccd50af .hgsub | |
929 | --- a/.hgsub |
|
927 | --- a/.hgsub | |
930 | +++ /dev/null |
|
928 | +++ /dev/null | |
931 | @@ -1,2 +0,0 @@ |
|
929 | @@ -1,2 +0,0 @@ | |
932 | -s = s |
|
930 | -s = s | |
933 | -t = t |
|
931 | -t = t | |
934 | diff -r 365661e5936a -r 2400bccd50af .hgsubstate |
|
932 | diff -r 365661e5936a -r 2400bccd50af .hgsubstate | |
935 | --- a/.hgsubstate |
|
933 | --- a/.hgsubstate | |
936 | +++ /dev/null |
|
934 | +++ /dev/null | |
937 | @@ -1,2 +0,0 @@ |
|
935 | @@ -1,2 +0,0 @@ | |
938 | -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s |
|
936 | -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s | |
939 | -e95bcfa18a358dc4936da981ebf4147b4cad1362 t |
|
937 | -e95bcfa18a358dc4936da981ebf4147b4cad1362 t | |
940 |
|
938 | |||
941 | Test behavior of add for explicit path in subrepo: |
|
939 | Test behavior of add for explicit path in subrepo: | |
942 | $ cd .. |
|
940 | $ cd .. | |
943 | $ hg init explicit |
|
941 | $ hg init explicit | |
944 | $ cd explicit |
|
942 | $ cd explicit | |
945 | $ echo s = s > .hgsub |
|
943 | $ echo s = s > .hgsub | |
946 | $ hg add .hgsub |
|
944 | $ hg add .hgsub | |
947 | $ hg init s |
|
945 | $ hg init s | |
948 | $ hg ci -m0 |
|
946 | $ hg ci -m0 | |
949 | Adding with an explicit path in a subrepo adds the file |
|
947 | Adding with an explicit path in a subrepo adds the file | |
950 | $ echo c1 > f1 |
|
948 | $ echo c1 > f1 | |
951 | $ echo c2 > s/f2 |
|
949 | $ echo c2 > s/f2 | |
952 | $ hg st -S |
|
950 | $ hg st -S | |
953 | ? f1 |
|
951 | ? f1 | |
954 | ? s/f2 |
|
952 | ? s/f2 | |
955 | $ hg add s/f2 |
|
953 | $ hg add s/f2 | |
956 | $ hg st -S |
|
954 | $ hg st -S | |
957 | A s/f2 |
|
955 | A s/f2 | |
958 | ? f1 |
|
956 | ? f1 | |
959 | $ hg ci -R s -m0 |
|
957 | $ hg ci -R s -m0 | |
960 | $ hg ci -Am1 |
|
958 | $ hg ci -Am1 | |
961 | adding f1 |
|
959 | adding f1 | |
962 | Adding with an explicit path in a subrepo with -S has the same behavior |
|
960 | Adding with an explicit path in a subrepo with -S has the same behavior | |
963 | $ echo c3 > f3 |
|
961 | $ echo c3 > f3 | |
964 | $ echo c4 > s/f4 |
|
962 | $ echo c4 > s/f4 | |
965 | $ hg st -S |
|
963 | $ hg st -S | |
966 | ? f3 |
|
964 | ? f3 | |
967 | ? s/f4 |
|
965 | ? s/f4 | |
968 | $ hg add -S s/f4 |
|
966 | $ hg add -S s/f4 | |
969 | $ hg st -S |
|
967 | $ hg st -S | |
970 | A s/f4 |
|
968 | A s/f4 | |
971 | ? f3 |
|
969 | ? f3 | |
972 | $ hg ci -R s -m1 |
|
970 | $ hg ci -R s -m1 | |
973 | $ hg ci -Ama2 |
|
971 | $ hg ci -Ama2 | |
974 | adding f3 |
|
972 | adding f3 | |
975 | Adding without a path or pattern silently ignores subrepos |
|
973 | Adding without a path or pattern silently ignores subrepos | |
976 | $ echo c5 > f5 |
|
974 | $ echo c5 > f5 | |
977 | $ echo c6 > s/f6 |
|
975 | $ echo c6 > s/f6 | |
978 | $ echo c7 > s/f7 |
|
976 | $ echo c7 > s/f7 | |
979 | $ hg st -S |
|
977 | $ hg st -S | |
980 | ? f5 |
|
978 | ? f5 | |
981 | ? s/f6 |
|
979 | ? s/f6 | |
982 | ? s/f7 |
|
980 | ? s/f7 | |
983 | $ hg add |
|
981 | $ hg add | |
984 | adding f5 |
|
982 | adding f5 | |
985 | $ hg st -S |
|
983 | $ hg st -S | |
986 | A f5 |
|
984 | A f5 | |
987 | ? s/f6 |
|
985 | ? s/f6 | |
988 | ? s/f7 |
|
986 | ? s/f7 | |
989 | $ hg ci -R s -Am2 |
|
987 | $ hg ci -R s -Am2 | |
990 | adding f6 |
|
988 | adding f6 | |
991 | adding f7 |
|
989 | adding f7 | |
992 | $ hg ci -m3 |
|
990 | $ hg ci -m3 | |
993 | Adding without a path or pattern with -S also adds files in subrepos |
|
991 | Adding without a path or pattern with -S also adds files in subrepos | |
994 | $ echo c8 > f8 |
|
992 | $ echo c8 > f8 | |
995 | $ echo c9 > s/f9 |
|
993 | $ echo c9 > s/f9 | |
996 | $ echo c10 > s/f10 |
|
994 | $ echo c10 > s/f10 | |
997 | $ hg st -S |
|
995 | $ hg st -S | |
998 | ? f8 |
|
996 | ? f8 | |
999 | ? s/f10 |
|
997 | ? s/f10 | |
1000 | ? s/f9 |
|
998 | ? s/f9 | |
1001 | $ hg add -S |
|
999 | $ hg add -S | |
1002 | adding f8 |
|
1000 | adding f8 | |
1003 | adding s/f10 (glob) |
|
1001 | adding s/f10 (glob) | |
1004 | adding s/f9 (glob) |
|
1002 | adding s/f9 (glob) | |
1005 | $ hg st -S |
|
1003 | $ hg st -S | |
1006 | A f8 |
|
1004 | A f8 | |
1007 | A s/f10 |
|
1005 | A s/f10 | |
1008 | A s/f9 |
|
1006 | A s/f9 | |
1009 | $ hg ci -R s -m3 |
|
1007 | $ hg ci -R s -m3 | |
1010 | $ hg ci -m4 |
|
1008 | $ hg ci -m4 | |
1011 | Adding with a pattern silently ignores subrepos |
|
1009 | Adding with a pattern silently ignores subrepos | |
1012 | $ echo c11 > fm11 |
|
1010 | $ echo c11 > fm11 | |
1013 | $ echo c12 > fn12 |
|
1011 | $ echo c12 > fn12 | |
1014 | $ echo c13 > s/fm13 |
|
1012 | $ echo c13 > s/fm13 | |
1015 | $ echo c14 > s/fn14 |
|
1013 | $ echo c14 > s/fn14 | |
1016 | $ hg st -S |
|
1014 | $ hg st -S | |
1017 | ? fm11 |
|
1015 | ? fm11 | |
1018 | ? fn12 |
|
1016 | ? fn12 | |
1019 | ? s/fm13 |
|
1017 | ? s/fm13 | |
1020 | ? s/fn14 |
|
1018 | ? s/fn14 | |
1021 | $ hg add 'glob:**fm*' |
|
1019 | $ hg add 'glob:**fm*' | |
1022 | adding fm11 |
|
1020 | adding fm11 | |
1023 | $ hg st -S |
|
1021 | $ hg st -S | |
1024 | A fm11 |
|
1022 | A fm11 | |
1025 | ? fn12 |
|
1023 | ? fn12 | |
1026 | ? s/fm13 |
|
1024 | ? s/fm13 | |
1027 | ? s/fn14 |
|
1025 | ? s/fn14 | |
1028 | $ hg ci -R s -Am4 |
|
1026 | $ hg ci -R s -Am4 | |
1029 | adding fm13 |
|
1027 | adding fm13 | |
1030 | adding fn14 |
|
1028 | adding fn14 | |
1031 | $ hg ci -Am5 |
|
1029 | $ hg ci -Am5 | |
1032 | adding fn12 |
|
1030 | adding fn12 | |
1033 | Adding with a pattern with -S also adds matches in subrepos |
|
1031 | Adding with a pattern with -S also adds matches in subrepos | |
1034 | $ echo c15 > fm15 |
|
1032 | $ echo c15 > fm15 | |
1035 | $ echo c16 > fn16 |
|
1033 | $ echo c16 > fn16 | |
1036 | $ echo c17 > s/fm17 |
|
1034 | $ echo c17 > s/fm17 | |
1037 | $ echo c18 > s/fn18 |
|
1035 | $ echo c18 > s/fn18 | |
1038 | $ hg st -S |
|
1036 | $ hg st -S | |
1039 | ? fm15 |
|
1037 | ? fm15 | |
1040 | ? fn16 |
|
1038 | ? fn16 | |
1041 | ? s/fm17 |
|
1039 | ? s/fm17 | |
1042 | ? s/fn18 |
|
1040 | ? s/fn18 | |
1043 | $ hg add -S 'glob:**fm*' |
|
1041 | $ hg add -S 'glob:**fm*' | |
1044 | adding fm15 |
|
1042 | adding fm15 | |
1045 | adding s/fm17 (glob) |
|
1043 | adding s/fm17 (glob) | |
1046 | $ hg st -S |
|
1044 | $ hg st -S | |
1047 | A fm15 |
|
1045 | A fm15 | |
1048 | A s/fm17 |
|
1046 | A s/fm17 | |
1049 | ? fn16 |
|
1047 | ? fn16 | |
1050 | ? s/fn18 |
|
1048 | ? s/fn18 | |
1051 | $ hg ci -R s -Am5 |
|
1049 | $ hg ci -R s -Am5 | |
1052 | adding fn18 |
|
1050 | adding fn18 | |
1053 | $ hg ci -Am6 |
|
1051 | $ hg ci -Am6 | |
1054 | adding fn16 |
|
1052 | adding fn16 | |
1055 |
|
1053 | |||
1056 | Test behavior of forget for explicit path in subrepo: |
|
1054 | Test behavior of forget for explicit path in subrepo: | |
1057 | Forgetting an explicit path in a subrepo untracks the file |
|
1055 | Forgetting an explicit path in a subrepo untracks the file | |
1058 | $ echo c19 > s/f19 |
|
1056 | $ echo c19 > s/f19 | |
1059 | $ hg add s/f19 |
|
1057 | $ hg add s/f19 | |
1060 | $ hg st -S |
|
1058 | $ hg st -S | |
1061 | A s/f19 |
|
1059 | A s/f19 | |
1062 | $ hg forget s/f19 |
|
1060 | $ hg forget s/f19 | |
1063 | $ hg st -S |
|
1061 | $ hg st -S | |
1064 | ? s/f19 |
|
1062 | ? s/f19 | |
1065 | $ rm s/f19 |
|
1063 | $ rm s/f19 | |
1066 | $ cd .. |
|
1064 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now