##// END OF EJS Templates
context: write dirstate out explicitly after marking files as clean...
FUJIWARA Katsunori -
r25753:fe03f522 default
parent child Browse files
Show More
@@ -1,1919 +1,1923 b''
1 # context.py - changeset and file context objects for mercurial
1 # context.py - changeset and file context objects for mercurial
2 #
2 #
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from node import nullid, nullrev, wdirid, short, hex, bin
8 from node import nullid, nullrev, wdirid, short, hex, bin
9 from i18n import _
9 from i18n import _
10 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
10 import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
11 import match as matchmod
11 import match as matchmod
12 import os, errno, stat
12 import os, errno, stat
13 import obsolete as obsmod
13 import obsolete as obsmod
14 import repoview
14 import repoview
15 import fileset
15 import fileset
16 import revlog
16 import revlog
17
17
18 propertycache = util.propertycache
18 propertycache = util.propertycache
19
19
20 # Phony node value to stand-in for new files in some uses of
20 # Phony node value to stand-in for new files in some uses of
21 # manifests. Manifests support 21-byte hashes for nodes which are
21 # manifests. Manifests support 21-byte hashes for nodes which are
22 # dirty in the working copy.
22 # dirty in the working copy.
23 _newnode = '!' * 21
23 _newnode = '!' * 21
24
24
25 class basectx(object):
25 class basectx(object):
26 """A basectx object represents the common logic for its children:
26 """A basectx object represents the common logic for its children:
27 changectx: read-only context that is already present in the repo,
27 changectx: read-only context that is already present in the repo,
28 workingctx: a context that represents the working directory and can
28 workingctx: a context that represents the working directory and can
29 be committed,
29 be committed,
30 memctx: a context that represents changes in-memory and can also
30 memctx: a context that represents changes in-memory and can also
31 be committed."""
31 be committed."""
32 def __new__(cls, repo, changeid='', *args, **kwargs):
32 def __new__(cls, repo, changeid='', *args, **kwargs):
33 if isinstance(changeid, basectx):
33 if isinstance(changeid, basectx):
34 return changeid
34 return changeid
35
35
36 o = super(basectx, cls).__new__(cls)
36 o = super(basectx, cls).__new__(cls)
37
37
38 o._repo = repo
38 o._repo = repo
39 o._rev = nullrev
39 o._rev = nullrev
40 o._node = nullid
40 o._node = nullid
41
41
42 return o
42 return o
43
43
44 def __str__(self):
44 def __str__(self):
45 return short(self.node())
45 return short(self.node())
46
46
47 def __int__(self):
47 def __int__(self):
48 return self.rev()
48 return self.rev()
49
49
50 def __repr__(self):
50 def __repr__(self):
51 return "<%s %s>" % (type(self).__name__, str(self))
51 return "<%s %s>" % (type(self).__name__, str(self))
52
52
53 def __eq__(self, other):
53 def __eq__(self, other):
54 try:
54 try:
55 return type(self) == type(other) and self._rev == other._rev
55 return type(self) == type(other) and self._rev == other._rev
56 except AttributeError:
56 except AttributeError:
57 return False
57 return False
58
58
59 def __ne__(self, other):
59 def __ne__(self, other):
60 return not (self == other)
60 return not (self == other)
61
61
62 def __contains__(self, key):
62 def __contains__(self, key):
63 return key in self._manifest
63 return key in self._manifest
64
64
65 def __getitem__(self, key):
65 def __getitem__(self, key):
66 return self.filectx(key)
66 return self.filectx(key)
67
67
68 def __iter__(self):
68 def __iter__(self):
69 return iter(self._manifest)
69 return iter(self._manifest)
70
70
71 def _manifestmatches(self, match, s):
71 def _manifestmatches(self, match, s):
72 """generate a new manifest filtered by the match argument
72 """generate a new manifest filtered by the match argument
73
73
74 This method is for internal use only and mainly exists to provide an
74 This method is for internal use only and mainly exists to provide an
75 object oriented way for other contexts to customize the manifest
75 object oriented way for other contexts to customize the manifest
76 generation.
76 generation.
77 """
77 """
78 return self.manifest().matches(match)
78 return self.manifest().matches(match)
79
79
80 def _matchstatus(self, other, match):
80 def _matchstatus(self, other, match):
81 """return match.always if match is none
81 """return match.always if match is none
82
82
83 This internal method provides a way for child objects to override the
83 This internal method provides a way for child objects to override the
84 match operator.
84 match operator.
85 """
85 """
86 return match or matchmod.always(self._repo.root, self._repo.getcwd())
86 return match or matchmod.always(self._repo.root, self._repo.getcwd())
87
87
88 def _buildstatus(self, other, s, match, listignored, listclean,
88 def _buildstatus(self, other, s, match, listignored, listclean,
89 listunknown):
89 listunknown):
90 """build a status with respect to another context"""
90 """build a status with respect to another context"""
91 # Load earliest manifest first for caching reasons. More specifically,
91 # Load earliest manifest first for caching reasons. More specifically,
92 # if you have revisions 1000 and 1001, 1001 is probably stored as a
92 # if you have revisions 1000 and 1001, 1001 is probably stored as a
93 # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
93 # delta against 1000. Thus, if you read 1000 first, we'll reconstruct
94 # 1000 and cache it so that when you read 1001, we just need to apply a
94 # 1000 and cache it so that when you read 1001, we just need to apply a
95 # delta to what's in the cache. So that's one full reconstruction + one
95 # delta to what's in the cache. So that's one full reconstruction + one
96 # delta application.
96 # delta application.
97 if self.rev() is not None and self.rev() < other.rev():
97 if self.rev() is not None and self.rev() < other.rev():
98 self.manifest()
98 self.manifest()
99 mf1 = other._manifestmatches(match, s)
99 mf1 = other._manifestmatches(match, s)
100 mf2 = self._manifestmatches(match, s)
100 mf2 = self._manifestmatches(match, s)
101
101
102 modified, added = [], []
102 modified, added = [], []
103 removed = []
103 removed = []
104 clean = []
104 clean = []
105 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
105 deleted, unknown, ignored = s.deleted, s.unknown, s.ignored
106 deletedset = set(deleted)
106 deletedset = set(deleted)
107 d = mf1.diff(mf2, clean=listclean)
107 d = mf1.diff(mf2, clean=listclean)
108 for fn, value in d.iteritems():
108 for fn, value in d.iteritems():
109 if fn in deletedset:
109 if fn in deletedset:
110 continue
110 continue
111 if value is None:
111 if value is None:
112 clean.append(fn)
112 clean.append(fn)
113 continue
113 continue
114 (node1, flag1), (node2, flag2) = value
114 (node1, flag1), (node2, flag2) = value
115 if node1 is None:
115 if node1 is None:
116 added.append(fn)
116 added.append(fn)
117 elif node2 is None:
117 elif node2 is None:
118 removed.append(fn)
118 removed.append(fn)
119 elif node2 != _newnode:
119 elif node2 != _newnode:
120 # The file was not a new file in mf2, so an entry
120 # The file was not a new file in mf2, so an entry
121 # from diff is really a difference.
121 # from diff is really a difference.
122 modified.append(fn)
122 modified.append(fn)
123 elif self[fn].cmp(other[fn]):
123 elif self[fn].cmp(other[fn]):
124 # node2 was newnode, but the working file doesn't
124 # node2 was newnode, but the working file doesn't
125 # match the one in mf1.
125 # match the one in mf1.
126 modified.append(fn)
126 modified.append(fn)
127 else:
127 else:
128 clean.append(fn)
128 clean.append(fn)
129
129
130 if removed:
130 if removed:
131 # need to filter files if they are already reported as removed
131 # need to filter files if they are already reported as removed
132 unknown = [fn for fn in unknown if fn not in mf1]
132 unknown = [fn for fn in unknown if fn not in mf1]
133 ignored = [fn for fn in ignored if fn not in mf1]
133 ignored = [fn for fn in ignored if fn not in mf1]
134 # if they're deleted, don't report them as removed
134 # if they're deleted, don't report them as removed
135 removed = [fn for fn in removed if fn not in deletedset]
135 removed = [fn for fn in removed if fn not in deletedset]
136
136
137 return scmutil.status(modified, added, removed, deleted, unknown,
137 return scmutil.status(modified, added, removed, deleted, unknown,
138 ignored, clean)
138 ignored, clean)
139
139
140 @propertycache
140 @propertycache
141 def substate(self):
141 def substate(self):
142 return subrepo.state(self, self._repo.ui)
142 return subrepo.state(self, self._repo.ui)
143
143
144 def subrev(self, subpath):
144 def subrev(self, subpath):
145 return self.substate[subpath][1]
145 return self.substate[subpath][1]
146
146
147 def rev(self):
147 def rev(self):
148 return self._rev
148 return self._rev
149 def node(self):
149 def node(self):
150 return self._node
150 return self._node
151 def hex(self):
151 def hex(self):
152 return hex(self.node())
152 return hex(self.node())
153 def manifest(self):
153 def manifest(self):
154 return self._manifest
154 return self._manifest
155 def repo(self):
155 def repo(self):
156 return self._repo
156 return self._repo
157 def phasestr(self):
157 def phasestr(self):
158 return phases.phasenames[self.phase()]
158 return phases.phasenames[self.phase()]
159 def mutable(self):
159 def mutable(self):
160 return self.phase() > phases.public
160 return self.phase() > phases.public
161
161
162 def getfileset(self, expr):
162 def getfileset(self, expr):
163 return fileset.getfileset(self, expr)
163 return fileset.getfileset(self, expr)
164
164
165 def obsolete(self):
165 def obsolete(self):
166 """True if the changeset is obsolete"""
166 """True if the changeset is obsolete"""
167 return self.rev() in obsmod.getrevs(self._repo, 'obsolete')
167 return self.rev() in obsmod.getrevs(self._repo, 'obsolete')
168
168
169 def extinct(self):
169 def extinct(self):
170 """True if the changeset is extinct"""
170 """True if the changeset is extinct"""
171 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
171 return self.rev() in obsmod.getrevs(self._repo, 'extinct')
172
172
173 def unstable(self):
173 def unstable(self):
174 """True if the changeset is not obsolete but it's ancestor are"""
174 """True if the changeset is not obsolete but it's ancestor are"""
175 return self.rev() in obsmod.getrevs(self._repo, 'unstable')
175 return self.rev() in obsmod.getrevs(self._repo, 'unstable')
176
176
177 def bumped(self):
177 def bumped(self):
178 """True if the changeset try to be a successor of a public changeset
178 """True if the changeset try to be a successor of a public changeset
179
179
180 Only non-public and non-obsolete changesets may be bumped.
180 Only non-public and non-obsolete changesets may be bumped.
181 """
181 """
182 return self.rev() in obsmod.getrevs(self._repo, 'bumped')
182 return self.rev() in obsmod.getrevs(self._repo, 'bumped')
183
183
184 def divergent(self):
184 def divergent(self):
185 """Is a successors of a changeset with multiple possible successors set
185 """Is a successors of a changeset with multiple possible successors set
186
186
187 Only non-public and non-obsolete changesets may be divergent.
187 Only non-public and non-obsolete changesets may be divergent.
188 """
188 """
189 return self.rev() in obsmod.getrevs(self._repo, 'divergent')
189 return self.rev() in obsmod.getrevs(self._repo, 'divergent')
190
190
191 def troubled(self):
191 def troubled(self):
192 """True if the changeset is either unstable, bumped or divergent"""
192 """True if the changeset is either unstable, bumped or divergent"""
193 return self.unstable() or self.bumped() or self.divergent()
193 return self.unstable() or self.bumped() or self.divergent()
194
194
195 def troubles(self):
195 def troubles(self):
196 """return the list of troubles affecting this changesets.
196 """return the list of troubles affecting this changesets.
197
197
198 Troubles are returned as strings. possible values are:
198 Troubles are returned as strings. possible values are:
199 - unstable,
199 - unstable,
200 - bumped,
200 - bumped,
201 - divergent.
201 - divergent.
202 """
202 """
203 troubles = []
203 troubles = []
204 if self.unstable():
204 if self.unstable():
205 troubles.append('unstable')
205 troubles.append('unstable')
206 if self.bumped():
206 if self.bumped():
207 troubles.append('bumped')
207 troubles.append('bumped')
208 if self.divergent():
208 if self.divergent():
209 troubles.append('divergent')
209 troubles.append('divergent')
210 return troubles
210 return troubles
211
211
212 def parents(self):
212 def parents(self):
213 """return contexts for each parent changeset"""
213 """return contexts for each parent changeset"""
214 return self._parents
214 return self._parents
215
215
216 def p1(self):
216 def p1(self):
217 return self._parents[0]
217 return self._parents[0]
218
218
219 def p2(self):
219 def p2(self):
220 if len(self._parents) == 2:
220 if len(self._parents) == 2:
221 return self._parents[1]
221 return self._parents[1]
222 return changectx(self._repo, -1)
222 return changectx(self._repo, -1)
223
223
224 def _fileinfo(self, path):
224 def _fileinfo(self, path):
225 if '_manifest' in self.__dict__:
225 if '_manifest' in self.__dict__:
226 try:
226 try:
227 return self._manifest[path], self._manifest.flags(path)
227 return self._manifest[path], self._manifest.flags(path)
228 except KeyError:
228 except KeyError:
229 raise error.ManifestLookupError(self._node, path,
229 raise error.ManifestLookupError(self._node, path,
230 _('not found in manifest'))
230 _('not found in manifest'))
231 if '_manifestdelta' in self.__dict__ or path in self.files():
231 if '_manifestdelta' in self.__dict__ or path in self.files():
232 if path in self._manifestdelta:
232 if path in self._manifestdelta:
233 return (self._manifestdelta[path],
233 return (self._manifestdelta[path],
234 self._manifestdelta.flags(path))
234 self._manifestdelta.flags(path))
235 node, flag = self._repo.manifest.find(self._changeset[0], path)
235 node, flag = self._repo.manifest.find(self._changeset[0], path)
236 if not node:
236 if not node:
237 raise error.ManifestLookupError(self._node, path,
237 raise error.ManifestLookupError(self._node, path,
238 _('not found in manifest'))
238 _('not found in manifest'))
239
239
240 return node, flag
240 return node, flag
241
241
242 def filenode(self, path):
242 def filenode(self, path):
243 return self._fileinfo(path)[0]
243 return self._fileinfo(path)[0]
244
244
245 def flags(self, path):
245 def flags(self, path):
246 try:
246 try:
247 return self._fileinfo(path)[1]
247 return self._fileinfo(path)[1]
248 except error.LookupError:
248 except error.LookupError:
249 return ''
249 return ''
250
250
251 def sub(self, path):
251 def sub(self, path):
252 '''return a subrepo for the stored revision of path, never wdir()'''
252 '''return a subrepo for the stored revision of path, never wdir()'''
253 return subrepo.subrepo(self, path)
253 return subrepo.subrepo(self, path)
254
254
255 def nullsub(self, path, pctx):
255 def nullsub(self, path, pctx):
256 return subrepo.nullsubrepo(self, path, pctx)
256 return subrepo.nullsubrepo(self, path, pctx)
257
257
258 def workingsub(self, path):
258 def workingsub(self, path):
259 '''return a subrepo for the stored revision, or wdir if this is a wdir
259 '''return a subrepo for the stored revision, or wdir if this is a wdir
260 context.
260 context.
261 '''
261 '''
262 return subrepo.subrepo(self, path, allowwdir=True)
262 return subrepo.subrepo(self, path, allowwdir=True)
263
263
264 def match(self, pats=[], include=None, exclude=None, default='glob',
264 def match(self, pats=[], include=None, exclude=None, default='glob',
265 listsubrepos=False, badfn=None):
265 listsubrepos=False, badfn=None):
266 r = self._repo
266 r = self._repo
267 return matchmod.match(r.root, r.getcwd(), pats,
267 return matchmod.match(r.root, r.getcwd(), pats,
268 include, exclude, default,
268 include, exclude, default,
269 auditor=r.auditor, ctx=self,
269 auditor=r.auditor, ctx=self,
270 listsubrepos=listsubrepos, badfn=badfn)
270 listsubrepos=listsubrepos, badfn=badfn)
271
271
272 def diff(self, ctx2=None, match=None, **opts):
272 def diff(self, ctx2=None, match=None, **opts):
273 """Returns a diff generator for the given contexts and matcher"""
273 """Returns a diff generator for the given contexts and matcher"""
274 if ctx2 is None:
274 if ctx2 is None:
275 ctx2 = self.p1()
275 ctx2 = self.p1()
276 if ctx2 is not None:
276 if ctx2 is not None:
277 ctx2 = self._repo[ctx2]
277 ctx2 = self._repo[ctx2]
278 diffopts = patch.diffopts(self._repo.ui, opts)
278 diffopts = patch.diffopts(self._repo.ui, opts)
279 return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts)
279 return patch.diff(self._repo, ctx2, self, match=match, opts=diffopts)
280
280
281 def dirs(self):
281 def dirs(self):
282 return self._manifest.dirs()
282 return self._manifest.dirs()
283
283
284 def hasdir(self, dir):
284 def hasdir(self, dir):
285 return self._manifest.hasdir(dir)
285 return self._manifest.hasdir(dir)
286
286
287 def dirty(self, missing=False, merge=True, branch=True):
287 def dirty(self, missing=False, merge=True, branch=True):
288 return False
288 return False
289
289
290 def status(self, other=None, match=None, listignored=False,
290 def status(self, other=None, match=None, listignored=False,
291 listclean=False, listunknown=False, listsubrepos=False):
291 listclean=False, listunknown=False, listsubrepos=False):
292 """return status of files between two nodes or node and working
292 """return status of files between two nodes or node and working
293 directory.
293 directory.
294
294
295 If other is None, compare this node with working directory.
295 If other is None, compare this node with working directory.
296
296
297 returns (modified, added, removed, deleted, unknown, ignored, clean)
297 returns (modified, added, removed, deleted, unknown, ignored, clean)
298 """
298 """
299
299
300 ctx1 = self
300 ctx1 = self
301 ctx2 = self._repo[other]
301 ctx2 = self._repo[other]
302
302
303 # This next code block is, admittedly, fragile logic that tests for
303 # This next code block is, admittedly, fragile logic that tests for
304 # reversing the contexts and wouldn't need to exist if it weren't for
304 # reversing the contexts and wouldn't need to exist if it weren't for
305 # the fast (and common) code path of comparing the working directory
305 # the fast (and common) code path of comparing the working directory
306 # with its first parent.
306 # with its first parent.
307 #
307 #
308 # What we're aiming for here is the ability to call:
308 # What we're aiming for here is the ability to call:
309 #
309 #
310 # workingctx.status(parentctx)
310 # workingctx.status(parentctx)
311 #
311 #
312 # If we always built the manifest for each context and compared those,
312 # If we always built the manifest for each context and compared those,
313 # then we'd be done. But the special case of the above call means we
313 # then we'd be done. But the special case of the above call means we
314 # just copy the manifest of the parent.
314 # just copy the manifest of the parent.
315 reversed = False
315 reversed = False
316 if (not isinstance(ctx1, changectx)
316 if (not isinstance(ctx1, changectx)
317 and isinstance(ctx2, changectx)):
317 and isinstance(ctx2, changectx)):
318 reversed = True
318 reversed = True
319 ctx1, ctx2 = ctx2, ctx1
319 ctx1, ctx2 = ctx2, ctx1
320
320
321 match = ctx2._matchstatus(ctx1, match)
321 match = ctx2._matchstatus(ctx1, match)
322 r = scmutil.status([], [], [], [], [], [], [])
322 r = scmutil.status([], [], [], [], [], [], [])
323 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
323 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
324 listunknown)
324 listunknown)
325
325
326 if reversed:
326 if reversed:
327 # Reverse added and removed. Clear deleted, unknown and ignored as
327 # Reverse added and removed. Clear deleted, unknown and ignored as
328 # these make no sense to reverse.
328 # these make no sense to reverse.
329 r = scmutil.status(r.modified, r.removed, r.added, [], [], [],
329 r = scmutil.status(r.modified, r.removed, r.added, [], [], [],
330 r.clean)
330 r.clean)
331
331
332 if listsubrepos:
332 if listsubrepos:
333 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
333 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
334 rev2 = ctx2.subrev(subpath)
334 rev2 = ctx2.subrev(subpath)
335 try:
335 try:
336 submatch = matchmod.narrowmatcher(subpath, match)
336 submatch = matchmod.narrowmatcher(subpath, match)
337 s = sub.status(rev2, match=submatch, ignored=listignored,
337 s = sub.status(rev2, match=submatch, ignored=listignored,
338 clean=listclean, unknown=listunknown,
338 clean=listclean, unknown=listunknown,
339 listsubrepos=True)
339 listsubrepos=True)
340 for rfiles, sfiles in zip(r, s):
340 for rfiles, sfiles in zip(r, s):
341 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles)
341 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles)
342 except error.LookupError:
342 except error.LookupError:
343 self._repo.ui.status(_("skipping missing "
343 self._repo.ui.status(_("skipping missing "
344 "subrepository: %s\n") % subpath)
344 "subrepository: %s\n") % subpath)
345
345
346 for l in r:
346 for l in r:
347 l.sort()
347 l.sort()
348
348
349 return r
349 return r
350
350
351
351
352 def makememctx(repo, parents, text, user, date, branch, files, store,
352 def makememctx(repo, parents, text, user, date, branch, files, store,
353 editor=None, extra=None):
353 editor=None, extra=None):
354 def getfilectx(repo, memctx, path):
354 def getfilectx(repo, memctx, path):
355 data, mode, copied = store.getfile(path)
355 data, mode, copied = store.getfile(path)
356 if data is None:
356 if data is None:
357 return None
357 return None
358 islink, isexec = mode
358 islink, isexec = mode
359 return memfilectx(repo, path, data, islink=islink, isexec=isexec,
359 return memfilectx(repo, path, data, islink=islink, isexec=isexec,
360 copied=copied, memctx=memctx)
360 copied=copied, memctx=memctx)
361 if extra is None:
361 if extra is None:
362 extra = {}
362 extra = {}
363 if branch:
363 if branch:
364 extra['branch'] = encoding.fromlocal(branch)
364 extra['branch'] = encoding.fromlocal(branch)
365 ctx = memctx(repo, parents, text, files, getfilectx, user,
365 ctx = memctx(repo, parents, text, files, getfilectx, user,
366 date, extra, editor)
366 date, extra, editor)
367 return ctx
367 return ctx
368
368
369 class changectx(basectx):
369 class changectx(basectx):
370 """A changecontext object makes access to data related to a particular
370 """A changecontext object makes access to data related to a particular
371 changeset convenient. It represents a read-only context already present in
371 changeset convenient. It represents a read-only context already present in
372 the repo."""
372 the repo."""
373 def __init__(self, repo, changeid=''):
373 def __init__(self, repo, changeid=''):
374 """changeid is a revision number, node, or tag"""
374 """changeid is a revision number, node, or tag"""
375
375
376 # since basectx.__new__ already took care of copying the object, we
376 # since basectx.__new__ already took care of copying the object, we
377 # don't need to do anything in __init__, so we just exit here
377 # don't need to do anything in __init__, so we just exit here
378 if isinstance(changeid, basectx):
378 if isinstance(changeid, basectx):
379 return
379 return
380
380
381 if changeid == '':
381 if changeid == '':
382 changeid = '.'
382 changeid = '.'
383 self._repo = repo
383 self._repo = repo
384
384
385 try:
385 try:
386 if isinstance(changeid, int):
386 if isinstance(changeid, int):
387 self._node = repo.changelog.node(changeid)
387 self._node = repo.changelog.node(changeid)
388 self._rev = changeid
388 self._rev = changeid
389 return
389 return
390 if isinstance(changeid, long):
390 if isinstance(changeid, long):
391 changeid = str(changeid)
391 changeid = str(changeid)
392 if changeid == 'null':
392 if changeid == 'null':
393 self._node = nullid
393 self._node = nullid
394 self._rev = nullrev
394 self._rev = nullrev
395 return
395 return
396 if changeid == 'tip':
396 if changeid == 'tip':
397 self._node = repo.changelog.tip()
397 self._node = repo.changelog.tip()
398 self._rev = repo.changelog.rev(self._node)
398 self._rev = repo.changelog.rev(self._node)
399 return
399 return
400 if changeid == '.' or changeid == repo.dirstate.p1():
400 if changeid == '.' or changeid == repo.dirstate.p1():
401 # this is a hack to delay/avoid loading obsmarkers
401 # this is a hack to delay/avoid loading obsmarkers
402 # when we know that '.' won't be hidden
402 # when we know that '.' won't be hidden
403 self._node = repo.dirstate.p1()
403 self._node = repo.dirstate.p1()
404 self._rev = repo.unfiltered().changelog.rev(self._node)
404 self._rev = repo.unfiltered().changelog.rev(self._node)
405 return
405 return
406 if len(changeid) == 20:
406 if len(changeid) == 20:
407 try:
407 try:
408 self._node = changeid
408 self._node = changeid
409 self._rev = repo.changelog.rev(changeid)
409 self._rev = repo.changelog.rev(changeid)
410 return
410 return
411 except error.FilteredRepoLookupError:
411 except error.FilteredRepoLookupError:
412 raise
412 raise
413 except LookupError:
413 except LookupError:
414 pass
414 pass
415
415
416 try:
416 try:
417 r = int(changeid)
417 r = int(changeid)
418 if str(r) != changeid:
418 if str(r) != changeid:
419 raise ValueError
419 raise ValueError
420 l = len(repo.changelog)
420 l = len(repo.changelog)
421 if r < 0:
421 if r < 0:
422 r += l
422 r += l
423 if r < 0 or r >= l:
423 if r < 0 or r >= l:
424 raise ValueError
424 raise ValueError
425 self._rev = r
425 self._rev = r
426 self._node = repo.changelog.node(r)
426 self._node = repo.changelog.node(r)
427 return
427 return
428 except error.FilteredIndexError:
428 except error.FilteredIndexError:
429 raise
429 raise
430 except (ValueError, OverflowError, IndexError):
430 except (ValueError, OverflowError, IndexError):
431 pass
431 pass
432
432
433 if len(changeid) == 40:
433 if len(changeid) == 40:
434 try:
434 try:
435 self._node = bin(changeid)
435 self._node = bin(changeid)
436 self._rev = repo.changelog.rev(self._node)
436 self._rev = repo.changelog.rev(self._node)
437 return
437 return
438 except error.FilteredLookupError:
438 except error.FilteredLookupError:
439 raise
439 raise
440 except (TypeError, LookupError):
440 except (TypeError, LookupError):
441 pass
441 pass
442
442
443 # lookup bookmarks through the name interface
443 # lookup bookmarks through the name interface
444 try:
444 try:
445 self._node = repo.names.singlenode(repo, changeid)
445 self._node = repo.names.singlenode(repo, changeid)
446 self._rev = repo.changelog.rev(self._node)
446 self._rev = repo.changelog.rev(self._node)
447 return
447 return
448 except KeyError:
448 except KeyError:
449 pass
449 pass
450 except error.FilteredRepoLookupError:
450 except error.FilteredRepoLookupError:
451 raise
451 raise
452 except error.RepoLookupError:
452 except error.RepoLookupError:
453 pass
453 pass
454
454
455 self._node = repo.unfiltered().changelog._partialmatch(changeid)
455 self._node = repo.unfiltered().changelog._partialmatch(changeid)
456 if self._node is not None:
456 if self._node is not None:
457 self._rev = repo.changelog.rev(self._node)
457 self._rev = repo.changelog.rev(self._node)
458 return
458 return
459
459
460 # lookup failed
460 # lookup failed
461 # check if it might have come from damaged dirstate
461 # check if it might have come from damaged dirstate
462 #
462 #
463 # XXX we could avoid the unfiltered if we had a recognizable
463 # XXX we could avoid the unfiltered if we had a recognizable
464 # exception for filtered changeset access
464 # exception for filtered changeset access
465 if changeid in repo.unfiltered().dirstate.parents():
465 if changeid in repo.unfiltered().dirstate.parents():
466 msg = _("working directory has unknown parent '%s'!")
466 msg = _("working directory has unknown parent '%s'!")
467 raise error.Abort(msg % short(changeid))
467 raise error.Abort(msg % short(changeid))
468 try:
468 try:
469 if len(changeid) == 20:
469 if len(changeid) == 20:
470 changeid = hex(changeid)
470 changeid = hex(changeid)
471 except TypeError:
471 except TypeError:
472 pass
472 pass
473 except (error.FilteredIndexError, error.FilteredLookupError,
473 except (error.FilteredIndexError, error.FilteredLookupError,
474 error.FilteredRepoLookupError):
474 error.FilteredRepoLookupError):
475 if repo.filtername.startswith('visible'):
475 if repo.filtername.startswith('visible'):
476 msg = _("hidden revision '%s'") % changeid
476 msg = _("hidden revision '%s'") % changeid
477 hint = _('use --hidden to access hidden revisions')
477 hint = _('use --hidden to access hidden revisions')
478 raise error.FilteredRepoLookupError(msg, hint=hint)
478 raise error.FilteredRepoLookupError(msg, hint=hint)
479 msg = _("filtered revision '%s' (not in '%s' subset)")
479 msg = _("filtered revision '%s' (not in '%s' subset)")
480 msg %= (changeid, repo.filtername)
480 msg %= (changeid, repo.filtername)
481 raise error.FilteredRepoLookupError(msg)
481 raise error.FilteredRepoLookupError(msg)
482 except IndexError:
482 except IndexError:
483 pass
483 pass
484 raise error.RepoLookupError(
484 raise error.RepoLookupError(
485 _("unknown revision '%s'") % changeid)
485 _("unknown revision '%s'") % changeid)
486
486
487 def __hash__(self):
487 def __hash__(self):
488 try:
488 try:
489 return hash(self._rev)
489 return hash(self._rev)
490 except AttributeError:
490 except AttributeError:
491 return id(self)
491 return id(self)
492
492
493 def __nonzero__(self):
493 def __nonzero__(self):
494 return self._rev != nullrev
494 return self._rev != nullrev
495
495
496 @propertycache
496 @propertycache
497 def _changeset(self):
497 def _changeset(self):
498 return self._repo.changelog.read(self.rev())
498 return self._repo.changelog.read(self.rev())
499
499
500 @propertycache
500 @propertycache
501 def _manifest(self):
501 def _manifest(self):
502 return self._repo.manifest.read(self._changeset[0])
502 return self._repo.manifest.read(self._changeset[0])
503
503
504 @propertycache
504 @propertycache
505 def _manifestdelta(self):
505 def _manifestdelta(self):
506 return self._repo.manifest.readdelta(self._changeset[0])
506 return self._repo.manifest.readdelta(self._changeset[0])
507
507
508 @propertycache
508 @propertycache
509 def _parents(self):
509 def _parents(self):
510 p = self._repo.changelog.parentrevs(self._rev)
510 p = self._repo.changelog.parentrevs(self._rev)
511 if p[1] == nullrev:
511 if p[1] == nullrev:
512 p = p[:-1]
512 p = p[:-1]
513 return [changectx(self._repo, x) for x in p]
513 return [changectx(self._repo, x) for x in p]
514
514
515 def changeset(self):
515 def changeset(self):
516 return self._changeset
516 return self._changeset
517 def manifestnode(self):
517 def manifestnode(self):
518 return self._changeset[0]
518 return self._changeset[0]
519
519
520 def user(self):
520 def user(self):
521 return self._changeset[1]
521 return self._changeset[1]
522 def date(self):
522 def date(self):
523 return self._changeset[2]
523 return self._changeset[2]
524 def files(self):
524 def files(self):
525 return self._changeset[3]
525 return self._changeset[3]
526 def description(self):
526 def description(self):
527 return self._changeset[4]
527 return self._changeset[4]
528 def branch(self):
528 def branch(self):
529 return encoding.tolocal(self._changeset[5].get("branch"))
529 return encoding.tolocal(self._changeset[5].get("branch"))
530 def closesbranch(self):
530 def closesbranch(self):
531 return 'close' in self._changeset[5]
531 return 'close' in self._changeset[5]
532 def extra(self):
532 def extra(self):
533 return self._changeset[5]
533 return self._changeset[5]
534 def tags(self):
534 def tags(self):
535 return self._repo.nodetags(self._node)
535 return self._repo.nodetags(self._node)
536 def bookmarks(self):
536 def bookmarks(self):
537 return self._repo.nodebookmarks(self._node)
537 return self._repo.nodebookmarks(self._node)
538 def phase(self):
538 def phase(self):
539 return self._repo._phasecache.phase(self._repo, self._rev)
539 return self._repo._phasecache.phase(self._repo, self._rev)
540 def hidden(self):
540 def hidden(self):
541 return self._rev in repoview.filterrevs(self._repo, 'visible')
541 return self._rev in repoview.filterrevs(self._repo, 'visible')
542
542
543 def children(self):
543 def children(self):
544 """return contexts for each child changeset"""
544 """return contexts for each child changeset"""
545 c = self._repo.changelog.children(self._node)
545 c = self._repo.changelog.children(self._node)
546 return [changectx(self._repo, x) for x in c]
546 return [changectx(self._repo, x) for x in c]
547
547
548 def ancestors(self):
548 def ancestors(self):
549 for a in self._repo.changelog.ancestors([self._rev]):
549 for a in self._repo.changelog.ancestors([self._rev]):
550 yield changectx(self._repo, a)
550 yield changectx(self._repo, a)
551
551
552 def descendants(self):
552 def descendants(self):
553 for d in self._repo.changelog.descendants([self._rev]):
553 for d in self._repo.changelog.descendants([self._rev]):
554 yield changectx(self._repo, d)
554 yield changectx(self._repo, d)
555
555
556 def filectx(self, path, fileid=None, filelog=None):
556 def filectx(self, path, fileid=None, filelog=None):
557 """get a file context from this changeset"""
557 """get a file context from this changeset"""
558 if fileid is None:
558 if fileid is None:
559 fileid = self.filenode(path)
559 fileid = self.filenode(path)
560 return filectx(self._repo, path, fileid=fileid,
560 return filectx(self._repo, path, fileid=fileid,
561 changectx=self, filelog=filelog)
561 changectx=self, filelog=filelog)
562
562
563 def ancestor(self, c2, warn=False):
563 def ancestor(self, c2, warn=False):
564 """return the "best" ancestor context of self and c2
564 """return the "best" ancestor context of self and c2
565
565
566 If there are multiple candidates, it will show a message and check
566 If there are multiple candidates, it will show a message and check
567 merge.preferancestor configuration before falling back to the
567 merge.preferancestor configuration before falling back to the
568 revlog ancestor."""
568 revlog ancestor."""
569 # deal with workingctxs
569 # deal with workingctxs
570 n2 = c2._node
570 n2 = c2._node
571 if n2 is None:
571 if n2 is None:
572 n2 = c2._parents[0]._node
572 n2 = c2._parents[0]._node
573 cahs = self._repo.changelog.commonancestorsheads(self._node, n2)
573 cahs = self._repo.changelog.commonancestorsheads(self._node, n2)
574 if not cahs:
574 if not cahs:
575 anc = nullid
575 anc = nullid
576 elif len(cahs) == 1:
576 elif len(cahs) == 1:
577 anc = cahs[0]
577 anc = cahs[0]
578 else:
578 else:
579 for r in self._repo.ui.configlist('merge', 'preferancestor'):
579 for r in self._repo.ui.configlist('merge', 'preferancestor'):
580 try:
580 try:
581 ctx = changectx(self._repo, r)
581 ctx = changectx(self._repo, r)
582 except error.RepoLookupError:
582 except error.RepoLookupError:
583 continue
583 continue
584 anc = ctx.node()
584 anc = ctx.node()
585 if anc in cahs:
585 if anc in cahs:
586 break
586 break
587 else:
587 else:
588 anc = self._repo.changelog.ancestor(self._node, n2)
588 anc = self._repo.changelog.ancestor(self._node, n2)
589 if warn:
589 if warn:
590 self._repo.ui.status(
590 self._repo.ui.status(
591 (_("note: using %s as ancestor of %s and %s\n") %
591 (_("note: using %s as ancestor of %s and %s\n") %
592 (short(anc), short(self._node), short(n2))) +
592 (short(anc), short(self._node), short(n2))) +
593 ''.join(_(" alternatively, use --config "
593 ''.join(_(" alternatively, use --config "
594 "merge.preferancestor=%s\n") %
594 "merge.preferancestor=%s\n") %
595 short(n) for n in sorted(cahs) if n != anc))
595 short(n) for n in sorted(cahs) if n != anc))
596 return changectx(self._repo, anc)
596 return changectx(self._repo, anc)
597
597
598 def descendant(self, other):
598 def descendant(self, other):
599 """True if other is descendant of this changeset"""
599 """True if other is descendant of this changeset"""
600 return self._repo.changelog.descendant(self._rev, other._rev)
600 return self._repo.changelog.descendant(self._rev, other._rev)
601
601
602 def walk(self, match):
602 def walk(self, match):
603 '''Generates matching file names.'''
603 '''Generates matching file names.'''
604
604
605 # Wrap match.bad method to have message with nodeid
605 # Wrap match.bad method to have message with nodeid
606 def bad(fn, msg):
606 def bad(fn, msg):
607 # The manifest doesn't know about subrepos, so don't complain about
607 # The manifest doesn't know about subrepos, so don't complain about
608 # paths into valid subrepos.
608 # paths into valid subrepos.
609 if any(fn == s or fn.startswith(s + '/')
609 if any(fn == s or fn.startswith(s + '/')
610 for s in self.substate):
610 for s in self.substate):
611 return
611 return
612 match.bad(fn, _('no such file in rev %s') % self)
612 match.bad(fn, _('no such file in rev %s') % self)
613
613
614 m = matchmod.badmatch(match, bad)
614 m = matchmod.badmatch(match, bad)
615 return self._manifest.walk(m)
615 return self._manifest.walk(m)
616
616
617 def matches(self, match):
617 def matches(self, match):
618 return self.walk(match)
618 return self.walk(match)
619
619
620 class basefilectx(object):
620 class basefilectx(object):
621 """A filecontext object represents the common logic for its children:
621 """A filecontext object represents the common logic for its children:
622 filectx: read-only access to a filerevision that is already present
622 filectx: read-only access to a filerevision that is already present
623 in the repo,
623 in the repo,
624 workingfilectx: a filecontext that represents files from the working
624 workingfilectx: a filecontext that represents files from the working
625 directory,
625 directory,
626 memfilectx: a filecontext that represents files in-memory."""
626 memfilectx: a filecontext that represents files in-memory."""
627 def __new__(cls, repo, path, *args, **kwargs):
627 def __new__(cls, repo, path, *args, **kwargs):
628 return super(basefilectx, cls).__new__(cls)
628 return super(basefilectx, cls).__new__(cls)
629
629
630 @propertycache
630 @propertycache
631 def _filelog(self):
631 def _filelog(self):
632 return self._repo.file(self._path)
632 return self._repo.file(self._path)
633
633
634 @propertycache
634 @propertycache
635 def _changeid(self):
635 def _changeid(self):
636 if '_changeid' in self.__dict__:
636 if '_changeid' in self.__dict__:
637 return self._changeid
637 return self._changeid
638 elif '_changectx' in self.__dict__:
638 elif '_changectx' in self.__dict__:
639 return self._changectx.rev()
639 return self._changectx.rev()
640 elif '_descendantrev' in self.__dict__:
640 elif '_descendantrev' in self.__dict__:
641 # this file context was created from a revision with a known
641 # this file context was created from a revision with a known
642 # descendant, we can (lazily) correct for linkrev aliases
642 # descendant, we can (lazily) correct for linkrev aliases
643 return self._adjustlinkrev(self._path, self._filelog,
643 return self._adjustlinkrev(self._path, self._filelog,
644 self._filenode, self._descendantrev)
644 self._filenode, self._descendantrev)
645 else:
645 else:
646 return self._filelog.linkrev(self._filerev)
646 return self._filelog.linkrev(self._filerev)
647
647
648 @propertycache
648 @propertycache
649 def _filenode(self):
649 def _filenode(self):
650 if '_fileid' in self.__dict__:
650 if '_fileid' in self.__dict__:
651 return self._filelog.lookup(self._fileid)
651 return self._filelog.lookup(self._fileid)
652 else:
652 else:
653 return self._changectx.filenode(self._path)
653 return self._changectx.filenode(self._path)
654
654
655 @propertycache
655 @propertycache
656 def _filerev(self):
656 def _filerev(self):
657 return self._filelog.rev(self._filenode)
657 return self._filelog.rev(self._filenode)
658
658
659 @propertycache
659 @propertycache
660 def _repopath(self):
660 def _repopath(self):
661 return self._path
661 return self._path
662
662
663 def __nonzero__(self):
663 def __nonzero__(self):
664 try:
664 try:
665 self._filenode
665 self._filenode
666 return True
666 return True
667 except error.LookupError:
667 except error.LookupError:
668 # file is missing
668 # file is missing
669 return False
669 return False
670
670
671 def __str__(self):
671 def __str__(self):
672 return "%s@%s" % (self.path(), self._changectx)
672 return "%s@%s" % (self.path(), self._changectx)
673
673
674 def __repr__(self):
674 def __repr__(self):
675 return "<%s %s>" % (type(self).__name__, str(self))
675 return "<%s %s>" % (type(self).__name__, str(self))
676
676
677 def __hash__(self):
677 def __hash__(self):
678 try:
678 try:
679 return hash((self._path, self._filenode))
679 return hash((self._path, self._filenode))
680 except AttributeError:
680 except AttributeError:
681 return id(self)
681 return id(self)
682
682
683 def __eq__(self, other):
683 def __eq__(self, other):
684 try:
684 try:
685 return (type(self) == type(other) and self._path == other._path
685 return (type(self) == type(other) and self._path == other._path
686 and self._filenode == other._filenode)
686 and self._filenode == other._filenode)
687 except AttributeError:
687 except AttributeError:
688 return False
688 return False
689
689
690 def __ne__(self, other):
690 def __ne__(self, other):
691 return not (self == other)
691 return not (self == other)
692
692
693 def filerev(self):
693 def filerev(self):
694 return self._filerev
694 return self._filerev
695 def filenode(self):
695 def filenode(self):
696 return self._filenode
696 return self._filenode
697 def flags(self):
697 def flags(self):
698 return self._changectx.flags(self._path)
698 return self._changectx.flags(self._path)
699 def filelog(self):
699 def filelog(self):
700 return self._filelog
700 return self._filelog
701 def rev(self):
701 def rev(self):
702 return self._changeid
702 return self._changeid
703 def linkrev(self):
703 def linkrev(self):
704 return self._filelog.linkrev(self._filerev)
704 return self._filelog.linkrev(self._filerev)
705 def node(self):
705 def node(self):
706 return self._changectx.node()
706 return self._changectx.node()
707 def hex(self):
707 def hex(self):
708 return self._changectx.hex()
708 return self._changectx.hex()
709 def user(self):
709 def user(self):
710 return self._changectx.user()
710 return self._changectx.user()
711 def date(self):
711 def date(self):
712 return self._changectx.date()
712 return self._changectx.date()
713 def files(self):
713 def files(self):
714 return self._changectx.files()
714 return self._changectx.files()
715 def description(self):
715 def description(self):
716 return self._changectx.description()
716 return self._changectx.description()
717 def branch(self):
717 def branch(self):
718 return self._changectx.branch()
718 return self._changectx.branch()
719 def extra(self):
719 def extra(self):
720 return self._changectx.extra()
720 return self._changectx.extra()
721 def phase(self):
721 def phase(self):
722 return self._changectx.phase()
722 return self._changectx.phase()
723 def phasestr(self):
723 def phasestr(self):
724 return self._changectx.phasestr()
724 return self._changectx.phasestr()
725 def manifest(self):
725 def manifest(self):
726 return self._changectx.manifest()
726 return self._changectx.manifest()
727 def changectx(self):
727 def changectx(self):
728 return self._changectx
728 return self._changectx
729 def repo(self):
729 def repo(self):
730 return self._repo
730 return self._repo
731
731
732 def path(self):
732 def path(self):
733 return self._path
733 return self._path
734
734
735 def isbinary(self):
735 def isbinary(self):
736 try:
736 try:
737 return util.binary(self.data())
737 return util.binary(self.data())
738 except IOError:
738 except IOError:
739 return False
739 return False
740 def isexec(self):
740 def isexec(self):
741 return 'x' in self.flags()
741 return 'x' in self.flags()
742 def islink(self):
742 def islink(self):
743 return 'l' in self.flags()
743 return 'l' in self.flags()
744
744
745 def cmp(self, fctx):
745 def cmp(self, fctx):
746 """compare with other file context
746 """compare with other file context
747
747
748 returns True if different than fctx.
748 returns True if different than fctx.
749 """
749 """
750 if (fctx._filerev is None
750 if (fctx._filerev is None
751 and (self._repo._encodefilterpats
751 and (self._repo._encodefilterpats
752 # if file data starts with '\1\n', empty metadata block is
752 # if file data starts with '\1\n', empty metadata block is
753 # prepended, which adds 4 bytes to filelog.size().
753 # prepended, which adds 4 bytes to filelog.size().
754 or self.size() - 4 == fctx.size())
754 or self.size() - 4 == fctx.size())
755 or self.size() == fctx.size()):
755 or self.size() == fctx.size()):
756 return self._filelog.cmp(self._filenode, fctx.data())
756 return self._filelog.cmp(self._filenode, fctx.data())
757
757
758 return True
758 return True
759
759
760 def _adjustlinkrev(self, path, filelog, fnode, srcrev, inclusive=False):
760 def _adjustlinkrev(self, path, filelog, fnode, srcrev, inclusive=False):
761 """return the first ancestor of <srcrev> introducing <fnode>
761 """return the first ancestor of <srcrev> introducing <fnode>
762
762
763 If the linkrev of the file revision does not point to an ancestor of
763 If the linkrev of the file revision does not point to an ancestor of
764 srcrev, we'll walk down the ancestors until we find one introducing
764 srcrev, we'll walk down the ancestors until we find one introducing
765 this file revision.
765 this file revision.
766
766
767 :repo: a localrepository object (used to access changelog and manifest)
767 :repo: a localrepository object (used to access changelog and manifest)
768 :path: the file path
768 :path: the file path
769 :fnode: the nodeid of the file revision
769 :fnode: the nodeid of the file revision
770 :filelog: the filelog of this path
770 :filelog: the filelog of this path
771 :srcrev: the changeset revision we search ancestors from
771 :srcrev: the changeset revision we search ancestors from
772 :inclusive: if true, the src revision will also be checked
772 :inclusive: if true, the src revision will also be checked
773 """
773 """
774 repo = self._repo
774 repo = self._repo
775 cl = repo.unfiltered().changelog
775 cl = repo.unfiltered().changelog
776 ma = repo.manifest
776 ma = repo.manifest
777 # fetch the linkrev
777 # fetch the linkrev
778 fr = filelog.rev(fnode)
778 fr = filelog.rev(fnode)
779 lkr = filelog.linkrev(fr)
779 lkr = filelog.linkrev(fr)
780 # hack to reuse ancestor computation when searching for renames
780 # hack to reuse ancestor computation when searching for renames
781 memberanc = getattr(self, '_ancestrycontext', None)
781 memberanc = getattr(self, '_ancestrycontext', None)
782 iteranc = None
782 iteranc = None
783 if srcrev is None:
783 if srcrev is None:
784 # wctx case, used by workingfilectx during mergecopy
784 # wctx case, used by workingfilectx during mergecopy
785 revs = [p.rev() for p in self._repo[None].parents()]
785 revs = [p.rev() for p in self._repo[None].parents()]
786 inclusive = True # we skipped the real (revless) source
786 inclusive = True # we skipped the real (revless) source
787 else:
787 else:
788 revs = [srcrev]
788 revs = [srcrev]
789 if memberanc is None:
789 if memberanc is None:
790 memberanc = iteranc = cl.ancestors(revs, lkr,
790 memberanc = iteranc = cl.ancestors(revs, lkr,
791 inclusive=inclusive)
791 inclusive=inclusive)
792 # check if this linkrev is an ancestor of srcrev
792 # check if this linkrev is an ancestor of srcrev
793 if lkr not in memberanc:
793 if lkr not in memberanc:
794 if iteranc is None:
794 if iteranc is None:
795 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
795 iteranc = cl.ancestors(revs, lkr, inclusive=inclusive)
796 for a in iteranc:
796 for a in iteranc:
797 ac = cl.read(a) # get changeset data (we avoid object creation)
797 ac = cl.read(a) # get changeset data (we avoid object creation)
798 if path in ac[3]: # checking the 'files' field.
798 if path in ac[3]: # checking the 'files' field.
799 # The file has been touched, check if the content is
799 # The file has been touched, check if the content is
800 # similar to the one we search for.
800 # similar to the one we search for.
801 if fnode == ma.readfast(ac[0]).get(path):
801 if fnode == ma.readfast(ac[0]).get(path):
802 return a
802 return a
803 # In theory, we should never get out of that loop without a result.
803 # In theory, we should never get out of that loop without a result.
804 # But if manifest uses a buggy file revision (not children of the
804 # But if manifest uses a buggy file revision (not children of the
805 # one it replaces) we could. Such a buggy situation will likely
805 # one it replaces) we could. Such a buggy situation will likely
806 # result is crash somewhere else at to some point.
806 # result is crash somewhere else at to some point.
807 return lkr
807 return lkr
808
808
809 def introrev(self):
809 def introrev(self):
810 """return the rev of the changeset which introduced this file revision
810 """return the rev of the changeset which introduced this file revision
811
811
812 This method is different from linkrev because it take into account the
812 This method is different from linkrev because it take into account the
813 changeset the filectx was created from. It ensures the returned
813 changeset the filectx was created from. It ensures the returned
814 revision is one of its ancestors. This prevents bugs from
814 revision is one of its ancestors. This prevents bugs from
815 'linkrev-shadowing' when a file revision is used by multiple
815 'linkrev-shadowing' when a file revision is used by multiple
816 changesets.
816 changesets.
817 """
817 """
818 lkr = self.linkrev()
818 lkr = self.linkrev()
819 attrs = vars(self)
819 attrs = vars(self)
820 noctx = not ('_changeid' in attrs or '_changectx' in attrs)
820 noctx = not ('_changeid' in attrs or '_changectx' in attrs)
821 if noctx or self.rev() == lkr:
821 if noctx or self.rev() == lkr:
822 return self.linkrev()
822 return self.linkrev()
823 return self._adjustlinkrev(self._path, self._filelog, self._filenode,
823 return self._adjustlinkrev(self._path, self._filelog, self._filenode,
824 self.rev(), inclusive=True)
824 self.rev(), inclusive=True)
825
825
826 def _parentfilectx(self, path, fileid, filelog):
826 def _parentfilectx(self, path, fileid, filelog):
827 """create parent filectx keeping ancestry info for _adjustlinkrev()"""
827 """create parent filectx keeping ancestry info for _adjustlinkrev()"""
828 fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
828 fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog)
829 if '_changeid' in vars(self) or '_changectx' in vars(self):
829 if '_changeid' in vars(self) or '_changectx' in vars(self):
830 # If self is associated with a changeset (probably explicitly
830 # If self is associated with a changeset (probably explicitly
831 # fed), ensure the created filectx is associated with a
831 # fed), ensure the created filectx is associated with a
832 # changeset that is an ancestor of self.changectx.
832 # changeset that is an ancestor of self.changectx.
833 # This lets us later use _adjustlinkrev to get a correct link.
833 # This lets us later use _adjustlinkrev to get a correct link.
834 fctx._descendantrev = self.rev()
834 fctx._descendantrev = self.rev()
835 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
835 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
836 elif '_descendantrev' in vars(self):
836 elif '_descendantrev' in vars(self):
837 # Otherwise propagate _descendantrev if we have one associated.
837 # Otherwise propagate _descendantrev if we have one associated.
838 fctx._descendantrev = self._descendantrev
838 fctx._descendantrev = self._descendantrev
839 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
839 fctx._ancestrycontext = getattr(self, '_ancestrycontext', None)
840 return fctx
840 return fctx
841
841
842 def parents(self):
842 def parents(self):
843 _path = self._path
843 _path = self._path
844 fl = self._filelog
844 fl = self._filelog
845 parents = self._filelog.parents(self._filenode)
845 parents = self._filelog.parents(self._filenode)
846 pl = [(_path, node, fl) for node in parents if node != nullid]
846 pl = [(_path, node, fl) for node in parents if node != nullid]
847
847
848 r = fl.renamed(self._filenode)
848 r = fl.renamed(self._filenode)
849 if r:
849 if r:
850 # - In the simple rename case, both parent are nullid, pl is empty.
850 # - In the simple rename case, both parent are nullid, pl is empty.
851 # - In case of merge, only one of the parent is null id and should
851 # - In case of merge, only one of the parent is null id and should
852 # be replaced with the rename information. This parent is -always-
852 # be replaced with the rename information. This parent is -always-
853 # the first one.
853 # the first one.
854 #
854 #
855 # As null id have always been filtered out in the previous list
855 # As null id have always been filtered out in the previous list
856 # comprehension, inserting to 0 will always result in "replacing
856 # comprehension, inserting to 0 will always result in "replacing
857 # first nullid parent with rename information.
857 # first nullid parent with rename information.
858 pl.insert(0, (r[0], r[1], self._repo.file(r[0])))
858 pl.insert(0, (r[0], r[1], self._repo.file(r[0])))
859
859
860 return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl]
860 return [self._parentfilectx(path, fnode, l) for path, fnode, l in pl]
861
861
862 def p1(self):
862 def p1(self):
863 return self.parents()[0]
863 return self.parents()[0]
864
864
865 def p2(self):
865 def p2(self):
866 p = self.parents()
866 p = self.parents()
867 if len(p) == 2:
867 if len(p) == 2:
868 return p[1]
868 return p[1]
869 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
869 return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
870
870
871 def annotate(self, follow=False, linenumber=None, diffopts=None):
871 def annotate(self, follow=False, linenumber=None, diffopts=None):
872 '''returns a list of tuples of (ctx, line) for each line
872 '''returns a list of tuples of (ctx, line) for each line
873 in the file, where ctx is the filectx of the node where
873 in the file, where ctx is the filectx of the node where
874 that line was last changed.
874 that line was last changed.
875 This returns tuples of ((ctx, linenumber), line) for each line,
875 This returns tuples of ((ctx, linenumber), line) for each line,
876 if "linenumber" parameter is NOT "None".
876 if "linenumber" parameter is NOT "None".
877 In such tuples, linenumber means one at the first appearance
877 In such tuples, linenumber means one at the first appearance
878 in the managed file.
878 in the managed file.
879 To reduce annotation cost,
879 To reduce annotation cost,
880 this returns fixed value(False is used) as linenumber,
880 this returns fixed value(False is used) as linenumber,
881 if "linenumber" parameter is "False".'''
881 if "linenumber" parameter is "False".'''
882
882
883 if linenumber is None:
883 if linenumber is None:
884 def decorate(text, rev):
884 def decorate(text, rev):
885 return ([rev] * len(text.splitlines()), text)
885 return ([rev] * len(text.splitlines()), text)
886 elif linenumber:
886 elif linenumber:
887 def decorate(text, rev):
887 def decorate(text, rev):
888 size = len(text.splitlines())
888 size = len(text.splitlines())
889 return ([(rev, i) for i in xrange(1, size + 1)], text)
889 return ([(rev, i) for i in xrange(1, size + 1)], text)
890 else:
890 else:
891 def decorate(text, rev):
891 def decorate(text, rev):
892 return ([(rev, False)] * len(text.splitlines()), text)
892 return ([(rev, False)] * len(text.splitlines()), text)
893
893
894 def pair(parent, child):
894 def pair(parent, child):
895 blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts,
895 blocks = mdiff.allblocks(parent[1], child[1], opts=diffopts,
896 refine=True)
896 refine=True)
897 for (a1, a2, b1, b2), t in blocks:
897 for (a1, a2, b1, b2), t in blocks:
898 # Changed blocks ('!') or blocks made only of blank lines ('~')
898 # Changed blocks ('!') or blocks made only of blank lines ('~')
899 # belong to the child.
899 # belong to the child.
900 if t == '=':
900 if t == '=':
901 child[0][b1:b2] = parent[0][a1:a2]
901 child[0][b1:b2] = parent[0][a1:a2]
902 return child
902 return child
903
903
904 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
904 getlog = util.lrucachefunc(lambda x: self._repo.file(x))
905
905
906 def parents(f):
906 def parents(f):
907 # Cut _descendantrev here to mitigate the penalty of lazy linkrev
907 # Cut _descendantrev here to mitigate the penalty of lazy linkrev
908 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog
908 # adjustment. Otherwise, p._adjustlinkrev() would walk changelog
909 # from the topmost introrev (= srcrev) down to p.linkrev() if it
909 # from the topmost introrev (= srcrev) down to p.linkrev() if it
910 # isn't an ancestor of the srcrev.
910 # isn't an ancestor of the srcrev.
911 f._changeid
911 f._changeid
912 pl = f.parents()
912 pl = f.parents()
913
913
914 # Don't return renamed parents if we aren't following.
914 # Don't return renamed parents if we aren't following.
915 if not follow:
915 if not follow:
916 pl = [p for p in pl if p.path() == f.path()]
916 pl = [p for p in pl if p.path() == f.path()]
917
917
918 # renamed filectx won't have a filelog yet, so set it
918 # renamed filectx won't have a filelog yet, so set it
919 # from the cache to save time
919 # from the cache to save time
920 for p in pl:
920 for p in pl:
921 if not '_filelog' in p.__dict__:
921 if not '_filelog' in p.__dict__:
922 p._filelog = getlog(p.path())
922 p._filelog = getlog(p.path())
923
923
924 return pl
924 return pl
925
925
926 # use linkrev to find the first changeset where self appeared
926 # use linkrev to find the first changeset where self appeared
927 base = self
927 base = self
928 introrev = self.introrev()
928 introrev = self.introrev()
929 if self.rev() != introrev:
929 if self.rev() != introrev:
930 base = self.filectx(self.filenode(), changeid=introrev)
930 base = self.filectx(self.filenode(), changeid=introrev)
931 if getattr(base, '_ancestrycontext', None) is None:
931 if getattr(base, '_ancestrycontext', None) is None:
932 cl = self._repo.changelog
932 cl = self._repo.changelog
933 if introrev is None:
933 if introrev is None:
934 # wctx is not inclusive, but works because _ancestrycontext
934 # wctx is not inclusive, but works because _ancestrycontext
935 # is used to test filelog revisions
935 # is used to test filelog revisions
936 ac = cl.ancestors([p.rev() for p in base.parents()],
936 ac = cl.ancestors([p.rev() for p in base.parents()],
937 inclusive=True)
937 inclusive=True)
938 else:
938 else:
939 ac = cl.ancestors([introrev], inclusive=True)
939 ac = cl.ancestors([introrev], inclusive=True)
940 base._ancestrycontext = ac
940 base._ancestrycontext = ac
941
941
942 # This algorithm would prefer to be recursive, but Python is a
942 # This algorithm would prefer to be recursive, but Python is a
943 # bit recursion-hostile. Instead we do an iterative
943 # bit recursion-hostile. Instead we do an iterative
944 # depth-first search.
944 # depth-first search.
945
945
946 visit = [base]
946 visit = [base]
947 hist = {}
947 hist = {}
948 pcache = {}
948 pcache = {}
949 needed = {base: 1}
949 needed = {base: 1}
950 while visit:
950 while visit:
951 f = visit[-1]
951 f = visit[-1]
952 pcached = f in pcache
952 pcached = f in pcache
953 if not pcached:
953 if not pcached:
954 pcache[f] = parents(f)
954 pcache[f] = parents(f)
955
955
956 ready = True
956 ready = True
957 pl = pcache[f]
957 pl = pcache[f]
958 for p in pl:
958 for p in pl:
959 if p not in hist:
959 if p not in hist:
960 ready = False
960 ready = False
961 visit.append(p)
961 visit.append(p)
962 if not pcached:
962 if not pcached:
963 needed[p] = needed.get(p, 0) + 1
963 needed[p] = needed.get(p, 0) + 1
964 if ready:
964 if ready:
965 visit.pop()
965 visit.pop()
966 reusable = f in hist
966 reusable = f in hist
967 if reusable:
967 if reusable:
968 curr = hist[f]
968 curr = hist[f]
969 else:
969 else:
970 curr = decorate(f.data(), f)
970 curr = decorate(f.data(), f)
971 for p in pl:
971 for p in pl:
972 if not reusable:
972 if not reusable:
973 curr = pair(hist[p], curr)
973 curr = pair(hist[p], curr)
974 if needed[p] == 1:
974 if needed[p] == 1:
975 del hist[p]
975 del hist[p]
976 del needed[p]
976 del needed[p]
977 else:
977 else:
978 needed[p] -= 1
978 needed[p] -= 1
979
979
980 hist[f] = curr
980 hist[f] = curr
981 pcache[f] = []
981 pcache[f] = []
982
982
983 return zip(hist[base][0], hist[base][1].splitlines(True))
983 return zip(hist[base][0], hist[base][1].splitlines(True))
984
984
985 def ancestors(self, followfirst=False):
985 def ancestors(self, followfirst=False):
986 visit = {}
986 visit = {}
987 c = self
987 c = self
988 if followfirst:
988 if followfirst:
989 cut = 1
989 cut = 1
990 else:
990 else:
991 cut = None
991 cut = None
992
992
993 while True:
993 while True:
994 for parent in c.parents()[:cut]:
994 for parent in c.parents()[:cut]:
995 visit[(parent.linkrev(), parent.filenode())] = parent
995 visit[(parent.linkrev(), parent.filenode())] = parent
996 if not visit:
996 if not visit:
997 break
997 break
998 c = visit.pop(max(visit))
998 c = visit.pop(max(visit))
999 yield c
999 yield c
1000
1000
1001 class filectx(basefilectx):
1001 class filectx(basefilectx):
1002 """A filecontext object makes access to data related to a particular
1002 """A filecontext object makes access to data related to a particular
1003 filerevision convenient."""
1003 filerevision convenient."""
1004 def __init__(self, repo, path, changeid=None, fileid=None,
1004 def __init__(self, repo, path, changeid=None, fileid=None,
1005 filelog=None, changectx=None):
1005 filelog=None, changectx=None):
1006 """changeid can be a changeset revision, node, or tag.
1006 """changeid can be a changeset revision, node, or tag.
1007 fileid can be a file revision or node."""
1007 fileid can be a file revision or node."""
1008 self._repo = repo
1008 self._repo = repo
1009 self._path = path
1009 self._path = path
1010
1010
1011 assert (changeid is not None
1011 assert (changeid is not None
1012 or fileid is not None
1012 or fileid is not None
1013 or changectx is not None), \
1013 or changectx is not None), \
1014 ("bad args: changeid=%r, fileid=%r, changectx=%r"
1014 ("bad args: changeid=%r, fileid=%r, changectx=%r"
1015 % (changeid, fileid, changectx))
1015 % (changeid, fileid, changectx))
1016
1016
1017 if filelog is not None:
1017 if filelog is not None:
1018 self._filelog = filelog
1018 self._filelog = filelog
1019
1019
1020 if changeid is not None:
1020 if changeid is not None:
1021 self._changeid = changeid
1021 self._changeid = changeid
1022 if changectx is not None:
1022 if changectx is not None:
1023 self._changectx = changectx
1023 self._changectx = changectx
1024 if fileid is not None:
1024 if fileid is not None:
1025 self._fileid = fileid
1025 self._fileid = fileid
1026
1026
1027 @propertycache
1027 @propertycache
1028 def _changectx(self):
1028 def _changectx(self):
1029 try:
1029 try:
1030 return changectx(self._repo, self._changeid)
1030 return changectx(self._repo, self._changeid)
1031 except error.FilteredRepoLookupError:
1031 except error.FilteredRepoLookupError:
1032 # Linkrev may point to any revision in the repository. When the
1032 # Linkrev may point to any revision in the repository. When the
1033 # repository is filtered this may lead to `filectx` trying to build
1033 # repository is filtered this may lead to `filectx` trying to build
1034 # `changectx` for filtered revision. In such case we fallback to
1034 # `changectx` for filtered revision. In such case we fallback to
1035 # creating `changectx` on the unfiltered version of the reposition.
1035 # creating `changectx` on the unfiltered version of the reposition.
1036 # This fallback should not be an issue because `changectx` from
1036 # This fallback should not be an issue because `changectx` from
1037 # `filectx` are not used in complex operations that care about
1037 # `filectx` are not used in complex operations that care about
1038 # filtering.
1038 # filtering.
1039 #
1039 #
1040 # This fallback is a cheap and dirty fix that prevent several
1040 # This fallback is a cheap and dirty fix that prevent several
1041 # crashes. It does not ensure the behavior is correct. However the
1041 # crashes. It does not ensure the behavior is correct. However the
1042 # behavior was not correct before filtering either and "incorrect
1042 # behavior was not correct before filtering either and "incorrect
1043 # behavior" is seen as better as "crash"
1043 # behavior" is seen as better as "crash"
1044 #
1044 #
1045 # Linkrevs have several serious troubles with filtering that are
1045 # Linkrevs have several serious troubles with filtering that are
1046 # complicated to solve. Proper handling of the issue here should be
1046 # complicated to solve. Proper handling of the issue here should be
1047 # considered when solving linkrev issue are on the table.
1047 # considered when solving linkrev issue are on the table.
1048 return changectx(self._repo.unfiltered(), self._changeid)
1048 return changectx(self._repo.unfiltered(), self._changeid)
1049
1049
1050 def filectx(self, fileid, changeid=None):
1050 def filectx(self, fileid, changeid=None):
1051 '''opens an arbitrary revision of the file without
1051 '''opens an arbitrary revision of the file without
1052 opening a new filelog'''
1052 opening a new filelog'''
1053 return filectx(self._repo, self._path, fileid=fileid,
1053 return filectx(self._repo, self._path, fileid=fileid,
1054 filelog=self._filelog, changeid=changeid)
1054 filelog=self._filelog, changeid=changeid)
1055
1055
1056 def data(self):
1056 def data(self):
1057 try:
1057 try:
1058 return self._filelog.read(self._filenode)
1058 return self._filelog.read(self._filenode)
1059 except error.CensoredNodeError:
1059 except error.CensoredNodeError:
1060 if self._repo.ui.config("censor", "policy", "abort") == "ignore":
1060 if self._repo.ui.config("censor", "policy", "abort") == "ignore":
1061 return ""
1061 return ""
1062 raise util.Abort(_("censored node: %s") % short(self._filenode),
1062 raise util.Abort(_("censored node: %s") % short(self._filenode),
1063 hint=_("set censor.policy to ignore errors"))
1063 hint=_("set censor.policy to ignore errors"))
1064
1064
1065 def size(self):
1065 def size(self):
1066 return self._filelog.size(self._filerev)
1066 return self._filelog.size(self._filerev)
1067
1067
1068 def renamed(self):
1068 def renamed(self):
1069 """check if file was actually renamed in this changeset revision
1069 """check if file was actually renamed in this changeset revision
1070
1070
1071 If rename logged in file revision, we report copy for changeset only
1071 If rename logged in file revision, we report copy for changeset only
1072 if file revisions linkrev points back to the changeset in question
1072 if file revisions linkrev points back to the changeset in question
1073 or both changeset parents contain different file revisions.
1073 or both changeset parents contain different file revisions.
1074 """
1074 """
1075
1075
1076 renamed = self._filelog.renamed(self._filenode)
1076 renamed = self._filelog.renamed(self._filenode)
1077 if not renamed:
1077 if not renamed:
1078 return renamed
1078 return renamed
1079
1079
1080 if self.rev() == self.linkrev():
1080 if self.rev() == self.linkrev():
1081 return renamed
1081 return renamed
1082
1082
1083 name = self.path()
1083 name = self.path()
1084 fnode = self._filenode
1084 fnode = self._filenode
1085 for p in self._changectx.parents():
1085 for p in self._changectx.parents():
1086 try:
1086 try:
1087 if fnode == p.filenode(name):
1087 if fnode == p.filenode(name):
1088 return None
1088 return None
1089 except error.LookupError:
1089 except error.LookupError:
1090 pass
1090 pass
1091 return renamed
1091 return renamed
1092
1092
1093 def children(self):
1093 def children(self):
1094 # hard for renames
1094 # hard for renames
1095 c = self._filelog.children(self._filenode)
1095 c = self._filelog.children(self._filenode)
1096 return [filectx(self._repo, self._path, fileid=x,
1096 return [filectx(self._repo, self._path, fileid=x,
1097 filelog=self._filelog) for x in c]
1097 filelog=self._filelog) for x in c]
1098
1098
1099 class committablectx(basectx):
1099 class committablectx(basectx):
1100 """A committablectx object provides common functionality for a context that
1100 """A committablectx object provides common functionality for a context that
1101 wants the ability to commit, e.g. workingctx or memctx."""
1101 wants the ability to commit, e.g. workingctx or memctx."""
1102 def __init__(self, repo, text="", user=None, date=None, extra=None,
1102 def __init__(self, repo, text="", user=None, date=None, extra=None,
1103 changes=None):
1103 changes=None):
1104 self._repo = repo
1104 self._repo = repo
1105 self._rev = None
1105 self._rev = None
1106 self._node = None
1106 self._node = None
1107 self._text = text
1107 self._text = text
1108 if date:
1108 if date:
1109 self._date = util.parsedate(date)
1109 self._date = util.parsedate(date)
1110 if user:
1110 if user:
1111 self._user = user
1111 self._user = user
1112 if changes:
1112 if changes:
1113 self._status = changes
1113 self._status = changes
1114
1114
1115 self._extra = {}
1115 self._extra = {}
1116 if extra:
1116 if extra:
1117 self._extra = extra.copy()
1117 self._extra = extra.copy()
1118 if 'branch' not in self._extra:
1118 if 'branch' not in self._extra:
1119 try:
1119 try:
1120 branch = encoding.fromlocal(self._repo.dirstate.branch())
1120 branch = encoding.fromlocal(self._repo.dirstate.branch())
1121 except UnicodeDecodeError:
1121 except UnicodeDecodeError:
1122 raise util.Abort(_('branch name not in UTF-8!'))
1122 raise util.Abort(_('branch name not in UTF-8!'))
1123 self._extra['branch'] = branch
1123 self._extra['branch'] = branch
1124 if self._extra['branch'] == '':
1124 if self._extra['branch'] == '':
1125 self._extra['branch'] = 'default'
1125 self._extra['branch'] = 'default'
1126
1126
1127 def __str__(self):
1127 def __str__(self):
1128 return str(self._parents[0]) + "+"
1128 return str(self._parents[0]) + "+"
1129
1129
1130 def __nonzero__(self):
1130 def __nonzero__(self):
1131 return True
1131 return True
1132
1132
1133 def _buildflagfunc(self):
1133 def _buildflagfunc(self):
1134 # Create a fallback function for getting file flags when the
1134 # Create a fallback function for getting file flags when the
1135 # filesystem doesn't support them
1135 # filesystem doesn't support them
1136
1136
1137 copiesget = self._repo.dirstate.copies().get
1137 copiesget = self._repo.dirstate.copies().get
1138
1138
1139 if len(self._parents) < 2:
1139 if len(self._parents) < 2:
1140 # when we have one parent, it's easy: copy from parent
1140 # when we have one parent, it's easy: copy from parent
1141 man = self._parents[0].manifest()
1141 man = self._parents[0].manifest()
1142 def func(f):
1142 def func(f):
1143 f = copiesget(f, f)
1143 f = copiesget(f, f)
1144 return man.flags(f)
1144 return man.flags(f)
1145 else:
1145 else:
1146 # merges are tricky: we try to reconstruct the unstored
1146 # merges are tricky: we try to reconstruct the unstored
1147 # result from the merge (issue1802)
1147 # result from the merge (issue1802)
1148 p1, p2 = self._parents
1148 p1, p2 = self._parents
1149 pa = p1.ancestor(p2)
1149 pa = p1.ancestor(p2)
1150 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
1150 m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest()
1151
1151
1152 def func(f):
1152 def func(f):
1153 f = copiesget(f, f) # may be wrong for merges with copies
1153 f = copiesget(f, f) # may be wrong for merges with copies
1154 fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f)
1154 fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f)
1155 if fl1 == fl2:
1155 if fl1 == fl2:
1156 return fl1
1156 return fl1
1157 if fl1 == fla:
1157 if fl1 == fla:
1158 return fl2
1158 return fl2
1159 if fl2 == fla:
1159 if fl2 == fla:
1160 return fl1
1160 return fl1
1161 return '' # punt for conflicts
1161 return '' # punt for conflicts
1162
1162
1163 return func
1163 return func
1164
1164
1165 @propertycache
1165 @propertycache
1166 def _flagfunc(self):
1166 def _flagfunc(self):
1167 return self._repo.dirstate.flagfunc(self._buildflagfunc)
1167 return self._repo.dirstate.flagfunc(self._buildflagfunc)
1168
1168
1169 @propertycache
1169 @propertycache
1170 def _manifest(self):
1170 def _manifest(self):
1171 """generate a manifest corresponding to the values in self._status
1171 """generate a manifest corresponding to the values in self._status
1172
1172
1173 This reuse the file nodeid from parent, but we append an extra letter
1173 This reuse the file nodeid from parent, but we append an extra letter
1174 when modified. Modified files get an extra 'm' while added files get
1174 when modified. Modified files get an extra 'm' while added files get
1175 an extra 'a'. This is used by manifests merge to see that files
1175 an extra 'a'. This is used by manifests merge to see that files
1176 are different and by update logic to avoid deleting newly added files.
1176 are different and by update logic to avoid deleting newly added files.
1177 """
1177 """
1178
1178
1179 man1 = self._parents[0].manifest()
1179 man1 = self._parents[0].manifest()
1180 man = man1.copy()
1180 man = man1.copy()
1181 if len(self._parents) > 1:
1181 if len(self._parents) > 1:
1182 man2 = self.p2().manifest()
1182 man2 = self.p2().manifest()
1183 def getman(f):
1183 def getman(f):
1184 if f in man1:
1184 if f in man1:
1185 return man1
1185 return man1
1186 return man2
1186 return man2
1187 else:
1187 else:
1188 getman = lambda f: man1
1188 getman = lambda f: man1
1189
1189
1190 copied = self._repo.dirstate.copies()
1190 copied = self._repo.dirstate.copies()
1191 ff = self._flagfunc
1191 ff = self._flagfunc
1192 for i, l in (("a", self._status.added), ("m", self._status.modified)):
1192 for i, l in (("a", self._status.added), ("m", self._status.modified)):
1193 for f in l:
1193 for f in l:
1194 orig = copied.get(f, f)
1194 orig = copied.get(f, f)
1195 man[f] = getman(orig).get(orig, nullid) + i
1195 man[f] = getman(orig).get(orig, nullid) + i
1196 try:
1196 try:
1197 man.setflag(f, ff(f))
1197 man.setflag(f, ff(f))
1198 except OSError:
1198 except OSError:
1199 pass
1199 pass
1200
1200
1201 for f in self._status.deleted + self._status.removed:
1201 for f in self._status.deleted + self._status.removed:
1202 if f in man:
1202 if f in man:
1203 del man[f]
1203 del man[f]
1204
1204
1205 return man
1205 return man
1206
1206
1207 @propertycache
1207 @propertycache
1208 def _status(self):
1208 def _status(self):
1209 return self._repo.status()
1209 return self._repo.status()
1210
1210
1211 @propertycache
1211 @propertycache
1212 def _user(self):
1212 def _user(self):
1213 return self._repo.ui.username()
1213 return self._repo.ui.username()
1214
1214
1215 @propertycache
1215 @propertycache
1216 def _date(self):
1216 def _date(self):
1217 return util.makedate()
1217 return util.makedate()
1218
1218
1219 def subrev(self, subpath):
1219 def subrev(self, subpath):
1220 return None
1220 return None
1221
1221
1222 def manifestnode(self):
1222 def manifestnode(self):
1223 return None
1223 return None
1224 def user(self):
1224 def user(self):
1225 return self._user or self._repo.ui.username()
1225 return self._user or self._repo.ui.username()
1226 def date(self):
1226 def date(self):
1227 return self._date
1227 return self._date
1228 def description(self):
1228 def description(self):
1229 return self._text
1229 return self._text
1230 def files(self):
1230 def files(self):
1231 return sorted(self._status.modified + self._status.added +
1231 return sorted(self._status.modified + self._status.added +
1232 self._status.removed)
1232 self._status.removed)
1233
1233
1234 def modified(self):
1234 def modified(self):
1235 return self._status.modified
1235 return self._status.modified
1236 def added(self):
1236 def added(self):
1237 return self._status.added
1237 return self._status.added
1238 def removed(self):
1238 def removed(self):
1239 return self._status.removed
1239 return self._status.removed
1240 def deleted(self):
1240 def deleted(self):
1241 return self._status.deleted
1241 return self._status.deleted
1242 def branch(self):
1242 def branch(self):
1243 return encoding.tolocal(self._extra['branch'])
1243 return encoding.tolocal(self._extra['branch'])
1244 def closesbranch(self):
1244 def closesbranch(self):
1245 return 'close' in self._extra
1245 return 'close' in self._extra
1246 def extra(self):
1246 def extra(self):
1247 return self._extra
1247 return self._extra
1248
1248
1249 def tags(self):
1249 def tags(self):
1250 return []
1250 return []
1251
1251
1252 def bookmarks(self):
1252 def bookmarks(self):
1253 b = []
1253 b = []
1254 for p in self.parents():
1254 for p in self.parents():
1255 b.extend(p.bookmarks())
1255 b.extend(p.bookmarks())
1256 return b
1256 return b
1257
1257
1258 def phase(self):
1258 def phase(self):
1259 phase = phases.draft # default phase to draft
1259 phase = phases.draft # default phase to draft
1260 for p in self.parents():
1260 for p in self.parents():
1261 phase = max(phase, p.phase())
1261 phase = max(phase, p.phase())
1262 return phase
1262 return phase
1263
1263
1264 def hidden(self):
1264 def hidden(self):
1265 return False
1265 return False
1266
1266
1267 def children(self):
1267 def children(self):
1268 return []
1268 return []
1269
1269
1270 def flags(self, path):
1270 def flags(self, path):
1271 if '_manifest' in self.__dict__:
1271 if '_manifest' in self.__dict__:
1272 try:
1272 try:
1273 return self._manifest.flags(path)
1273 return self._manifest.flags(path)
1274 except KeyError:
1274 except KeyError:
1275 return ''
1275 return ''
1276
1276
1277 try:
1277 try:
1278 return self._flagfunc(path)
1278 return self._flagfunc(path)
1279 except OSError:
1279 except OSError:
1280 return ''
1280 return ''
1281
1281
1282 def ancestor(self, c2):
1282 def ancestor(self, c2):
1283 """return the "best" ancestor context of self and c2"""
1283 """return the "best" ancestor context of self and c2"""
1284 return self._parents[0].ancestor(c2) # punt on two parents for now
1284 return self._parents[0].ancestor(c2) # punt on two parents for now
1285
1285
1286 def walk(self, match):
1286 def walk(self, match):
1287 '''Generates matching file names.'''
1287 '''Generates matching file names.'''
1288 return sorted(self._repo.dirstate.walk(match, sorted(self.substate),
1288 return sorted(self._repo.dirstate.walk(match, sorted(self.substate),
1289 True, False))
1289 True, False))
1290
1290
1291 def matches(self, match):
1291 def matches(self, match):
1292 return sorted(self._repo.dirstate.matches(match))
1292 return sorted(self._repo.dirstate.matches(match))
1293
1293
1294 def ancestors(self):
1294 def ancestors(self):
1295 for p in self._parents:
1295 for p in self._parents:
1296 yield p
1296 yield p
1297 for a in self._repo.changelog.ancestors(
1297 for a in self._repo.changelog.ancestors(
1298 [p.rev() for p in self._parents]):
1298 [p.rev() for p in self._parents]):
1299 yield changectx(self._repo, a)
1299 yield changectx(self._repo, a)
1300
1300
1301 def markcommitted(self, node):
1301 def markcommitted(self, node):
1302 """Perform post-commit cleanup necessary after committing this ctx
1302 """Perform post-commit cleanup necessary after committing this ctx
1303
1303
1304 Specifically, this updates backing stores this working context
1304 Specifically, this updates backing stores this working context
1305 wraps to reflect the fact that the changes reflected by this
1305 wraps to reflect the fact that the changes reflected by this
1306 workingctx have been committed. For example, it marks
1306 workingctx have been committed. For example, it marks
1307 modified and added files as normal in the dirstate.
1307 modified and added files as normal in the dirstate.
1308
1308
1309 """
1309 """
1310
1310
1311 self._repo.dirstate.beginparentchange()
1311 self._repo.dirstate.beginparentchange()
1312 for f in self.modified() + self.added():
1312 for f in self.modified() + self.added():
1313 self._repo.dirstate.normal(f)
1313 self._repo.dirstate.normal(f)
1314 for f in self.removed():
1314 for f in self.removed():
1315 self._repo.dirstate.drop(f)
1315 self._repo.dirstate.drop(f)
1316 self._repo.dirstate.setparents(node)
1316 self._repo.dirstate.setparents(node)
1317 self._repo.dirstate.endparentchange()
1317 self._repo.dirstate.endparentchange()
1318
1318
1319 class workingctx(committablectx):
1319 class workingctx(committablectx):
1320 """A workingctx object makes access to data related to
1320 """A workingctx object makes access to data related to
1321 the current working directory convenient.
1321 the current working directory convenient.
1322 date - any valid date string or (unixtime, offset), or None.
1322 date - any valid date string or (unixtime, offset), or None.
1323 user - username string, or None.
1323 user - username string, or None.
1324 extra - a dictionary of extra values, or None.
1324 extra - a dictionary of extra values, or None.
1325 changes - a list of file lists as returned by localrepo.status()
1325 changes - a list of file lists as returned by localrepo.status()
1326 or None to use the repository status.
1326 or None to use the repository status.
1327 """
1327 """
1328 def __init__(self, repo, text="", user=None, date=None, extra=None,
1328 def __init__(self, repo, text="", user=None, date=None, extra=None,
1329 changes=None):
1329 changes=None):
1330 super(workingctx, self).__init__(repo, text, user, date, extra, changes)
1330 super(workingctx, self).__init__(repo, text, user, date, extra, changes)
1331
1331
1332 def __iter__(self):
1332 def __iter__(self):
1333 d = self._repo.dirstate
1333 d = self._repo.dirstate
1334 for f in d:
1334 for f in d:
1335 if d[f] != 'r':
1335 if d[f] != 'r':
1336 yield f
1336 yield f
1337
1337
1338 def __contains__(self, key):
1338 def __contains__(self, key):
1339 return self._repo.dirstate[key] not in "?r"
1339 return self._repo.dirstate[key] not in "?r"
1340
1340
1341 def hex(self):
1341 def hex(self):
1342 return hex(wdirid)
1342 return hex(wdirid)
1343
1343
1344 @propertycache
1344 @propertycache
1345 def _parents(self):
1345 def _parents(self):
1346 p = self._repo.dirstate.parents()
1346 p = self._repo.dirstate.parents()
1347 if p[1] == nullid:
1347 if p[1] == nullid:
1348 p = p[:-1]
1348 p = p[:-1]
1349 return [changectx(self._repo, x) for x in p]
1349 return [changectx(self._repo, x) for x in p]
1350
1350
1351 def filectx(self, path, filelog=None):
1351 def filectx(self, path, filelog=None):
1352 """get a file context from the working directory"""
1352 """get a file context from the working directory"""
1353 return workingfilectx(self._repo, path, workingctx=self,
1353 return workingfilectx(self._repo, path, workingctx=self,
1354 filelog=filelog)
1354 filelog=filelog)
1355
1355
1356 def dirty(self, missing=False, merge=True, branch=True):
1356 def dirty(self, missing=False, merge=True, branch=True):
1357 "check whether a working directory is modified"
1357 "check whether a working directory is modified"
1358 # check subrepos first
1358 # check subrepos first
1359 for s in sorted(self.substate):
1359 for s in sorted(self.substate):
1360 if self.sub(s).dirty():
1360 if self.sub(s).dirty():
1361 return True
1361 return True
1362 # check current working dir
1362 # check current working dir
1363 return ((merge and self.p2()) or
1363 return ((merge and self.p2()) or
1364 (branch and self.branch() != self.p1().branch()) or
1364 (branch and self.branch() != self.p1().branch()) or
1365 self.modified() or self.added() or self.removed() or
1365 self.modified() or self.added() or self.removed() or
1366 (missing and self.deleted()))
1366 (missing and self.deleted()))
1367
1367
1368 def add(self, list, prefix=""):
1368 def add(self, list, prefix=""):
1369 join = lambda f: os.path.join(prefix, f)
1369 join = lambda f: os.path.join(prefix, f)
1370 wlock = self._repo.wlock()
1370 wlock = self._repo.wlock()
1371 ui, ds = self._repo.ui, self._repo.dirstate
1371 ui, ds = self._repo.ui, self._repo.dirstate
1372 try:
1372 try:
1373 rejected = []
1373 rejected = []
1374 lstat = self._repo.wvfs.lstat
1374 lstat = self._repo.wvfs.lstat
1375 for f in list:
1375 for f in list:
1376 scmutil.checkportable(ui, join(f))
1376 scmutil.checkportable(ui, join(f))
1377 try:
1377 try:
1378 st = lstat(f)
1378 st = lstat(f)
1379 except OSError:
1379 except OSError:
1380 ui.warn(_("%s does not exist!\n") % join(f))
1380 ui.warn(_("%s does not exist!\n") % join(f))
1381 rejected.append(f)
1381 rejected.append(f)
1382 continue
1382 continue
1383 if st.st_size > 10000000:
1383 if st.st_size > 10000000:
1384 ui.warn(_("%s: up to %d MB of RAM may be required "
1384 ui.warn(_("%s: up to %d MB of RAM may be required "
1385 "to manage this file\n"
1385 "to manage this file\n"
1386 "(use 'hg revert %s' to cancel the "
1386 "(use 'hg revert %s' to cancel the "
1387 "pending addition)\n")
1387 "pending addition)\n")
1388 % (f, 3 * st.st_size // 1000000, join(f)))
1388 % (f, 3 * st.st_size // 1000000, join(f)))
1389 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1389 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1390 ui.warn(_("%s not added: only files and symlinks "
1390 ui.warn(_("%s not added: only files and symlinks "
1391 "supported currently\n") % join(f))
1391 "supported currently\n") % join(f))
1392 rejected.append(f)
1392 rejected.append(f)
1393 elif ds[f] in 'amn':
1393 elif ds[f] in 'amn':
1394 ui.warn(_("%s already tracked!\n") % join(f))
1394 ui.warn(_("%s already tracked!\n") % join(f))
1395 elif ds[f] == 'r':
1395 elif ds[f] == 'r':
1396 ds.normallookup(f)
1396 ds.normallookup(f)
1397 else:
1397 else:
1398 ds.add(f)
1398 ds.add(f)
1399 return rejected
1399 return rejected
1400 finally:
1400 finally:
1401 wlock.release()
1401 wlock.release()
1402
1402
1403 def forget(self, files, prefix=""):
1403 def forget(self, files, prefix=""):
1404 join = lambda f: os.path.join(prefix, f)
1404 join = lambda f: os.path.join(prefix, f)
1405 wlock = self._repo.wlock()
1405 wlock = self._repo.wlock()
1406 try:
1406 try:
1407 rejected = []
1407 rejected = []
1408 for f in files:
1408 for f in files:
1409 if f not in self._repo.dirstate:
1409 if f not in self._repo.dirstate:
1410 self._repo.ui.warn(_("%s not tracked!\n") % join(f))
1410 self._repo.ui.warn(_("%s not tracked!\n") % join(f))
1411 rejected.append(f)
1411 rejected.append(f)
1412 elif self._repo.dirstate[f] != 'a':
1412 elif self._repo.dirstate[f] != 'a':
1413 self._repo.dirstate.remove(f)
1413 self._repo.dirstate.remove(f)
1414 else:
1414 else:
1415 self._repo.dirstate.drop(f)
1415 self._repo.dirstate.drop(f)
1416 return rejected
1416 return rejected
1417 finally:
1417 finally:
1418 wlock.release()
1418 wlock.release()
1419
1419
1420 def undelete(self, list):
1420 def undelete(self, list):
1421 pctxs = self.parents()
1421 pctxs = self.parents()
1422 wlock = self._repo.wlock()
1422 wlock = self._repo.wlock()
1423 try:
1423 try:
1424 for f in list:
1424 for f in list:
1425 if self._repo.dirstate[f] != 'r':
1425 if self._repo.dirstate[f] != 'r':
1426 self._repo.ui.warn(_("%s not removed!\n") % f)
1426 self._repo.ui.warn(_("%s not removed!\n") % f)
1427 else:
1427 else:
1428 fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f]
1428 fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f]
1429 t = fctx.data()
1429 t = fctx.data()
1430 self._repo.wwrite(f, t, fctx.flags())
1430 self._repo.wwrite(f, t, fctx.flags())
1431 self._repo.dirstate.normal(f)
1431 self._repo.dirstate.normal(f)
1432 finally:
1432 finally:
1433 wlock.release()
1433 wlock.release()
1434
1434
1435 def copy(self, source, dest):
1435 def copy(self, source, dest):
1436 try:
1436 try:
1437 st = self._repo.wvfs.lstat(dest)
1437 st = self._repo.wvfs.lstat(dest)
1438 except OSError as err:
1438 except OSError as err:
1439 if err.errno != errno.ENOENT:
1439 if err.errno != errno.ENOENT:
1440 raise
1440 raise
1441 self._repo.ui.warn(_("%s does not exist!\n") % dest)
1441 self._repo.ui.warn(_("%s does not exist!\n") % dest)
1442 return
1442 return
1443 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1443 if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)):
1444 self._repo.ui.warn(_("copy failed: %s is not a file or a "
1444 self._repo.ui.warn(_("copy failed: %s is not a file or a "
1445 "symbolic link\n") % dest)
1445 "symbolic link\n") % dest)
1446 else:
1446 else:
1447 wlock = self._repo.wlock()
1447 wlock = self._repo.wlock()
1448 try:
1448 try:
1449 if self._repo.dirstate[dest] in '?':
1449 if self._repo.dirstate[dest] in '?':
1450 self._repo.dirstate.add(dest)
1450 self._repo.dirstate.add(dest)
1451 elif self._repo.dirstate[dest] in 'r':
1451 elif self._repo.dirstate[dest] in 'r':
1452 self._repo.dirstate.normallookup(dest)
1452 self._repo.dirstate.normallookup(dest)
1453 self._repo.dirstate.copy(source, dest)
1453 self._repo.dirstate.copy(source, dest)
1454 finally:
1454 finally:
1455 wlock.release()
1455 wlock.release()
1456
1456
1457 def match(self, pats=[], include=None, exclude=None, default='glob',
1457 def match(self, pats=[], include=None, exclude=None, default='glob',
1458 listsubrepos=False, badfn=None):
1458 listsubrepos=False, badfn=None):
1459 r = self._repo
1459 r = self._repo
1460
1460
1461 # Only a case insensitive filesystem needs magic to translate user input
1461 # Only a case insensitive filesystem needs magic to translate user input
1462 # to actual case in the filesystem.
1462 # to actual case in the filesystem.
1463 if not util.checkcase(r.root):
1463 if not util.checkcase(r.root):
1464 return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include,
1464 return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include,
1465 exclude, default, r.auditor, self,
1465 exclude, default, r.auditor, self,
1466 listsubrepos=listsubrepos,
1466 listsubrepos=listsubrepos,
1467 badfn=badfn)
1467 badfn=badfn)
1468 return matchmod.match(r.root, r.getcwd(), pats,
1468 return matchmod.match(r.root, r.getcwd(), pats,
1469 include, exclude, default,
1469 include, exclude, default,
1470 auditor=r.auditor, ctx=self,
1470 auditor=r.auditor, ctx=self,
1471 listsubrepos=listsubrepos, badfn=badfn)
1471 listsubrepos=listsubrepos, badfn=badfn)
1472
1472
1473 def _filtersuspectsymlink(self, files):
1473 def _filtersuspectsymlink(self, files):
1474 if not files or self._repo.dirstate._checklink:
1474 if not files or self._repo.dirstate._checklink:
1475 return files
1475 return files
1476
1476
1477 # Symlink placeholders may get non-symlink-like contents
1477 # Symlink placeholders may get non-symlink-like contents
1478 # via user error or dereferencing by NFS or Samba servers,
1478 # via user error or dereferencing by NFS or Samba servers,
1479 # so we filter out any placeholders that don't look like a
1479 # so we filter out any placeholders that don't look like a
1480 # symlink
1480 # symlink
1481 sane = []
1481 sane = []
1482 for f in files:
1482 for f in files:
1483 if self.flags(f) == 'l':
1483 if self.flags(f) == 'l':
1484 d = self[f].data()
1484 d = self[f].data()
1485 if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d):
1485 if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d):
1486 self._repo.ui.debug('ignoring suspect symlink placeholder'
1486 self._repo.ui.debug('ignoring suspect symlink placeholder'
1487 ' "%s"\n' % f)
1487 ' "%s"\n' % f)
1488 continue
1488 continue
1489 sane.append(f)
1489 sane.append(f)
1490 return sane
1490 return sane
1491
1491
1492 def _checklookup(self, files):
1492 def _checklookup(self, files):
1493 # check for any possibly clean files
1493 # check for any possibly clean files
1494 if not files:
1494 if not files:
1495 return [], []
1495 return [], []
1496
1496
1497 modified = []
1497 modified = []
1498 fixup = []
1498 fixup = []
1499 pctx = self._parents[0]
1499 pctx = self._parents[0]
1500 # do a full compare of any files that might have changed
1500 # do a full compare of any files that might have changed
1501 for f in sorted(files):
1501 for f in sorted(files):
1502 if (f not in pctx or self.flags(f) != pctx.flags(f)
1502 if (f not in pctx or self.flags(f) != pctx.flags(f)
1503 or pctx[f].cmp(self[f])):
1503 or pctx[f].cmp(self[f])):
1504 modified.append(f)
1504 modified.append(f)
1505 else:
1505 else:
1506 fixup.append(f)
1506 fixup.append(f)
1507
1507
1508 # update dirstate for files that are actually clean
1508 # update dirstate for files that are actually clean
1509 if fixup:
1509 if fixup:
1510 try:
1510 try:
1511 # updating the dirstate is optional
1511 # updating the dirstate is optional
1512 # so we don't wait on the lock
1512 # so we don't wait on the lock
1513 # wlock can invalidate the dirstate, so cache normal _after_
1513 # wlock can invalidate the dirstate, so cache normal _after_
1514 # taking the lock
1514 # taking the lock
1515 wlock = self._repo.wlock(False)
1515 wlock = self._repo.wlock(False)
1516 normal = self._repo.dirstate.normal
1516 normal = self._repo.dirstate.normal
1517 try:
1517 try:
1518 for f in fixup:
1518 for f in fixup:
1519 normal(f)
1519 normal(f)
1520 # write changes out explicitly, because nesting
1521 # wlock at runtime may prevent 'wlock.release()'
1522 # below from doing so for subsequent changing files
1523 self._repo.dirstate.write()
1520 finally:
1524 finally:
1521 wlock.release()
1525 wlock.release()
1522 except error.LockError:
1526 except error.LockError:
1523 pass
1527 pass
1524 return modified, fixup
1528 return modified, fixup
1525
1529
1526 def _manifestmatches(self, match, s):
1530 def _manifestmatches(self, match, s):
1527 """Slow path for workingctx
1531 """Slow path for workingctx
1528
1532
1529 The fast path is when we compare the working directory to its parent
1533 The fast path is when we compare the working directory to its parent
1530 which means this function is comparing with a non-parent; therefore we
1534 which means this function is comparing with a non-parent; therefore we
1531 need to build a manifest and return what matches.
1535 need to build a manifest and return what matches.
1532 """
1536 """
1533 mf = self._repo['.']._manifestmatches(match, s)
1537 mf = self._repo['.']._manifestmatches(match, s)
1534 for f in s.modified + s.added:
1538 for f in s.modified + s.added:
1535 mf[f] = _newnode
1539 mf[f] = _newnode
1536 mf.setflag(f, self.flags(f))
1540 mf.setflag(f, self.flags(f))
1537 for f in s.removed:
1541 for f in s.removed:
1538 if f in mf:
1542 if f in mf:
1539 del mf[f]
1543 del mf[f]
1540 return mf
1544 return mf
1541
1545
1542 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1546 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1543 unknown=False):
1547 unknown=False):
1544 '''Gets the status from the dirstate -- internal use only.'''
1548 '''Gets the status from the dirstate -- internal use only.'''
1545 listignored, listclean, listunknown = ignored, clean, unknown
1549 listignored, listclean, listunknown = ignored, clean, unknown
1546 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
1550 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
1547 subrepos = []
1551 subrepos = []
1548 if '.hgsub' in self:
1552 if '.hgsub' in self:
1549 subrepos = sorted(self.substate)
1553 subrepos = sorted(self.substate)
1550 cmp, s = self._repo.dirstate.status(match, subrepos, listignored,
1554 cmp, s = self._repo.dirstate.status(match, subrepos, listignored,
1551 listclean, listunknown)
1555 listclean, listunknown)
1552
1556
1553 # check for any possibly clean files
1557 # check for any possibly clean files
1554 if cmp:
1558 if cmp:
1555 modified2, fixup = self._checklookup(cmp)
1559 modified2, fixup = self._checklookup(cmp)
1556 s.modified.extend(modified2)
1560 s.modified.extend(modified2)
1557
1561
1558 # update dirstate for files that are actually clean
1562 # update dirstate for files that are actually clean
1559 if fixup and listclean:
1563 if fixup and listclean:
1560 s.clean.extend(fixup)
1564 s.clean.extend(fixup)
1561
1565
1562 if match.always():
1566 if match.always():
1563 # cache for performance
1567 # cache for performance
1564 if s.unknown or s.ignored or s.clean:
1568 if s.unknown or s.ignored or s.clean:
1565 # "_status" is cached with list*=False in the normal route
1569 # "_status" is cached with list*=False in the normal route
1566 self._status = scmutil.status(s.modified, s.added, s.removed,
1570 self._status = scmutil.status(s.modified, s.added, s.removed,
1567 s.deleted, [], [], [])
1571 s.deleted, [], [], [])
1568 else:
1572 else:
1569 self._status = s
1573 self._status = s
1570
1574
1571 return s
1575 return s
1572
1576
1573 def _buildstatus(self, other, s, match, listignored, listclean,
1577 def _buildstatus(self, other, s, match, listignored, listclean,
1574 listunknown):
1578 listunknown):
1575 """build a status with respect to another context
1579 """build a status with respect to another context
1576
1580
1577 This includes logic for maintaining the fast path of status when
1581 This includes logic for maintaining the fast path of status when
1578 comparing the working directory against its parent, which is to skip
1582 comparing the working directory against its parent, which is to skip
1579 building a new manifest if self (working directory) is not comparing
1583 building a new manifest if self (working directory) is not comparing
1580 against its parent (repo['.']).
1584 against its parent (repo['.']).
1581 """
1585 """
1582 s = self._dirstatestatus(match, listignored, listclean, listunknown)
1586 s = self._dirstatestatus(match, listignored, listclean, listunknown)
1583 # Filter out symlinks that, in the case of FAT32 and NTFS filesystems,
1587 # Filter out symlinks that, in the case of FAT32 and NTFS filesystems,
1584 # might have accidentally ended up with the entire contents of the file
1588 # might have accidentally ended up with the entire contents of the file
1585 # they are supposed to be linking to.
1589 # they are supposed to be linking to.
1586 s.modified[:] = self._filtersuspectsymlink(s.modified)
1590 s.modified[:] = self._filtersuspectsymlink(s.modified)
1587 if other != self._repo['.']:
1591 if other != self._repo['.']:
1588 s = super(workingctx, self)._buildstatus(other, s, match,
1592 s = super(workingctx, self)._buildstatus(other, s, match,
1589 listignored, listclean,
1593 listignored, listclean,
1590 listunknown)
1594 listunknown)
1591 return s
1595 return s
1592
1596
1593 def _matchstatus(self, other, match):
1597 def _matchstatus(self, other, match):
1594 """override the match method with a filter for directory patterns
1598 """override the match method with a filter for directory patterns
1595
1599
1596 We use inheritance to customize the match.bad method only in cases of
1600 We use inheritance to customize the match.bad method only in cases of
1597 workingctx since it belongs only to the working directory when
1601 workingctx since it belongs only to the working directory when
1598 comparing against the parent changeset.
1602 comparing against the parent changeset.
1599
1603
1600 If we aren't comparing against the working directory's parent, then we
1604 If we aren't comparing against the working directory's parent, then we
1601 just use the default match object sent to us.
1605 just use the default match object sent to us.
1602 """
1606 """
1603 superself = super(workingctx, self)
1607 superself = super(workingctx, self)
1604 match = superself._matchstatus(other, match)
1608 match = superself._matchstatus(other, match)
1605 if other != self._repo['.']:
1609 if other != self._repo['.']:
1606 def bad(f, msg):
1610 def bad(f, msg):
1607 # 'f' may be a directory pattern from 'match.files()',
1611 # 'f' may be a directory pattern from 'match.files()',
1608 # so 'f not in ctx1' is not enough
1612 # so 'f not in ctx1' is not enough
1609 if f not in other and not other.hasdir(f):
1613 if f not in other and not other.hasdir(f):
1610 self._repo.ui.warn('%s: %s\n' %
1614 self._repo.ui.warn('%s: %s\n' %
1611 (self._repo.dirstate.pathto(f), msg))
1615 (self._repo.dirstate.pathto(f), msg))
1612 match.bad = bad
1616 match.bad = bad
1613 return match
1617 return match
1614
1618
1615 class committablefilectx(basefilectx):
1619 class committablefilectx(basefilectx):
1616 """A committablefilectx provides common functionality for a file context
1620 """A committablefilectx provides common functionality for a file context
1617 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
1621 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
1618 def __init__(self, repo, path, filelog=None, ctx=None):
1622 def __init__(self, repo, path, filelog=None, ctx=None):
1619 self._repo = repo
1623 self._repo = repo
1620 self._path = path
1624 self._path = path
1621 self._changeid = None
1625 self._changeid = None
1622 self._filerev = self._filenode = None
1626 self._filerev = self._filenode = None
1623
1627
1624 if filelog is not None:
1628 if filelog is not None:
1625 self._filelog = filelog
1629 self._filelog = filelog
1626 if ctx:
1630 if ctx:
1627 self._changectx = ctx
1631 self._changectx = ctx
1628
1632
1629 def __nonzero__(self):
1633 def __nonzero__(self):
1630 return True
1634 return True
1631
1635
1632 def linkrev(self):
1636 def linkrev(self):
1633 # linked to self._changectx no matter if file is modified or not
1637 # linked to self._changectx no matter if file is modified or not
1634 return self.rev()
1638 return self.rev()
1635
1639
1636 def parents(self):
1640 def parents(self):
1637 '''return parent filectxs, following copies if necessary'''
1641 '''return parent filectxs, following copies if necessary'''
1638 def filenode(ctx, path):
1642 def filenode(ctx, path):
1639 return ctx._manifest.get(path, nullid)
1643 return ctx._manifest.get(path, nullid)
1640
1644
1641 path = self._path
1645 path = self._path
1642 fl = self._filelog
1646 fl = self._filelog
1643 pcl = self._changectx._parents
1647 pcl = self._changectx._parents
1644 renamed = self.renamed()
1648 renamed = self.renamed()
1645
1649
1646 if renamed:
1650 if renamed:
1647 pl = [renamed + (None,)]
1651 pl = [renamed + (None,)]
1648 else:
1652 else:
1649 pl = [(path, filenode(pcl[0], path), fl)]
1653 pl = [(path, filenode(pcl[0], path), fl)]
1650
1654
1651 for pc in pcl[1:]:
1655 for pc in pcl[1:]:
1652 pl.append((path, filenode(pc, path), fl))
1656 pl.append((path, filenode(pc, path), fl))
1653
1657
1654 return [self._parentfilectx(p, fileid=n, filelog=l)
1658 return [self._parentfilectx(p, fileid=n, filelog=l)
1655 for p, n, l in pl if n != nullid]
1659 for p, n, l in pl if n != nullid]
1656
1660
1657 def children(self):
1661 def children(self):
1658 return []
1662 return []
1659
1663
1660 class workingfilectx(committablefilectx):
1664 class workingfilectx(committablefilectx):
1661 """A workingfilectx object makes access to data related to a particular
1665 """A workingfilectx object makes access to data related to a particular
1662 file in the working directory convenient."""
1666 file in the working directory convenient."""
1663 def __init__(self, repo, path, filelog=None, workingctx=None):
1667 def __init__(self, repo, path, filelog=None, workingctx=None):
1664 super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
1668 super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
1665
1669
1666 @propertycache
1670 @propertycache
1667 def _changectx(self):
1671 def _changectx(self):
1668 return workingctx(self._repo)
1672 return workingctx(self._repo)
1669
1673
1670 def data(self):
1674 def data(self):
1671 return self._repo.wread(self._path)
1675 return self._repo.wread(self._path)
1672 def renamed(self):
1676 def renamed(self):
1673 rp = self._repo.dirstate.copied(self._path)
1677 rp = self._repo.dirstate.copied(self._path)
1674 if not rp:
1678 if not rp:
1675 return None
1679 return None
1676 return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
1680 return rp, self._changectx._parents[0]._manifest.get(rp, nullid)
1677
1681
1678 def size(self):
1682 def size(self):
1679 return self._repo.wvfs.lstat(self._path).st_size
1683 return self._repo.wvfs.lstat(self._path).st_size
1680 def date(self):
1684 def date(self):
1681 t, tz = self._changectx.date()
1685 t, tz = self._changectx.date()
1682 try:
1686 try:
1683 return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz)
1687 return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz)
1684 except OSError as err:
1688 except OSError as err:
1685 if err.errno != errno.ENOENT:
1689 if err.errno != errno.ENOENT:
1686 raise
1690 raise
1687 return (t, tz)
1691 return (t, tz)
1688
1692
1689 def cmp(self, fctx):
1693 def cmp(self, fctx):
1690 """compare with other file context
1694 """compare with other file context
1691
1695
1692 returns True if different than fctx.
1696 returns True if different than fctx.
1693 """
1697 """
1694 # fctx should be a filectx (not a workingfilectx)
1698 # fctx should be a filectx (not a workingfilectx)
1695 # invert comparison to reuse the same code path
1699 # invert comparison to reuse the same code path
1696 return fctx.cmp(self)
1700 return fctx.cmp(self)
1697
1701
1698 def remove(self, ignoremissing=False):
1702 def remove(self, ignoremissing=False):
1699 """wraps unlink for a repo's working directory"""
1703 """wraps unlink for a repo's working directory"""
1700 util.unlinkpath(self._repo.wjoin(self._path), ignoremissing)
1704 util.unlinkpath(self._repo.wjoin(self._path), ignoremissing)
1701
1705
1702 def write(self, data, flags):
1706 def write(self, data, flags):
1703 """wraps repo.wwrite"""
1707 """wraps repo.wwrite"""
1704 self._repo.wwrite(self._path, data, flags)
1708 self._repo.wwrite(self._path, data, flags)
1705
1709
1706 class workingcommitctx(workingctx):
1710 class workingcommitctx(workingctx):
1707 """A workingcommitctx object makes access to data related to
1711 """A workingcommitctx object makes access to data related to
1708 the revision being committed convenient.
1712 the revision being committed convenient.
1709
1713
1710 This hides changes in the working directory, if they aren't
1714 This hides changes in the working directory, if they aren't
1711 committed in this context.
1715 committed in this context.
1712 """
1716 """
1713 def __init__(self, repo, changes,
1717 def __init__(self, repo, changes,
1714 text="", user=None, date=None, extra=None):
1718 text="", user=None, date=None, extra=None):
1715 super(workingctx, self).__init__(repo, text, user, date, extra,
1719 super(workingctx, self).__init__(repo, text, user, date, extra,
1716 changes)
1720 changes)
1717
1721
1718 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1722 def _dirstatestatus(self, match=None, ignored=False, clean=False,
1719 unknown=False):
1723 unknown=False):
1720 """Return matched files only in ``self._status``
1724 """Return matched files only in ``self._status``
1721
1725
1722 Uncommitted files appear "clean" via this context, even if
1726 Uncommitted files appear "clean" via this context, even if
1723 they aren't actually so in the working directory.
1727 they aren't actually so in the working directory.
1724 """
1728 """
1725 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
1729 match = match or matchmod.always(self._repo.root, self._repo.getcwd())
1726 if clean:
1730 if clean:
1727 clean = [f for f in self._manifest if f not in self._changedset]
1731 clean = [f for f in self._manifest if f not in self._changedset]
1728 else:
1732 else:
1729 clean = []
1733 clean = []
1730 return scmutil.status([f for f in self._status.modified if match(f)],
1734 return scmutil.status([f for f in self._status.modified if match(f)],
1731 [f for f in self._status.added if match(f)],
1735 [f for f in self._status.added if match(f)],
1732 [f for f in self._status.removed if match(f)],
1736 [f for f in self._status.removed if match(f)],
1733 [], [], [], clean)
1737 [], [], [], clean)
1734
1738
1735 @propertycache
1739 @propertycache
1736 def _changedset(self):
1740 def _changedset(self):
1737 """Return the set of files changed in this context
1741 """Return the set of files changed in this context
1738 """
1742 """
1739 changed = set(self._status.modified)
1743 changed = set(self._status.modified)
1740 changed.update(self._status.added)
1744 changed.update(self._status.added)
1741 changed.update(self._status.removed)
1745 changed.update(self._status.removed)
1742 return changed
1746 return changed
1743
1747
1744 class memctx(committablectx):
1748 class memctx(committablectx):
1745 """Use memctx to perform in-memory commits via localrepo.commitctx().
1749 """Use memctx to perform in-memory commits via localrepo.commitctx().
1746
1750
1747 Revision information is supplied at initialization time while
1751 Revision information is supplied at initialization time while
1748 related files data and is made available through a callback
1752 related files data and is made available through a callback
1749 mechanism. 'repo' is the current localrepo, 'parents' is a
1753 mechanism. 'repo' is the current localrepo, 'parents' is a
1750 sequence of two parent revisions identifiers (pass None for every
1754 sequence of two parent revisions identifiers (pass None for every
1751 missing parent), 'text' is the commit message and 'files' lists
1755 missing parent), 'text' is the commit message and 'files' lists
1752 names of files touched by the revision (normalized and relative to
1756 names of files touched by the revision (normalized and relative to
1753 repository root).
1757 repository root).
1754
1758
1755 filectxfn(repo, memctx, path) is a callable receiving the
1759 filectxfn(repo, memctx, path) is a callable receiving the
1756 repository, the current memctx object and the normalized path of
1760 repository, the current memctx object and the normalized path of
1757 requested file, relative to repository root. It is fired by the
1761 requested file, relative to repository root. It is fired by the
1758 commit function for every file in 'files', but calls order is
1762 commit function for every file in 'files', but calls order is
1759 undefined. If the file is available in the revision being
1763 undefined. If the file is available in the revision being
1760 committed (updated or added), filectxfn returns a memfilectx
1764 committed (updated or added), filectxfn returns a memfilectx
1761 object. If the file was removed, filectxfn raises an
1765 object. If the file was removed, filectxfn raises an
1762 IOError. Moved files are represented by marking the source file
1766 IOError. Moved files are represented by marking the source file
1763 removed and the new file added with copy information (see
1767 removed and the new file added with copy information (see
1764 memfilectx).
1768 memfilectx).
1765
1769
1766 user receives the committer name and defaults to current
1770 user receives the committer name and defaults to current
1767 repository username, date is the commit date in any format
1771 repository username, date is the commit date in any format
1768 supported by util.parsedate() and defaults to current date, extra
1772 supported by util.parsedate() and defaults to current date, extra
1769 is a dictionary of metadata or is left empty.
1773 is a dictionary of metadata or is left empty.
1770 """
1774 """
1771
1775
1772 # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files.
1776 # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files.
1773 # Extensions that need to retain compatibility across Mercurial 3.1 can use
1777 # Extensions that need to retain compatibility across Mercurial 3.1 can use
1774 # this field to determine what to do in filectxfn.
1778 # this field to determine what to do in filectxfn.
1775 _returnnoneformissingfiles = True
1779 _returnnoneformissingfiles = True
1776
1780
1777 def __init__(self, repo, parents, text, files, filectxfn, user=None,
1781 def __init__(self, repo, parents, text, files, filectxfn, user=None,
1778 date=None, extra=None, editor=False):
1782 date=None, extra=None, editor=False):
1779 super(memctx, self).__init__(repo, text, user, date, extra)
1783 super(memctx, self).__init__(repo, text, user, date, extra)
1780 self._rev = None
1784 self._rev = None
1781 self._node = None
1785 self._node = None
1782 parents = [(p or nullid) for p in parents]
1786 parents = [(p or nullid) for p in parents]
1783 p1, p2 = parents
1787 p1, p2 = parents
1784 self._parents = [changectx(self._repo, p) for p in (p1, p2)]
1788 self._parents = [changectx(self._repo, p) for p in (p1, p2)]
1785 files = sorted(set(files))
1789 files = sorted(set(files))
1786 self._files = files
1790 self._files = files
1787 self.substate = {}
1791 self.substate = {}
1788
1792
1789 # if store is not callable, wrap it in a function
1793 # if store is not callable, wrap it in a function
1790 if not callable(filectxfn):
1794 if not callable(filectxfn):
1791 def getfilectx(repo, memctx, path):
1795 def getfilectx(repo, memctx, path):
1792 fctx = filectxfn[path]
1796 fctx = filectxfn[path]
1793 # this is weird but apparently we only keep track of one parent
1797 # this is weird but apparently we only keep track of one parent
1794 # (why not only store that instead of a tuple?)
1798 # (why not only store that instead of a tuple?)
1795 copied = fctx.renamed()
1799 copied = fctx.renamed()
1796 if copied:
1800 if copied:
1797 copied = copied[0]
1801 copied = copied[0]
1798 return memfilectx(repo, path, fctx.data(),
1802 return memfilectx(repo, path, fctx.data(),
1799 islink=fctx.islink(), isexec=fctx.isexec(),
1803 islink=fctx.islink(), isexec=fctx.isexec(),
1800 copied=copied, memctx=memctx)
1804 copied=copied, memctx=memctx)
1801 self._filectxfn = getfilectx
1805 self._filectxfn = getfilectx
1802 else:
1806 else:
1803 # "util.cachefunc" reduces invocation of possibly expensive
1807 # "util.cachefunc" reduces invocation of possibly expensive
1804 # "filectxfn" for performance (e.g. converting from another VCS)
1808 # "filectxfn" for performance (e.g. converting from another VCS)
1805 self._filectxfn = util.cachefunc(filectxfn)
1809 self._filectxfn = util.cachefunc(filectxfn)
1806
1810
1807 if extra:
1811 if extra:
1808 self._extra = extra.copy()
1812 self._extra = extra.copy()
1809 else:
1813 else:
1810 self._extra = {}
1814 self._extra = {}
1811
1815
1812 if self._extra.get('branch', '') == '':
1816 if self._extra.get('branch', '') == '':
1813 self._extra['branch'] = 'default'
1817 self._extra['branch'] = 'default'
1814
1818
1815 if editor:
1819 if editor:
1816 self._text = editor(self._repo, self, [])
1820 self._text = editor(self._repo, self, [])
1817 self._repo.savecommitmessage(self._text)
1821 self._repo.savecommitmessage(self._text)
1818
1822
1819 def filectx(self, path, filelog=None):
1823 def filectx(self, path, filelog=None):
1820 """get a file context from the working directory
1824 """get a file context from the working directory
1821
1825
1822 Returns None if file doesn't exist and should be removed."""
1826 Returns None if file doesn't exist and should be removed."""
1823 return self._filectxfn(self._repo, self, path)
1827 return self._filectxfn(self._repo, self, path)
1824
1828
1825 def commit(self):
1829 def commit(self):
1826 """commit context to the repo"""
1830 """commit context to the repo"""
1827 return self._repo.commitctx(self)
1831 return self._repo.commitctx(self)
1828
1832
1829 @propertycache
1833 @propertycache
1830 def _manifest(self):
1834 def _manifest(self):
1831 """generate a manifest based on the return values of filectxfn"""
1835 """generate a manifest based on the return values of filectxfn"""
1832
1836
1833 # keep this simple for now; just worry about p1
1837 # keep this simple for now; just worry about p1
1834 pctx = self._parents[0]
1838 pctx = self._parents[0]
1835 man = pctx.manifest().copy()
1839 man = pctx.manifest().copy()
1836
1840
1837 for f in self._status.modified:
1841 for f in self._status.modified:
1838 p1node = nullid
1842 p1node = nullid
1839 p2node = nullid
1843 p2node = nullid
1840 p = pctx[f].parents() # if file isn't in pctx, check p2?
1844 p = pctx[f].parents() # if file isn't in pctx, check p2?
1841 if len(p) > 0:
1845 if len(p) > 0:
1842 p1node = p[0].node()
1846 p1node = p[0].node()
1843 if len(p) > 1:
1847 if len(p) > 1:
1844 p2node = p[1].node()
1848 p2node = p[1].node()
1845 man[f] = revlog.hash(self[f].data(), p1node, p2node)
1849 man[f] = revlog.hash(self[f].data(), p1node, p2node)
1846
1850
1847 for f in self._status.added:
1851 for f in self._status.added:
1848 man[f] = revlog.hash(self[f].data(), nullid, nullid)
1852 man[f] = revlog.hash(self[f].data(), nullid, nullid)
1849
1853
1850 for f in self._status.removed:
1854 for f in self._status.removed:
1851 if f in man:
1855 if f in man:
1852 del man[f]
1856 del man[f]
1853
1857
1854 return man
1858 return man
1855
1859
1856 @propertycache
1860 @propertycache
1857 def _status(self):
1861 def _status(self):
1858 """Calculate exact status from ``files`` specified at construction
1862 """Calculate exact status from ``files`` specified at construction
1859 """
1863 """
1860 man1 = self.p1().manifest()
1864 man1 = self.p1().manifest()
1861 p2 = self._parents[1]
1865 p2 = self._parents[1]
1862 # "1 < len(self._parents)" can't be used for checking
1866 # "1 < len(self._parents)" can't be used for checking
1863 # existence of the 2nd parent, because "memctx._parents" is
1867 # existence of the 2nd parent, because "memctx._parents" is
1864 # explicitly initialized by the list, of which length is 2.
1868 # explicitly initialized by the list, of which length is 2.
1865 if p2.node() != nullid:
1869 if p2.node() != nullid:
1866 man2 = p2.manifest()
1870 man2 = p2.manifest()
1867 managing = lambda f: f in man1 or f in man2
1871 managing = lambda f: f in man1 or f in man2
1868 else:
1872 else:
1869 managing = lambda f: f in man1
1873 managing = lambda f: f in man1
1870
1874
1871 modified, added, removed = [], [], []
1875 modified, added, removed = [], [], []
1872 for f in self._files:
1876 for f in self._files:
1873 if not managing(f):
1877 if not managing(f):
1874 added.append(f)
1878 added.append(f)
1875 elif self[f]:
1879 elif self[f]:
1876 modified.append(f)
1880 modified.append(f)
1877 else:
1881 else:
1878 removed.append(f)
1882 removed.append(f)
1879
1883
1880 return scmutil.status(modified, added, removed, [], [], [], [])
1884 return scmutil.status(modified, added, removed, [], [], [], [])
1881
1885
1882 class memfilectx(committablefilectx):
1886 class memfilectx(committablefilectx):
1883 """memfilectx represents an in-memory file to commit.
1887 """memfilectx represents an in-memory file to commit.
1884
1888
1885 See memctx and committablefilectx for more details.
1889 See memctx and committablefilectx for more details.
1886 """
1890 """
1887 def __init__(self, repo, path, data, islink=False,
1891 def __init__(self, repo, path, data, islink=False,
1888 isexec=False, copied=None, memctx=None):
1892 isexec=False, copied=None, memctx=None):
1889 """
1893 """
1890 path is the normalized file path relative to repository root.
1894 path is the normalized file path relative to repository root.
1891 data is the file content as a string.
1895 data is the file content as a string.
1892 islink is True if the file is a symbolic link.
1896 islink is True if the file is a symbolic link.
1893 isexec is True if the file is executable.
1897 isexec is True if the file is executable.
1894 copied is the source file path if current file was copied in the
1898 copied is the source file path if current file was copied in the
1895 revision being committed, or None."""
1899 revision being committed, or None."""
1896 super(memfilectx, self).__init__(repo, path, None, memctx)
1900 super(memfilectx, self).__init__(repo, path, None, memctx)
1897 self._data = data
1901 self._data = data
1898 self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
1902 self._flags = (islink and 'l' or '') + (isexec and 'x' or '')
1899 self._copied = None
1903 self._copied = None
1900 if copied:
1904 if copied:
1901 self._copied = (copied, nullid)
1905 self._copied = (copied, nullid)
1902
1906
1903 def data(self):
1907 def data(self):
1904 return self._data
1908 return self._data
1905 def size(self):
1909 def size(self):
1906 return len(self.data())
1910 return len(self.data())
1907 def flags(self):
1911 def flags(self):
1908 return self._flags
1912 return self._flags
1909 def renamed(self):
1913 def renamed(self):
1910 return self._copied
1914 return self._copied
1911
1915
1912 def remove(self, ignoremissing=False):
1916 def remove(self, ignoremissing=False):
1913 """wraps unlink for a repo's working directory"""
1917 """wraps unlink for a repo's working directory"""
1914 # need to figure out what to do here
1918 # need to figure out what to do here
1915 del self._changectx[self._path]
1919 del self._changectx[self._path]
1916
1920
1917 def write(self, data, flags):
1921 def write(self, data, flags):
1918 """wraps repo.wwrite"""
1922 """wraps repo.wwrite"""
1919 self._data = data
1923 self._data = data
@@ -1,1093 +1,1089 b''
1 This file contains testcases that tend to be related to special cases or less
1 This file contains testcases that tend to be related to special cases or less
2 common commands affecting largefile.
2 common commands affecting largefile.
3
3
4 Each sections should be independent of each others.
4 Each sections should be independent of each others.
5
5
6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
6 $ USERCACHE="$TESTTMP/cache"; export USERCACHE
7 $ mkdir "${USERCACHE}"
7 $ mkdir "${USERCACHE}"
8 $ cat >> $HGRCPATH <<EOF
8 $ cat >> $HGRCPATH <<EOF
9 > [extensions]
9 > [extensions]
10 > largefiles=
10 > largefiles=
11 > purge=
11 > purge=
12 > rebase=
12 > rebase=
13 > transplant=
13 > transplant=
14 > [phases]
14 > [phases]
15 > publish=False
15 > publish=False
16 > [largefiles]
16 > [largefiles]
17 > minsize=2
17 > minsize=2
18 > patterns=glob:**.dat
18 > patterns=glob:**.dat
19 > usercache=${USERCACHE}
19 > usercache=${USERCACHE}
20 > [hooks]
20 > [hooks]
21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
21 > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status"
22 > EOF
22 > EOF
23
23
24
24
25
25
26 Test copies and moves from a directory other than root (issue3516)
26 Test copies and moves from a directory other than root (issue3516)
27 =========================================================================
27 =========================================================================
28
28
29 $ hg init lf_cpmv
29 $ hg init lf_cpmv
30 $ cd lf_cpmv
30 $ cd lf_cpmv
31 $ mkdir dira
31 $ mkdir dira
32 $ mkdir dira/dirb
32 $ mkdir dira/dirb
33 $ touch dira/dirb/largefile
33 $ touch dira/dirb/largefile
34 $ hg add --large dira/dirb/largefile
34 $ hg add --large dira/dirb/largefile
35 $ hg commit -m "added"
35 $ hg commit -m "added"
36 Invoking status precommit hook
36 Invoking status precommit hook
37 A dira/dirb/largefile
37 A dira/dirb/largefile
38 $ cd dira
38 $ cd dira
39 $ hg cp dirb/largefile foo/largefile
39 $ hg cp dirb/largefile foo/largefile
40
40
41 TODO: Ideally, this should mention the largefile, not the standin
41 TODO: Ideally, this should mention the largefile, not the standin
42 $ hg log -T '{rev}\n' --stat 'set:clean()'
42 $ hg log -T '{rev}\n' --stat 'set:clean()'
43 0
43 0
44 .hglf/dira/dirb/largefile | 1 +
44 .hglf/dira/dirb/largefile | 1 +
45 1 files changed, 1 insertions(+), 0 deletions(-)
45 1 files changed, 1 insertions(+), 0 deletions(-)
46
46
47 $ hg ci -m "deep copy"
47 $ hg ci -m "deep copy"
48 Invoking status precommit hook
48 Invoking status precommit hook
49 A dira/foo/largefile
49 A dira/foo/largefile
50 $ find . | sort
50 $ find . | sort
51 .
51 .
52 ./dirb
52 ./dirb
53 ./dirb/largefile
53 ./dirb/largefile
54 ./foo
54 ./foo
55 ./foo/largefile
55 ./foo/largefile
56 $ hg mv foo/largefile baz/largefile
56 $ hg mv foo/largefile baz/largefile
57 $ hg ci -m "moved"
57 $ hg ci -m "moved"
58 Invoking status precommit hook
58 Invoking status precommit hook
59 A dira/baz/largefile
59 A dira/baz/largefile
60 R dira/foo/largefile
60 R dira/foo/largefile
61 $ find . | sort
61 $ find . | sort
62 .
62 .
63 ./baz
63 ./baz
64 ./baz/largefile
64 ./baz/largefile
65 ./dirb
65 ./dirb
66 ./dirb/largefile
66 ./dirb/largefile
67 $ cd ..
67 $ cd ..
68 $ hg mv dira dirc
68 $ hg mv dira dirc
69 moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
69 moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
70 moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
70 moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
71 $ find * | sort
71 $ find * | sort
72 dirc
72 dirc
73 dirc/baz
73 dirc/baz
74 dirc/baz/largefile
74 dirc/baz/largefile
75 dirc/dirb
75 dirc/dirb
76 dirc/dirb/largefile
76 dirc/dirb/largefile
77
77
78 $ hg clone -q . ../fetch
78 $ hg clone -q . ../fetch
79 $ hg --config extensions.fetch= fetch ../fetch
79 $ hg --config extensions.fetch= fetch ../fetch
80 abort: uncommitted changes
80 abort: uncommitted changes
81 [255]
81 [255]
82 $ hg up -qC
82 $ hg up -qC
83 $ cd ..
83 $ cd ..
84
84
85 Clone a local repository owned by another user
85 Clone a local repository owned by another user
86 ===================================================
86 ===================================================
87
87
88 #if unix-permissions
88 #if unix-permissions
89
89
90 We have to simulate that here by setting $HOME and removing write permissions
90 We have to simulate that here by setting $HOME and removing write permissions
91 $ ORIGHOME="$HOME"
91 $ ORIGHOME="$HOME"
92 $ mkdir alice
92 $ mkdir alice
93 $ HOME="`pwd`/alice"
93 $ HOME="`pwd`/alice"
94 $ cd alice
94 $ cd alice
95 $ hg init pubrepo
95 $ hg init pubrepo
96 $ cd pubrepo
96 $ cd pubrepo
97 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
97 $ dd if=/dev/zero bs=1k count=11k > a-large-file 2> /dev/null
98 $ hg add --large a-large-file
98 $ hg add --large a-large-file
99 $ hg commit -m "Add a large file"
99 $ hg commit -m "Add a large file"
100 Invoking status precommit hook
100 Invoking status precommit hook
101 A a-large-file
101 A a-large-file
102 $ cd ..
102 $ cd ..
103 $ chmod -R a-w pubrepo
103 $ chmod -R a-w pubrepo
104 $ cd ..
104 $ cd ..
105 $ mkdir bob
105 $ mkdir bob
106 $ HOME="`pwd`/bob"
106 $ HOME="`pwd`/bob"
107 $ cd bob
107 $ cd bob
108 $ hg clone --pull ../alice/pubrepo pubrepo
108 $ hg clone --pull ../alice/pubrepo pubrepo
109 requesting all changes
109 requesting all changes
110 adding changesets
110 adding changesets
111 adding manifests
111 adding manifests
112 adding file changes
112 adding file changes
113 added 1 changesets with 1 changes to 1 files
113 added 1 changesets with 1 changes to 1 files
114 updating to branch default
114 updating to branch default
115 getting changed largefiles
115 getting changed largefiles
116 1 largefiles updated, 0 removed
116 1 largefiles updated, 0 removed
117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 $ cd ..
118 $ cd ..
119 $ chmod -R u+w alice/pubrepo
119 $ chmod -R u+w alice/pubrepo
120 $ HOME="$ORIGHOME"
120 $ HOME="$ORIGHOME"
121
121
122 #endif
122 #endif
123
123
124
124
125 Symlink to a large largefile should behave the same as a symlink to a normal file
125 Symlink to a large largefile should behave the same as a symlink to a normal file
126 =====================================================================================
126 =====================================================================================
127
127
128 #if symlink
128 #if symlink
129
129
130 $ hg init largesymlink
130 $ hg init largesymlink
131 $ cd largesymlink
131 $ cd largesymlink
132 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
132 $ dd if=/dev/zero bs=1k count=10k of=largefile 2>/dev/null
133 $ hg add --large largefile
133 $ hg add --large largefile
134 $ hg commit -m "commit a large file"
134 $ hg commit -m "commit a large file"
135 Invoking status precommit hook
135 Invoking status precommit hook
136 A largefile
136 A largefile
137 $ ln -s largefile largelink
137 $ ln -s largefile largelink
138 $ hg add largelink
138 $ hg add largelink
139 $ hg commit -m "commit a large symlink"
139 $ hg commit -m "commit a large symlink"
140 Invoking status precommit hook
140 Invoking status precommit hook
141 A largelink
141 A largelink
142 $ rm -f largelink
142 $ rm -f largelink
143 $ hg up >/dev/null
143 $ hg up >/dev/null
144 $ test -f largelink
144 $ test -f largelink
145 [1]
145 [1]
146 $ test -L largelink
146 $ test -L largelink
147 [1]
147 [1]
148 $ rm -f largelink # make next part of the test independent of the previous
148 $ rm -f largelink # make next part of the test independent of the previous
149 $ hg up -C >/dev/null
149 $ hg up -C >/dev/null
150 $ test -f largelink
150 $ test -f largelink
151 $ test -L largelink
151 $ test -L largelink
152 $ cd ..
152 $ cd ..
153
153
154 #endif
154 #endif
155
155
156
156
157 test for pattern matching on 'hg status':
157 test for pattern matching on 'hg status':
158 ==============================================
158 ==============================================
159
159
160
160
161 to boost performance, largefiles checks whether specified patterns are
161 to boost performance, largefiles checks whether specified patterns are
162 related to largefiles in working directory (NOT to STANDIN) or not.
162 related to largefiles in working directory (NOT to STANDIN) or not.
163
163
164 $ hg init statusmatch
164 $ hg init statusmatch
165 $ cd statusmatch
165 $ cd statusmatch
166
166
167 $ mkdir -p a/b/c/d
167 $ mkdir -p a/b/c/d
168 $ echo normal > a/b/c/d/e.normal.txt
168 $ echo normal > a/b/c/d/e.normal.txt
169 $ hg add a/b/c/d/e.normal.txt
169 $ hg add a/b/c/d/e.normal.txt
170 $ echo large > a/b/c/d/e.large.txt
170 $ echo large > a/b/c/d/e.large.txt
171 $ hg add --large a/b/c/d/e.large.txt
171 $ hg add --large a/b/c/d/e.large.txt
172 $ mkdir -p a/b/c/x
172 $ mkdir -p a/b/c/x
173 $ echo normal > a/b/c/x/y.normal.txt
173 $ echo normal > a/b/c/x/y.normal.txt
174 $ hg add a/b/c/x/y.normal.txt
174 $ hg add a/b/c/x/y.normal.txt
175 $ hg commit -m 'add files'
175 $ hg commit -m 'add files'
176 Invoking status precommit hook
176 Invoking status precommit hook
177 A a/b/c/d/e.large.txt
177 A a/b/c/d/e.large.txt
178 A a/b/c/d/e.normal.txt
178 A a/b/c/d/e.normal.txt
179 A a/b/c/x/y.normal.txt
179 A a/b/c/x/y.normal.txt
180
180
181 (1) no pattern: no performance boost
181 (1) no pattern: no performance boost
182 $ hg status -A
182 $ hg status -A
183 C a/b/c/d/e.large.txt
183 C a/b/c/d/e.large.txt
184 C a/b/c/d/e.normal.txt
184 C a/b/c/d/e.normal.txt
185 C a/b/c/x/y.normal.txt
185 C a/b/c/x/y.normal.txt
186
186
187 (2) pattern not related to largefiles: performance boost
187 (2) pattern not related to largefiles: performance boost
188 $ hg status -A a/b/c/x
188 $ hg status -A a/b/c/x
189 C a/b/c/x/y.normal.txt
189 C a/b/c/x/y.normal.txt
190
190
191 (3) pattern related to largefiles: no performance boost
191 (3) pattern related to largefiles: no performance boost
192 $ hg status -A a/b/c/d
192 $ hg status -A a/b/c/d
193 C a/b/c/d/e.large.txt
193 C a/b/c/d/e.large.txt
194 C a/b/c/d/e.normal.txt
194 C a/b/c/d/e.normal.txt
195
195
196 (4) pattern related to STANDIN (not to largefiles): performance boost
196 (4) pattern related to STANDIN (not to largefiles): performance boost
197 $ hg status -A .hglf/a
197 $ hg status -A .hglf/a
198 C .hglf/a/b/c/d/e.large.txt
198 C .hglf/a/b/c/d/e.large.txt
199
199
200 (5) mixed case: no performance boost
200 (5) mixed case: no performance boost
201 $ hg status -A a/b/c/x a/b/c/d
201 $ hg status -A a/b/c/x a/b/c/d
202 C a/b/c/d/e.large.txt
202 C a/b/c/d/e.large.txt
203 C a/b/c/d/e.normal.txt
203 C a/b/c/d/e.normal.txt
204 C a/b/c/x/y.normal.txt
204 C a/b/c/x/y.normal.txt
205
205
206 verify that largefiles doesn't break filesets
206 verify that largefiles doesn't break filesets
207
207
208 $ hg log --rev . --exclude "set:binary()"
208 $ hg log --rev . --exclude "set:binary()"
209 changeset: 0:41bd42f10efa
209 changeset: 0:41bd42f10efa
210 tag: tip
210 tag: tip
211 user: test
211 user: test
212 date: Thu Jan 01 00:00:00 1970 +0000
212 date: Thu Jan 01 00:00:00 1970 +0000
213 summary: add files
213 summary: add files
214
214
215 verify that large files in subrepos handled properly
215 verify that large files in subrepos handled properly
216 $ hg init subrepo
216 $ hg init subrepo
217 $ echo "subrepo = subrepo" > .hgsub
217 $ echo "subrepo = subrepo" > .hgsub
218 $ hg add .hgsub
218 $ hg add .hgsub
219 $ hg ci -m "add subrepo"
219 $ hg ci -m "add subrepo"
220 Invoking status precommit hook
220 Invoking status precommit hook
221 A .hgsub
221 A .hgsub
222 ? .hgsubstate
222 ? .hgsubstate
223 $ echo "rev 1" > subrepo/large.txt
223 $ echo "rev 1" > subrepo/large.txt
224 $ hg add --large subrepo/large.txt
224 $ hg add --large subrepo/large.txt
225 $ hg sum
225 $ hg sum
226 parent: 1:8ee150ea2e9c tip
226 parent: 1:8ee150ea2e9c tip
227 add subrepo
227 add subrepo
228 branch: default
228 branch: default
229 commit: 1 subrepos
229 commit: 1 subrepos
230 update: (current)
230 update: (current)
231 phases: 2 draft
231 phases: 2 draft
232 $ hg st
232 $ hg st
233 $ hg st -S
233 $ hg st -S
234 A subrepo/large.txt
234 A subrepo/large.txt
235 $ hg ci -S -m "commit top repo"
235 $ hg ci -S -m "commit top repo"
236 committing subrepository subrepo
236 committing subrepository subrepo
237 Invoking status precommit hook
237 Invoking status precommit hook
238 A large.txt
238 A large.txt
239 Invoking status precommit hook
239 Invoking status precommit hook
240 M .hgsubstate
240 M .hgsubstate
241 # No differences
241 # No differences
242 $ hg st -S
242 $ hg st -S
243 $ hg sum
243 $ hg sum
244 parent: 2:ce4cd0c527a6 tip
244 parent: 2:ce4cd0c527a6 tip
245 commit top repo
245 commit top repo
246 branch: default
246 branch: default
247 commit: (clean)
247 commit: (clean)
248 update: (current)
248 update: (current)
249 phases: 3 draft
249 phases: 3 draft
250 $ echo "rev 2" > subrepo/large.txt
250 $ echo "rev 2" > subrepo/large.txt
251 $ hg st -S
251 $ hg st -S
252 M subrepo/large.txt
252 M subrepo/large.txt
253 $ hg sum
253 $ hg sum
254 parent: 2:ce4cd0c527a6 tip
254 parent: 2:ce4cd0c527a6 tip
255 commit top repo
255 commit top repo
256 branch: default
256 branch: default
257 commit: 1 subrepos
257 commit: 1 subrepos
258 update: (current)
258 update: (current)
259 phases: 3 draft
259 phases: 3 draft
260 $ hg ci -m "this commit should fail without -S"
260 $ hg ci -m "this commit should fail without -S"
261 abort: uncommitted changes in subrepository 'subrepo'
261 abort: uncommitted changes in subrepository 'subrepo'
262 (use --subrepos for recursive commit)
262 (use --subrepos for recursive commit)
263 [255]
263 [255]
264
264
265 Add a normal file to the subrepo, then test archiving
265 Add a normal file to the subrepo, then test archiving
266
266
267 $ echo 'normal file' > subrepo/normal.txt
267 $ echo 'normal file' > subrepo/normal.txt
268 $ touch large.dat
268 $ touch large.dat
269 $ mv subrepo/large.txt subrepo/renamed-large.txt
269 $ mv subrepo/large.txt subrepo/renamed-large.txt
270 $ hg addremove -S --dry-run
270 $ hg addremove -S --dry-run
271 adding large.dat as a largefile
271 adding large.dat as a largefile
272 removing subrepo/large.txt
272 removing subrepo/large.txt
273 adding subrepo/normal.txt
273 adding subrepo/normal.txt
274 adding subrepo/renamed-large.txt
274 adding subrepo/renamed-large.txt
275 $ hg status -S
275 $ hg status -S
276 ! subrepo/large.txt
276 ! subrepo/large.txt
277 ? large.dat
277 ? large.dat
278 ? subrepo/normal.txt
278 ? subrepo/normal.txt
279 ? subrepo/renamed-large.txt
279 ? subrepo/renamed-large.txt
280
280
281 $ hg addremove --dry-run subrepo
281 $ hg addremove --dry-run subrepo
282 removing subrepo/large.txt (glob)
282 removing subrepo/large.txt (glob)
283 adding subrepo/normal.txt (glob)
283 adding subrepo/normal.txt (glob)
284 adding subrepo/renamed-large.txt (glob)
284 adding subrepo/renamed-large.txt (glob)
285 $ hg status -S
285 $ hg status -S
286 ! subrepo/large.txt
286 ! subrepo/large.txt
287 ? large.dat
287 ? large.dat
288 ? subrepo/normal.txt
288 ? subrepo/normal.txt
289 ? subrepo/renamed-large.txt
289 ? subrepo/renamed-large.txt
290 $ cd ..
290 $ cd ..
291
291
292 $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
292 $ hg -R statusmatch addremove --dry-run statusmatch/subrepo
293 removing statusmatch/subrepo/large.txt (glob)
293 removing statusmatch/subrepo/large.txt (glob)
294 adding statusmatch/subrepo/normal.txt (glob)
294 adding statusmatch/subrepo/normal.txt (glob)
295 adding statusmatch/subrepo/renamed-large.txt (glob)
295 adding statusmatch/subrepo/renamed-large.txt (glob)
296 $ hg -R statusmatch status -S
296 $ hg -R statusmatch status -S
297 ! subrepo/large.txt
297 ! subrepo/large.txt
298 ? large.dat
298 ? large.dat
299 ? subrepo/normal.txt
299 ? subrepo/normal.txt
300 ? subrepo/renamed-large.txt
300 ? subrepo/renamed-large.txt
301
301
302 $ hg -R statusmatch addremove --dry-run -S
302 $ hg -R statusmatch addremove --dry-run -S
303 adding large.dat as a largefile
303 adding large.dat as a largefile
304 removing subrepo/large.txt
304 removing subrepo/large.txt
305 adding subrepo/normal.txt
305 adding subrepo/normal.txt
306 adding subrepo/renamed-large.txt
306 adding subrepo/renamed-large.txt
307 $ cd statusmatch
307 $ cd statusmatch
308
308
309 $ mv subrepo/renamed-large.txt subrepo/large.txt
309 $ mv subrepo/renamed-large.txt subrepo/large.txt
310 $ hg addremove subrepo
310 $ hg addremove subrepo
311 adding subrepo/normal.txt (glob)
311 adding subrepo/normal.txt (glob)
312 $ hg forget subrepo/normal.txt
312 $ hg forget subrepo/normal.txt
313
313
314 $ hg addremove -S
314 $ hg addremove -S
315 adding large.dat as a largefile
315 adding large.dat as a largefile
316 adding subrepo/normal.txt
316 adding subrepo/normal.txt
317 $ rm large.dat
317 $ rm large.dat
318
318
319 $ hg addremove subrepo
319 $ hg addremove subrepo
320 $ hg addremove -S
320 $ hg addremove -S
321 removing large.dat
321 removing large.dat
322
322
323 Lock in subrepo, otherwise the change isn't archived
323 Lock in subrepo, otherwise the change isn't archived
324
324
325 $ hg ci -S -m "add normal file to top level"
325 $ hg ci -S -m "add normal file to top level"
326 committing subrepository subrepo
326 committing subrepository subrepo
327 Invoking status precommit hook
327 Invoking status precommit hook
328 M large.txt
328 M large.txt
329 A normal.txt
329 A normal.txt
330 Invoking status precommit hook
330 Invoking status precommit hook
331 M .hgsubstate
331 M .hgsubstate
332 $ hg archive -S ../lf_subrepo_archive
332 $ hg archive -S ../lf_subrepo_archive
333 $ find ../lf_subrepo_archive | sort
333 $ find ../lf_subrepo_archive | sort
334 ../lf_subrepo_archive
334 ../lf_subrepo_archive
335 ../lf_subrepo_archive/.hg_archival.txt
335 ../lf_subrepo_archive/.hg_archival.txt
336 ../lf_subrepo_archive/.hgsub
336 ../lf_subrepo_archive/.hgsub
337 ../lf_subrepo_archive/.hgsubstate
337 ../lf_subrepo_archive/.hgsubstate
338 ../lf_subrepo_archive/a
338 ../lf_subrepo_archive/a
339 ../lf_subrepo_archive/a/b
339 ../lf_subrepo_archive/a/b
340 ../lf_subrepo_archive/a/b/c
340 ../lf_subrepo_archive/a/b/c
341 ../lf_subrepo_archive/a/b/c/d
341 ../lf_subrepo_archive/a/b/c/d
342 ../lf_subrepo_archive/a/b/c/d/e.large.txt
342 ../lf_subrepo_archive/a/b/c/d/e.large.txt
343 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
343 ../lf_subrepo_archive/a/b/c/d/e.normal.txt
344 ../lf_subrepo_archive/a/b/c/x
344 ../lf_subrepo_archive/a/b/c/x
345 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
345 ../lf_subrepo_archive/a/b/c/x/y.normal.txt
346 ../lf_subrepo_archive/subrepo
346 ../lf_subrepo_archive/subrepo
347 ../lf_subrepo_archive/subrepo/large.txt
347 ../lf_subrepo_archive/subrepo/large.txt
348 ../lf_subrepo_archive/subrepo/normal.txt
348 ../lf_subrepo_archive/subrepo/normal.txt
349 $ cat ../lf_subrepo_archive/.hg_archival.txt
349 $ cat ../lf_subrepo_archive/.hg_archival.txt
350 repo: 41bd42f10efa43698cc02052ea0977771cba506d
350 repo: 41bd42f10efa43698cc02052ea0977771cba506d
351 node: d56a95e6522858bc08a724c4fe2bdee066d1c30b
351 node: d56a95e6522858bc08a724c4fe2bdee066d1c30b
352 branch: default
352 branch: default
353 latesttag: null
353 latesttag: null
354 latesttagdistance: 4
354 latesttagdistance: 4
355 changessincelatesttag: 4
355 changessincelatesttag: 4
356
356
357 Test update with subrepos.
357 Test update with subrepos.
358
358
359 $ hg update 0
359 $ hg update 0
360 getting changed largefiles
360 getting changed largefiles
361 0 largefiles updated, 1 removed
361 0 largefiles updated, 1 removed
362 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
362 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
363 $ hg status -S
363 $ hg status -S
364 $ hg update tip
364 $ hg update tip
365 getting changed largefiles
365 getting changed largefiles
366 1 largefiles updated, 0 removed
366 1 largefiles updated, 0 removed
367 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
368 $ hg status -S
368 $ hg status -S
369 # modify a large file
369 # modify a large file
370 $ echo "modified" > subrepo/large.txt
370 $ echo "modified" > subrepo/large.txt
371 $ hg st -S
371 $ hg st -S
372 M subrepo/large.txt
372 M subrepo/large.txt
373 # update -C should revert the change.
373 # update -C should revert the change.
374 $ hg update -C
374 $ hg update -C
375 getting changed largefiles
375 getting changed largefiles
376 1 largefiles updated, 0 removed
376 1 largefiles updated, 0 removed
377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
377 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
378 $ hg status -S
378 $ hg status -S
379
379
380 $ hg forget -v subrepo/large.txt
380 $ hg forget -v subrepo/large.txt
381 removing subrepo/large.txt (glob)
381 removing subrepo/large.txt (glob)
382
382
383 Test reverting a forgotten file
383 Test reverting a forgotten file
384 $ hg revert -R subrepo subrepo/large.txt
384 $ hg revert -R subrepo subrepo/large.txt
385 $ hg status -SA subrepo/large.txt
385 $ hg status -SA subrepo/large.txt
386 C subrepo/large.txt
386 C subrepo/large.txt
387
387
388 $ hg rm -v subrepo/large.txt
388 $ hg rm -v subrepo/large.txt
389 removing subrepo/large.txt (glob)
389 removing subrepo/large.txt (glob)
390 $ hg revert -R subrepo subrepo/large.txt
390 $ hg revert -R subrepo subrepo/large.txt
391 $ rm subrepo/large.txt
391 $ rm subrepo/large.txt
392 $ hg addremove -S
392 $ hg addremove -S
393 removing subrepo/large.txt
393 removing subrepo/large.txt
394 $ hg st -S
394 $ hg st -S
395 R subrepo/large.txt
395 R subrepo/large.txt
396
396
397 Test archiving a revision that references a subrepo that is not yet
397 Test archiving a revision that references a subrepo that is not yet
398 cloned (see test-subrepo-recursion.t):
398 cloned (see test-subrepo-recursion.t):
399
399
400 $ hg clone -U . ../empty
400 $ hg clone -U . ../empty
401 $ cd ../empty
401 $ cd ../empty
402 $ hg archive --subrepos -r tip ../archive.tar.gz
402 $ hg archive --subrepos -r tip ../archive.tar.gz
403 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
403 cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
404 $ cd ..
404 $ cd ..
405
405
406
406
407
407
408
408
409
409
410
410
411 Test addremove, forget and others
411 Test addremove, forget and others
412 ==============================================
412 ==============================================
413
413
414 Test that addremove picks up largefiles prior to the initial commit (issue3541)
414 Test that addremove picks up largefiles prior to the initial commit (issue3541)
415
415
416 $ hg init addrm2
416 $ hg init addrm2
417 $ cd addrm2
417 $ cd addrm2
418 $ touch large.dat
418 $ touch large.dat
419 $ touch large2.dat
419 $ touch large2.dat
420 $ touch normal
420 $ touch normal
421 $ hg add --large large.dat
421 $ hg add --large large.dat
422 $ hg addremove -v
422 $ hg addremove -v
423 adding large2.dat as a largefile
423 adding large2.dat as a largefile
424 adding normal
424 adding normal
425
425
426 Test that forgetting all largefiles reverts to islfilesrepo() == False
426 Test that forgetting all largefiles reverts to islfilesrepo() == False
427 (addremove will add *.dat as normal files now)
427 (addremove will add *.dat as normal files now)
428 $ hg forget large.dat
428 $ hg forget large.dat
429 $ hg forget large2.dat
429 $ hg forget large2.dat
430 $ hg addremove -v
430 $ hg addremove -v
431 adding large.dat
431 adding large.dat
432 adding large2.dat
432 adding large2.dat
433
433
434 Test commit's addremove option prior to the first commit
434 Test commit's addremove option prior to the first commit
435 $ hg forget large.dat
435 $ hg forget large.dat
436 $ hg forget large2.dat
436 $ hg forget large2.dat
437 $ hg add --large large.dat
437 $ hg add --large large.dat
438 $ hg ci -Am "commit"
438 $ hg ci -Am "commit"
439 adding large2.dat as a largefile
439 adding large2.dat as a largefile
440 Invoking status precommit hook
440 Invoking status precommit hook
441 A large.dat
441 A large.dat
442 A large2.dat
442 A large2.dat
443 A normal
443 A normal
444 $ find .hglf | sort
444 $ find .hglf | sort
445 .hglf
445 .hglf
446 .hglf/large.dat
446 .hglf/large.dat
447 .hglf/large2.dat
447 .hglf/large2.dat
448
448
449 Test actions on largefiles using relative paths from subdir
449 Test actions on largefiles using relative paths from subdir
450
450
451 $ mkdir sub
451 $ mkdir sub
452 $ cd sub
452 $ cd sub
453 $ echo anotherlarge > anotherlarge
453 $ echo anotherlarge > anotherlarge
454 $ hg add --large anotherlarge
454 $ hg add --large anotherlarge
455 $ hg st
455 $ hg st
456 A sub/anotherlarge
456 A sub/anotherlarge
457 $ hg st anotherlarge
457 $ hg st anotherlarge
458 A anotherlarge
458 A anotherlarge
459 $ hg commit -m anotherlarge anotherlarge
459 $ hg commit -m anotherlarge anotherlarge
460 Invoking status precommit hook
460 Invoking status precommit hook
461 A sub/anotherlarge
461 A sub/anotherlarge
462 $ hg log anotherlarge
462 $ hg log anotherlarge
463 changeset: 1:9627a577c5e9
463 changeset: 1:9627a577c5e9
464 tag: tip
464 tag: tip
465 user: test
465 user: test
466 date: Thu Jan 01 00:00:00 1970 +0000
466 date: Thu Jan 01 00:00:00 1970 +0000
467 summary: anotherlarge
467 summary: anotherlarge
468
468
469 $ hg --debug log -T '{rev}: {desc}\n' ../sub/anotherlarge
469 $ hg --debug log -T '{rev}: {desc}\n' ../sub/anotherlarge
470 updated patterns: ['../.hglf/sub/../sub/anotherlarge', '../sub/anotherlarge']
470 updated patterns: ['../.hglf/sub/../sub/anotherlarge', '../sub/anotherlarge']
471 1: anotherlarge
471 1: anotherlarge
472
472
473 $ hg log -G anotherlarge
473 $ hg log -G anotherlarge
474 @ changeset: 1:9627a577c5e9
474 @ changeset: 1:9627a577c5e9
475 | tag: tip
475 | tag: tip
476 | user: test
476 | user: test
477 | date: Thu Jan 01 00:00:00 1970 +0000
477 | date: Thu Jan 01 00:00:00 1970 +0000
478 | summary: anotherlarge
478 | summary: anotherlarge
479 |
479 |
480
480
481 $ hg log glob:another*
481 $ hg log glob:another*
482 changeset: 1:9627a577c5e9
482 changeset: 1:9627a577c5e9
483 tag: tip
483 tag: tip
484 user: test
484 user: test
485 date: Thu Jan 01 00:00:00 1970 +0000
485 date: Thu Jan 01 00:00:00 1970 +0000
486 summary: anotherlarge
486 summary: anotherlarge
487
487
488 $ hg --debug log -T '{rev}: {desc}\n' -G glob:another*
488 $ hg --debug log -T '{rev}: {desc}\n' -G glob:another*
489 updated patterns: ['glob:../.hglf/sub/another*', 'glob:another*']
489 updated patterns: ['glob:../.hglf/sub/another*', 'glob:another*']
490 @ 1: anotherlarge
490 @ 1: anotherlarge
491 |
491 |
492
492
493 #if no-msys
493 #if no-msys
494 $ hg --debug log -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
494 $ hg --debug log -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
495 updated patterns: ['glob:../.hglf/sub/another*']
495 updated patterns: ['glob:../.hglf/sub/another*']
496 1: anotherlarge
496 1: anotherlarge
497
497
498 $ hg --debug log -G -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
498 $ hg --debug log -G -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys
499 updated patterns: ['glob:../.hglf/sub/another*']
499 updated patterns: ['glob:../.hglf/sub/another*']
500 @ 1: anotherlarge
500 @ 1: anotherlarge
501 |
501 |
502 #endif
502 #endif
503
503
504 $ echo more >> anotherlarge
504 $ echo more >> anotherlarge
505 $ hg st .
505 $ hg st .
506 M anotherlarge
506 M anotherlarge
507 $ hg cat anotherlarge
507 $ hg cat anotherlarge
508 anotherlarge
508 anotherlarge
509 $ hg revert anotherlarge
509 $ hg revert anotherlarge
510 $ hg st
510 $ hg st
511 ? sub/anotherlarge.orig
511 ? sub/anotherlarge.orig
512 $ cd ..
512 $ cd ..
513
513
514 Test glob logging from the root dir
514 Test glob logging from the root dir
515 $ hg log glob:**another*
515 $ hg log glob:**another*
516 changeset: 1:9627a577c5e9
516 changeset: 1:9627a577c5e9
517 tag: tip
517 tag: tip
518 user: test
518 user: test
519 date: Thu Jan 01 00:00:00 1970 +0000
519 date: Thu Jan 01 00:00:00 1970 +0000
520 summary: anotherlarge
520 summary: anotherlarge
521
521
522 $ hg log -G glob:**another*
522 $ hg log -G glob:**another*
523 @ changeset: 1:9627a577c5e9
523 @ changeset: 1:9627a577c5e9
524 | tag: tip
524 | tag: tip
525 | user: test
525 | user: test
526 | date: Thu Jan 01 00:00:00 1970 +0000
526 | date: Thu Jan 01 00:00:00 1970 +0000
527 | summary: anotherlarge
527 | summary: anotherlarge
528 |
528 |
529
529
530 $ cd ..
530 $ cd ..
531
531
532 Log from outer space
532 Log from outer space
533 $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/sub/anotherlarge'
533 $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/sub/anotherlarge'
534 updated patterns: ['addrm2/.hglf/sub/anotherlarge', 'addrm2/sub/anotherlarge']
534 updated patterns: ['addrm2/.hglf/sub/anotherlarge', 'addrm2/sub/anotherlarge']
535 1: anotherlarge
535 1: anotherlarge
536 $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/.hglf/sub/anotherlarge'
536 $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/.hglf/sub/anotherlarge'
537 updated patterns: ['addrm2/.hglf/sub/anotherlarge']
537 updated patterns: ['addrm2/.hglf/sub/anotherlarge']
538 1: anotherlarge
538 1: anotherlarge
539
539
540
540
541 Check error message while exchange
541 Check error message while exchange
542 =========================================================
542 =========================================================
543
543
544 issue3651: summary/outgoing with largefiles shows "no remote repo"
544 issue3651: summary/outgoing with largefiles shows "no remote repo"
545 unexpectedly
545 unexpectedly
546
546
547 $ mkdir issue3651
547 $ mkdir issue3651
548 $ cd issue3651
548 $ cd issue3651
549
549
550 $ hg init src
550 $ hg init src
551 $ echo a > src/a
551 $ echo a > src/a
552 $ hg -R src add --large src/a
552 $ hg -R src add --large src/a
553 $ hg -R src commit -m '#0'
553 $ hg -R src commit -m '#0'
554 Invoking status precommit hook
554 Invoking status precommit hook
555 A a
555 A a
556
556
557 check messages when no remote repository is specified:
557 check messages when no remote repository is specified:
558 "no remote repo" route for "hg outgoing --large" is not tested here,
558 "no remote repo" route for "hg outgoing --large" is not tested here,
559 because it can't be reproduced easily.
559 because it can't be reproduced easily.
560
560
561 $ hg init clone1
561 $ hg init clone1
562 $ hg -R clone1 -q pull src
562 $ hg -R clone1 -q pull src
563 $ hg -R clone1 -q update
563 $ hg -R clone1 -q update
564 $ hg -R clone1 paths | grep default
564 $ hg -R clone1 paths | grep default
565 [1]
565 [1]
566
566
567 $ hg -R clone1 summary --large
567 $ hg -R clone1 summary --large
568 parent: 0:fc0bd45326d3 tip
568 parent: 0:fc0bd45326d3 tip
569 #0
569 #0
570 branch: default
570 branch: default
571 commit: (clean)
571 commit: (clean)
572 update: (current)
572 update: (current)
573 phases: 1 draft
573 phases: 1 draft
574 largefiles: (no remote repo)
574 largefiles: (no remote repo)
575
575
576 check messages when there is no files to upload:
576 check messages when there is no files to upload:
577
577
578 $ hg -q clone src clone2
578 $ hg -q clone src clone2
579 $ hg -R clone2 paths | grep default
579 $ hg -R clone2 paths | grep default
580 default = $TESTTMP/issue3651/src (glob)
580 default = $TESTTMP/issue3651/src (glob)
581
581
582 $ hg -R clone2 summary --large
582 $ hg -R clone2 summary --large
583 parent: 0:fc0bd45326d3 tip
583 parent: 0:fc0bd45326d3 tip
584 #0
584 #0
585 branch: default
585 branch: default
586 commit: (clean)
586 commit: (clean)
587 update: (current)
587 update: (current)
588 phases: 1 draft
588 phases: 1 draft
589 largefiles: (no files to upload)
589 largefiles: (no files to upload)
590 $ hg -R clone2 outgoing --large
590 $ hg -R clone2 outgoing --large
591 comparing with $TESTTMP/issue3651/src (glob)
591 comparing with $TESTTMP/issue3651/src (glob)
592 searching for changes
592 searching for changes
593 no changes found
593 no changes found
594 largefiles: no files to upload
594 largefiles: no files to upload
595 [1]
595 [1]
596
596
597 $ hg -R clone2 outgoing --large --graph --template "{rev}"
597 $ hg -R clone2 outgoing --large --graph --template "{rev}"
598 comparing with $TESTTMP/issue3651/src (glob)
598 comparing with $TESTTMP/issue3651/src (glob)
599 searching for changes
599 searching for changes
600 no changes found
600 no changes found
601 largefiles: no files to upload
601 largefiles: no files to upload
602
602
603 check messages when there are files to upload:
603 check messages when there are files to upload:
604
604
605 $ echo b > clone2/b
605 $ echo b > clone2/b
606 $ hg -R clone2 add --large clone2/b
606 $ hg -R clone2 add --large clone2/b
607 $ hg -R clone2 commit -m '#1'
607 $ hg -R clone2 commit -m '#1'
608 Invoking status precommit hook
608 Invoking status precommit hook
609 A b
609 A b
610 $ hg -R clone2 summary --large
610 $ hg -R clone2 summary --large
611 parent: 1:1acbe71ce432 tip
611 parent: 1:1acbe71ce432 tip
612 #1
612 #1
613 branch: default
613 branch: default
614 commit: (clean)
614 commit: (clean)
615 update: (current)
615 update: (current)
616 phases: 2 draft
616 phases: 2 draft
617 largefiles: 1 entities for 1 files to upload
617 largefiles: 1 entities for 1 files to upload
618 $ hg -R clone2 outgoing --large
618 $ hg -R clone2 outgoing --large
619 comparing with $TESTTMP/issue3651/src (glob)
619 comparing with $TESTTMP/issue3651/src (glob)
620 searching for changes
620 searching for changes
621 changeset: 1:1acbe71ce432
621 changeset: 1:1acbe71ce432
622 tag: tip
622 tag: tip
623 user: test
623 user: test
624 date: Thu Jan 01 00:00:00 1970 +0000
624 date: Thu Jan 01 00:00:00 1970 +0000
625 summary: #1
625 summary: #1
626
626
627 largefiles to upload (1 entities):
627 largefiles to upload (1 entities):
628 b
628 b
629
629
630 $ hg -R clone2 outgoing --large --graph --template "{rev}"
630 $ hg -R clone2 outgoing --large --graph --template "{rev}"
631 comparing with $TESTTMP/issue3651/src (glob)
631 comparing with $TESTTMP/issue3651/src (glob)
632 searching for changes
632 searching for changes
633 @ 1
633 @ 1
634
634
635 largefiles to upload (1 entities):
635 largefiles to upload (1 entities):
636 b
636 b
637
637
638
638
639 $ cp clone2/b clone2/b1
639 $ cp clone2/b clone2/b1
640 $ cp clone2/b clone2/b2
640 $ cp clone2/b clone2/b2
641 $ hg -R clone2 add --large clone2/b1 clone2/b2
641 $ hg -R clone2 add --large clone2/b1 clone2/b2
642 $ hg -R clone2 commit -m '#2: add largefiles referring same entity'
642 $ hg -R clone2 commit -m '#2: add largefiles referring same entity'
643 Invoking status precommit hook
643 Invoking status precommit hook
644 A b1
644 A b1
645 A b2
645 A b2
646 $ hg -R clone2 summary --large
646 $ hg -R clone2 summary --large
647 parent: 2:6095d0695d70 tip
647 parent: 2:6095d0695d70 tip
648 #2: add largefiles referring same entity
648 #2: add largefiles referring same entity
649 branch: default
649 branch: default
650 commit: (clean)
650 commit: (clean)
651 update: (current)
651 update: (current)
652 phases: 3 draft
652 phases: 3 draft
653 largefiles: 1 entities for 3 files to upload
653 largefiles: 1 entities for 3 files to upload
654 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
654 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
655 comparing with $TESTTMP/issue3651/src (glob)
655 comparing with $TESTTMP/issue3651/src (glob)
656 searching for changes
656 searching for changes
657 1:1acbe71ce432
657 1:1acbe71ce432
658 2:6095d0695d70
658 2:6095d0695d70
659 largefiles to upload (1 entities):
659 largefiles to upload (1 entities):
660 b
660 b
661 b1
661 b1
662 b2
662 b2
663
663
664 $ hg -R clone2 cat -r 1 clone2/.hglf/b
664 $ hg -R clone2 cat -r 1 clone2/.hglf/b
665 89e6c98d92887913cadf06b2adb97f26cde4849b
665 89e6c98d92887913cadf06b2adb97f26cde4849b
666 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
666 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
667 comparing with $TESTTMP/issue3651/src (glob)
667 comparing with $TESTTMP/issue3651/src (glob)
668 query 1; heads
668 query 1; heads
669 searching for changes
669 searching for changes
670 all remote heads known locally
670 all remote heads known locally
671 1:1acbe71ce432
671 1:1acbe71ce432
672 2:6095d0695d70
672 2:6095d0695d70
673 finding outgoing largefiles: 0/2 revision (0.00%)
673 finding outgoing largefiles: 0/2 revision (0.00%)
674 finding outgoing largefiles: 1/2 revision (50.00%)
674 finding outgoing largefiles: 1/2 revision (50.00%)
675 largefiles to upload (1 entities):
675 largefiles to upload (1 entities):
676 b
676 b
677 89e6c98d92887913cadf06b2adb97f26cde4849b
677 89e6c98d92887913cadf06b2adb97f26cde4849b
678 b1
678 b1
679 89e6c98d92887913cadf06b2adb97f26cde4849b
679 89e6c98d92887913cadf06b2adb97f26cde4849b
680 b2
680 b2
681 89e6c98d92887913cadf06b2adb97f26cde4849b
681 89e6c98d92887913cadf06b2adb97f26cde4849b
682
682
683
683
684 $ echo bbb > clone2/b
684 $ echo bbb > clone2/b
685 $ hg -R clone2 commit -m '#3: add new largefile entity as existing file'
685 $ hg -R clone2 commit -m '#3: add new largefile entity as existing file'
686 Invoking status precommit hook
686 Invoking status precommit hook
687 M b
687 M b
688 $ echo bbbb > clone2/b
688 $ echo bbbb > clone2/b
689 $ hg -R clone2 commit -m '#4: add new largefile entity as existing file'
689 $ hg -R clone2 commit -m '#4: add new largefile entity as existing file'
690 Invoking status precommit hook
690 Invoking status precommit hook
691 M b
691 M b
692 $ cp clone2/b1 clone2/b
692 $ cp clone2/b1 clone2/b
693 $ hg -R clone2 commit -m '#5: refer existing largefile entity again'
693 $ hg -R clone2 commit -m '#5: refer existing largefile entity again'
694 Invoking status precommit hook
694 Invoking status precommit hook
695 M b
695 M b
696 $ hg -R clone2 summary --large
696 $ hg -R clone2 summary --large
697 parent: 5:036794ea641c tip
697 parent: 5:036794ea641c tip
698 #5: refer existing largefile entity again
698 #5: refer existing largefile entity again
699 branch: default
699 branch: default
700 commit: (clean)
700 commit: (clean)
701 update: (current)
701 update: (current)
702 phases: 6 draft
702 phases: 6 draft
703 largefiles: 3 entities for 3 files to upload
703 largefiles: 3 entities for 3 files to upload
704 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
704 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
705 comparing with $TESTTMP/issue3651/src (glob)
705 comparing with $TESTTMP/issue3651/src (glob)
706 searching for changes
706 searching for changes
707 1:1acbe71ce432
707 1:1acbe71ce432
708 2:6095d0695d70
708 2:6095d0695d70
709 3:7983dce246cc
709 3:7983dce246cc
710 4:233f12ada4ae
710 4:233f12ada4ae
711 5:036794ea641c
711 5:036794ea641c
712 largefiles to upload (3 entities):
712 largefiles to upload (3 entities):
713 b
713 b
714 b1
714 b1
715 b2
715 b2
716
716
717 $ hg -R clone2 cat -r 3 clone2/.hglf/b
717 $ hg -R clone2 cat -r 3 clone2/.hglf/b
718 c801c9cfe94400963fcb683246217d5db77f9a9a
718 c801c9cfe94400963fcb683246217d5db77f9a9a
719 $ hg -R clone2 cat -r 4 clone2/.hglf/b
719 $ hg -R clone2 cat -r 4 clone2/.hglf/b
720 13f9ed0898e315bf59dc2973fec52037b6f441a2
720 13f9ed0898e315bf59dc2973fec52037b6f441a2
721 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
721 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
722 comparing with $TESTTMP/issue3651/src (glob)
722 comparing with $TESTTMP/issue3651/src (glob)
723 query 1; heads
723 query 1; heads
724 searching for changes
724 searching for changes
725 all remote heads known locally
725 all remote heads known locally
726 1:1acbe71ce432
726 1:1acbe71ce432
727 2:6095d0695d70
727 2:6095d0695d70
728 3:7983dce246cc
728 3:7983dce246cc
729 4:233f12ada4ae
729 4:233f12ada4ae
730 5:036794ea641c
730 5:036794ea641c
731 finding outgoing largefiles: 0/5 revision (0.00%)
731 finding outgoing largefiles: 0/5 revision (0.00%)
732 finding outgoing largefiles: 1/5 revision (20.00%)
732 finding outgoing largefiles: 1/5 revision (20.00%)
733 finding outgoing largefiles: 2/5 revision (40.00%)
733 finding outgoing largefiles: 2/5 revision (40.00%)
734 finding outgoing largefiles: 3/5 revision (60.00%)
734 finding outgoing largefiles: 3/5 revision (60.00%)
735 finding outgoing largefiles: 4/5 revision (80.00%)
735 finding outgoing largefiles: 4/5 revision (80.00%)
736 largefiles to upload (3 entities):
736 largefiles to upload (3 entities):
737 b
737 b
738 13f9ed0898e315bf59dc2973fec52037b6f441a2
738 13f9ed0898e315bf59dc2973fec52037b6f441a2
739 89e6c98d92887913cadf06b2adb97f26cde4849b
739 89e6c98d92887913cadf06b2adb97f26cde4849b
740 c801c9cfe94400963fcb683246217d5db77f9a9a
740 c801c9cfe94400963fcb683246217d5db77f9a9a
741 b1
741 b1
742 89e6c98d92887913cadf06b2adb97f26cde4849b
742 89e6c98d92887913cadf06b2adb97f26cde4849b
743 b2
743 b2
744 89e6c98d92887913cadf06b2adb97f26cde4849b
744 89e6c98d92887913cadf06b2adb97f26cde4849b
745
745
746
746
747 Pushing revision #1 causes uploading entity 89e6c98d9288, which is
747 Pushing revision #1 causes uploading entity 89e6c98d9288, which is
748 shared also by largefiles b1, b2 in revision #2 and b in revision #5.
748 shared also by largefiles b1, b2 in revision #2 and b in revision #5.
749
749
750 Then, entity 89e6c98d9288 is not treated as "outgoing entity" at "hg
750 Then, entity 89e6c98d9288 is not treated as "outgoing entity" at "hg
751 summary" and "hg outgoing", even though files in outgoing revision #2
751 summary" and "hg outgoing", even though files in outgoing revision #2
752 and #5 refer it.
752 and #5 refer it.
753
753
754 $ hg -R clone2 push -r 1 -q
754 $ hg -R clone2 push -r 1 -q
755 $ hg -R clone2 summary --large
755 $ hg -R clone2 summary --large
756 parent: 5:036794ea641c tip
756 parent: 5:036794ea641c tip
757 #5: refer existing largefile entity again
757 #5: refer existing largefile entity again
758 branch: default
758 branch: default
759 commit: (clean)
759 commit: (clean)
760 update: (current)
760 update: (current)
761 phases: 6 draft
761 phases: 6 draft
762 largefiles: 2 entities for 1 files to upload
762 largefiles: 2 entities for 1 files to upload
763 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
763 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n"
764 comparing with $TESTTMP/issue3651/src (glob)
764 comparing with $TESTTMP/issue3651/src (glob)
765 searching for changes
765 searching for changes
766 2:6095d0695d70
766 2:6095d0695d70
767 3:7983dce246cc
767 3:7983dce246cc
768 4:233f12ada4ae
768 4:233f12ada4ae
769 5:036794ea641c
769 5:036794ea641c
770 largefiles to upload (2 entities):
770 largefiles to upload (2 entities):
771 b
771 b
772
772
773 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
773 $ hg -R clone2 outgoing --large -T "{rev}:{node|short}\n" --debug --config progress.debug=true
774 comparing with $TESTTMP/issue3651/src (glob)
774 comparing with $TESTTMP/issue3651/src (glob)
775 query 1; heads
775 query 1; heads
776 searching for changes
776 searching for changes
777 all remote heads known locally
777 all remote heads known locally
778 2:6095d0695d70
778 2:6095d0695d70
779 3:7983dce246cc
779 3:7983dce246cc
780 4:233f12ada4ae
780 4:233f12ada4ae
781 5:036794ea641c
781 5:036794ea641c
782 finding outgoing largefiles: 0/4 revision (0.00%)
782 finding outgoing largefiles: 0/4 revision (0.00%)
783 finding outgoing largefiles: 1/4 revision (25.00%)
783 finding outgoing largefiles: 1/4 revision (25.00%)
784 finding outgoing largefiles: 2/4 revision (50.00%)
784 finding outgoing largefiles: 2/4 revision (50.00%)
785 finding outgoing largefiles: 3/4 revision (75.00%)
785 finding outgoing largefiles: 3/4 revision (75.00%)
786 largefiles to upload (2 entities):
786 largefiles to upload (2 entities):
787 b
787 b
788 13f9ed0898e315bf59dc2973fec52037b6f441a2
788 13f9ed0898e315bf59dc2973fec52037b6f441a2
789 c801c9cfe94400963fcb683246217d5db77f9a9a
789 c801c9cfe94400963fcb683246217d5db77f9a9a
790
790
791
791
792 $ cd ..
792 $ cd ..
793
793
794 merge action 'd' for 'local renamed directory to d2/g' which has no filename
794 merge action 'd' for 'local renamed directory to d2/g' which has no filename
795 ==================================================================================
795 ==================================================================================
796
796
797 $ hg init merge-action
797 $ hg init merge-action
798 $ cd merge-action
798 $ cd merge-action
799 $ touch l
799 $ touch l
800 $ hg add --large l
800 $ hg add --large l
801 $ mkdir d1
801 $ mkdir d1
802 $ touch d1/f
802 $ touch d1/f
803 $ hg ci -Aqm0
803 $ hg ci -Aqm0
804 Invoking status precommit hook
804 Invoking status precommit hook
805 A d1/f
805 A d1/f
806 A l
806 A l
807 $ echo > d1/f
807 $ echo > d1/f
808 $ touch d1/g
808 $ touch d1/g
809 $ hg ci -Aqm1
809 $ hg ci -Aqm1
810 Invoking status precommit hook
810 Invoking status precommit hook
811 M d1/f
811 M d1/f
812 A d1/g
812 A d1/g
813 $ hg up -qr0
813 $ hg up -qr0
814 $ hg mv d1 d2
814 $ hg mv d1 d2
815 moving d1/f to d2/f (glob)
815 moving d1/f to d2/f (glob)
816 $ hg ci -qm2
816 $ hg ci -qm2
817 Invoking status precommit hook
817 Invoking status precommit hook
818 A d2/f
818 A d2/f
819 R d1/f
819 R d1/f
820 $ hg merge
820 $ hg merge
821 merging d2/f and d1/f to d2/f
821 merging d2/f and d1/f to d2/f
822 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
822 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
823 (branch merge, don't forget to commit)
823 (branch merge, don't forget to commit)
824 $ cd ..
824 $ cd ..
825
825
826
826
827 Merge conflicts:
827 Merge conflicts:
828 =====================
828 =====================
829
829
830 $ hg init merge
830 $ hg init merge
831 $ cd merge
831 $ cd merge
832 $ echo 0 > f-different
832 $ echo 0 > f-different
833 $ echo 0 > f-same
833 $ echo 0 > f-same
834 $ echo 0 > f-unchanged-1
834 $ echo 0 > f-unchanged-1
835 $ echo 0 > f-unchanged-2
835 $ echo 0 > f-unchanged-2
836 $ hg add --large *
836 $ hg add --large *
837 $ hg ci -m0
837 $ hg ci -m0
838 Invoking status precommit hook
838 Invoking status precommit hook
839 A f-different
839 A f-different
840 A f-same
840 A f-same
841 A f-unchanged-1
841 A f-unchanged-1
842 A f-unchanged-2
842 A f-unchanged-2
843 $ echo tmp1 > f-unchanged-1
843 $ echo tmp1 > f-unchanged-1
844 $ echo tmp1 > f-unchanged-2
844 $ echo tmp1 > f-unchanged-2
845 $ echo tmp1 > f-same
845 $ echo tmp1 > f-same
846 $ hg ci -m1
846 $ hg ci -m1
847 Invoking status precommit hook
847 Invoking status precommit hook
848 M f-same
848 M f-same
849 M f-unchanged-1
849 M f-unchanged-1
850 M f-unchanged-2
850 M f-unchanged-2
851 $ echo 2 > f-different
851 $ echo 2 > f-different
852 $ echo 0 > f-unchanged-1
852 $ echo 0 > f-unchanged-1
853 $ echo 1 > f-unchanged-2
853 $ echo 1 > f-unchanged-2
854 $ echo 1 > f-same
854 $ echo 1 > f-same
855 $ hg ci -m2
855 $ hg ci -m2
856 Invoking status precommit hook
856 Invoking status precommit hook
857 M f-different
857 M f-different
858 M f-same
858 M f-same
859 M f-unchanged-1
859 M f-unchanged-1
860 M f-unchanged-2
860 M f-unchanged-2
861 $ hg up -qr0
861 $ hg up -qr0
862 $ echo tmp2 > f-unchanged-1
862 $ echo tmp2 > f-unchanged-1
863 $ echo tmp2 > f-unchanged-2
863 $ echo tmp2 > f-unchanged-2
864 $ echo tmp2 > f-same
864 $ echo tmp2 > f-same
865 $ hg ci -m3
865 $ hg ci -m3
866 Invoking status precommit hook
866 Invoking status precommit hook
867 M f-same
867 M f-same
868 M f-unchanged-1
868 M f-unchanged-1
869 M f-unchanged-2
869 M f-unchanged-2
870 created new head
870 created new head
871 $ echo 1 > f-different
871 $ echo 1 > f-different
872 $ echo 1 > f-unchanged-1
872 $ echo 1 > f-unchanged-1
873 $ echo 0 > f-unchanged-2
873 $ echo 0 > f-unchanged-2
874 $ echo 1 > f-same
874 $ echo 1 > f-same
875 $ hg ci -m4
875 $ hg ci -m4
876 Invoking status precommit hook
876 Invoking status precommit hook
877 M f-different
877 M f-different
878 M f-same
878 M f-same
879 M f-unchanged-1
879 M f-unchanged-1
880 M f-unchanged-2
880 M f-unchanged-2
881 $ hg merge
881 $ hg merge
882 largefile f-different has a merge conflict
882 largefile f-different has a merge conflict
883 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
883 ancestor was 09d2af8dd22201dd8d48e5dcfcaed281ff9422c7
884 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
884 keep (l)ocal e5fa44f2b31c1fb553b6021e7360d07d5d91ff5e or
885 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
885 take (o)ther 7448d8798a4380162d4b56f9b452e2f6f9e24e7a? l
886 getting changed largefiles
886 getting changed largefiles
887 1 largefiles updated, 0 removed
887 1 largefiles updated, 0 removed
888 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
888 0 files updated, 4 files merged, 0 files removed, 0 files unresolved
889 (branch merge, don't forget to commit)
889 (branch merge, don't forget to commit)
890 $ cat f-different
890 $ cat f-different
891 1
891 1
892 $ cat f-same
892 $ cat f-same
893 1
893 1
894 $ cat f-unchanged-1
894 $ cat f-unchanged-1
895 1
895 1
896 $ cat f-unchanged-2
896 $ cat f-unchanged-2
897 1
897 1
898 $ cd ..
898 $ cd ..
899
899
900 Test largefile insulation (do not enabled a side effect
900 Test largefile insulation (do not enabled a side effect
901 ========================================================
901 ========================================================
902
902
903 Check whether "largefiles" feature is supported only in repositories
903 Check whether "largefiles" feature is supported only in repositories
904 enabling largefiles extension.
904 enabling largefiles extension.
905
905
906 $ mkdir individualenabling
906 $ mkdir individualenabling
907 $ cd individualenabling
907 $ cd individualenabling
908
908
909 $ hg init enabledlocally
909 $ hg init enabledlocally
910 $ echo large > enabledlocally/large
910 $ echo large > enabledlocally/large
911 $ hg -R enabledlocally add --large enabledlocally/large
911 $ hg -R enabledlocally add --large enabledlocally/large
912 $ hg -R enabledlocally commit -m '#0'
912 $ hg -R enabledlocally commit -m '#0'
913 Invoking status precommit hook
913 Invoking status precommit hook
914 A large
914 A large
915
915
916 $ hg init notenabledlocally
916 $ hg init notenabledlocally
917 $ echo large > notenabledlocally/large
917 $ echo large > notenabledlocally/large
918 $ hg -R notenabledlocally add --large notenabledlocally/large
918 $ hg -R notenabledlocally add --large notenabledlocally/large
919 $ hg -R notenabledlocally commit -m '#0'
919 $ hg -R notenabledlocally commit -m '#0'
920 Invoking status precommit hook
920 Invoking status precommit hook
921 A large
921 A large
922
922
923 $ cat >> $HGRCPATH <<EOF
923 $ cat >> $HGRCPATH <<EOF
924 > [extensions]
924 > [extensions]
925 > # disable globally
925 > # disable globally
926 > largefiles=!
926 > largefiles=!
927 > EOF
927 > EOF
928 $ cat >> enabledlocally/.hg/hgrc <<EOF
928 $ cat >> enabledlocally/.hg/hgrc <<EOF
929 > [extensions]
929 > [extensions]
930 > # enable locally
930 > # enable locally
931 > largefiles=
931 > largefiles=
932 > EOF
932 > EOF
933 $ hg -R enabledlocally root
933 $ hg -R enabledlocally root
934 $TESTTMP/individualenabling/enabledlocally (glob)
934 $TESTTMP/individualenabling/enabledlocally (glob)
935 $ hg -R notenabledlocally root
935 $ hg -R notenabledlocally root
936 abort: repository requires features unknown to this Mercurial: largefiles!
936 abort: repository requires features unknown to this Mercurial: largefiles!
937 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
937 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
938 [255]
938 [255]
939
939
940 $ hg init push-dst
940 $ hg init push-dst
941 $ hg -R enabledlocally push push-dst
941 $ hg -R enabledlocally push push-dst
942 pushing to push-dst
942 pushing to push-dst
943 abort: required features are not supported in the destination: largefiles
943 abort: required features are not supported in the destination: largefiles
944 [255]
944 [255]
945
945
946 $ hg init pull-src
946 $ hg init pull-src
947 $ hg -R pull-src pull enabledlocally
947 $ hg -R pull-src pull enabledlocally
948 pulling from enabledlocally
948 pulling from enabledlocally
949 abort: required features are not supported in the destination: largefiles
949 abort: required features are not supported in the destination: largefiles
950 [255]
950 [255]
951
951
952 $ hg clone enabledlocally clone-dst
952 $ hg clone enabledlocally clone-dst
953 abort: repository requires features unknown to this Mercurial: largefiles!
953 abort: repository requires features unknown to this Mercurial: largefiles!
954 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
954 (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)
955 [255]
955 [255]
956 $ test -d clone-dst
956 $ test -d clone-dst
957 [1]
957 [1]
958 $ hg clone --pull enabledlocally clone-pull-dst
958 $ hg clone --pull enabledlocally clone-pull-dst
959 abort: required features are not supported in the destination: largefiles
959 abort: required features are not supported in the destination: largefiles
960 [255]
960 [255]
961 $ test -d clone-pull-dst
961 $ test -d clone-pull-dst
962 [1]
962 [1]
963
963
964 #if serve
964 #if serve
965
965
966 Test largefiles specific peer setup, when largefiles is enabled
966 Test largefiles specific peer setup, when largefiles is enabled
967 locally (issue4109)
967 locally (issue4109)
968
968
969 $ hg showconfig extensions | grep largefiles
969 $ hg showconfig extensions | grep largefiles
970 extensions.largefiles=!
970 extensions.largefiles=!
971 $ mkdir -p $TESTTMP/individualenabling/usercache
971 $ mkdir -p $TESTTMP/individualenabling/usercache
972
972
973 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
973 $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid
974 $ cat hg.pid >> $DAEMON_PIDS
974 $ cat hg.pid >> $DAEMON_PIDS
975
975
976 $ hg init pull-dst
976 $ hg init pull-dst
977 $ cat > pull-dst/.hg/hgrc <<EOF
977 $ cat > pull-dst/.hg/hgrc <<EOF
978 > [extensions]
978 > [extensions]
979 > # enable locally
979 > # enable locally
980 > largefiles=
980 > largefiles=
981 > [largefiles]
981 > [largefiles]
982 > # ignore system cache to force largefiles specific wire proto access
982 > # ignore system cache to force largefiles specific wire proto access
983 > usercache=$TESTTMP/individualenabling/usercache
983 > usercache=$TESTTMP/individualenabling/usercache
984 > EOF
984 > EOF
985 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
985 $ hg -R pull-dst -q pull -u http://localhost:$HGPORT
986
986
987 $ killdaemons.py
987 $ killdaemons.py
988 #endif
988 #endif
989
989
990 Test overridden functions work correctly even for repos disabling
990 Test overridden functions work correctly even for repos disabling
991 largefiles (issue4547)
991 largefiles (issue4547)
992
992
993 $ hg showconfig extensions | grep largefiles
993 $ hg showconfig extensions | grep largefiles
994 extensions.largefiles=!
994 extensions.largefiles=!
995
995
996 (test updating implied by clone)
996 (test updating implied by clone)
997
997
998 $ hg init enabled-but-no-largefiles
998 $ hg init enabled-but-no-largefiles
999 $ echo normal1 > enabled-but-no-largefiles/normal1
999 $ echo normal1 > enabled-but-no-largefiles/normal1
1000 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal1
1000 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal1
1001 $ hg -R enabled-but-no-largefiles commit -m '#0@enabled-but-no-largefiles'
1001 $ hg -R enabled-but-no-largefiles commit -m '#0@enabled-but-no-largefiles'
1002 Invoking status precommit hook
1002 Invoking status precommit hook
1003 A normal1
1003 A normal1
1004 $ cat >> enabled-but-no-largefiles/.hg/hgrc <<EOF
1004 $ cat >> enabled-but-no-largefiles/.hg/hgrc <<EOF
1005 > [extensions]
1005 > [extensions]
1006 > # enable locally
1006 > # enable locally
1007 > largefiles=
1007 > largefiles=
1008 > EOF
1008 > EOF
1009 $ hg clone -q enabled-but-no-largefiles no-largefiles
1009 $ hg clone -q enabled-but-no-largefiles no-largefiles
1010
1010
1011 (test rebasing implied by pull: precommit while rebasing unexpectedly
1012 shows "normal3" as "?", because lfdirstate isn't yet written out at
1013 that time)
1014
1015 $ echo normal2 > enabled-but-no-largefiles/normal2
1011 $ echo normal2 > enabled-but-no-largefiles/normal2
1016 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal2
1012 $ hg -R enabled-but-no-largefiles add enabled-but-no-largefiles/normal2
1017 $ hg -R enabled-but-no-largefiles commit -m '#1@enabled-but-no-largefiles'
1013 $ hg -R enabled-but-no-largefiles commit -m '#1@enabled-but-no-largefiles'
1018 Invoking status precommit hook
1014 Invoking status precommit hook
1019 A normal2
1015 A normal2
1020
1016
1021 $ echo normal3 > no-largefiles/normal3
1017 $ echo normal3 > no-largefiles/normal3
1022 $ hg -R no-largefiles add no-largefiles/normal3
1018 $ hg -R no-largefiles add no-largefiles/normal3
1023 $ hg -R no-largefiles commit -m '#1@no-largefiles'
1019 $ hg -R no-largefiles commit -m '#1@no-largefiles'
1024 Invoking status precommit hook
1020 Invoking status precommit hook
1025 A normal3
1021 A normal3
1026
1022
1027 $ hg -R no-largefiles -q pull --rebase
1023 $ hg -R no-largefiles -q pull --rebase
1028 Invoking status precommit hook
1024 Invoking status precommit hook
1029 M normal3
1025 A normal3
1030
1026
1031 (test reverting)
1027 (test reverting)
1032
1028
1033 $ hg init subrepo-root
1029 $ hg init subrepo-root
1034 $ cat >> subrepo-root/.hg/hgrc <<EOF
1030 $ cat >> subrepo-root/.hg/hgrc <<EOF
1035 > [extensions]
1031 > [extensions]
1036 > # enable locally
1032 > # enable locally
1037 > largefiles=
1033 > largefiles=
1038 > EOF
1034 > EOF
1039 $ echo large > subrepo-root/large
1035 $ echo large > subrepo-root/large
1040 $ hg -R subrepo-root add --large subrepo-root/large
1036 $ hg -R subrepo-root add --large subrepo-root/large
1041 $ hg clone -q no-largefiles subrepo-root/no-largefiles
1037 $ hg clone -q no-largefiles subrepo-root/no-largefiles
1042 $ cat > subrepo-root/.hgsub <<EOF
1038 $ cat > subrepo-root/.hgsub <<EOF
1043 > no-largefiles = no-largefiles
1039 > no-largefiles = no-largefiles
1044 > EOF
1040 > EOF
1045 $ hg -R subrepo-root add subrepo-root/.hgsub
1041 $ hg -R subrepo-root add subrepo-root/.hgsub
1046 $ hg -R subrepo-root commit -m '#0'
1042 $ hg -R subrepo-root commit -m '#0'
1047 Invoking status precommit hook
1043 Invoking status precommit hook
1048 A .hgsub
1044 A .hgsub
1049 A large
1045 A large
1050 ? .hgsubstate
1046 ? .hgsubstate
1051 $ echo dirty >> subrepo-root/large
1047 $ echo dirty >> subrepo-root/large
1052 $ echo dirty >> subrepo-root/no-largefiles/normal1
1048 $ echo dirty >> subrepo-root/no-largefiles/normal1
1053 $ hg -R subrepo-root status -S
1049 $ hg -R subrepo-root status -S
1054 M large
1050 M large
1055 M no-largefiles/normal1
1051 M no-largefiles/normal1
1056 $ hg -R subrepo-root revert --all
1052 $ hg -R subrepo-root revert --all
1057 reverting subrepo-root/.hglf/large (glob)
1053 reverting subrepo-root/.hglf/large (glob)
1058 reverting subrepo no-largefiles
1054 reverting subrepo no-largefiles
1059 reverting subrepo-root/no-largefiles/normal1 (glob)
1055 reverting subrepo-root/no-largefiles/normal1 (glob)
1060
1056
1061 $ cd ..
1057 $ cd ..
1062
1058
1063
1059
1064 Test "pull --rebase" when rebase is enabled before largefiles (issue3861)
1060 Test "pull --rebase" when rebase is enabled before largefiles (issue3861)
1065 =========================================================================
1061 =========================================================================
1066
1062
1067 $ hg showconfig extensions | grep largefiles
1063 $ hg showconfig extensions | grep largefiles
1068 extensions.largefiles=!
1064 extensions.largefiles=!
1069
1065
1070 $ mkdir issue3861
1066 $ mkdir issue3861
1071 $ cd issue3861
1067 $ cd issue3861
1072 $ hg init src
1068 $ hg init src
1073 $ hg clone -q src dst
1069 $ hg clone -q src dst
1074 $ echo a > src/a
1070 $ echo a > src/a
1075 $ hg -R src commit -Aqm "#0"
1071 $ hg -R src commit -Aqm "#0"
1076 Invoking status precommit hook
1072 Invoking status precommit hook
1077 A a
1073 A a
1078
1074
1079 $ cat >> dst/.hg/hgrc <<EOF
1075 $ cat >> dst/.hg/hgrc <<EOF
1080 > [extensions]
1076 > [extensions]
1081 > largefiles=
1077 > largefiles=
1082 > EOF
1078 > EOF
1083 $ hg -R dst pull --rebase
1079 $ hg -R dst pull --rebase
1084 pulling from $TESTTMP/issue3861/src (glob)
1080 pulling from $TESTTMP/issue3861/src (glob)
1085 requesting all changes
1081 requesting all changes
1086 adding changesets
1082 adding changesets
1087 adding manifests
1083 adding manifests
1088 adding file changes
1084 adding file changes
1089 added 1 changesets with 1 changes to 1 files
1085 added 1 changesets with 1 changes to 1 files
1090 nothing to rebase - working directory parent is already an ancestor of destination bf5e395ced2c
1086 nothing to rebase - working directory parent is already an ancestor of destination bf5e395ced2c
1091 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1087 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1092
1088
1093 $ cd ..
1089 $ cd ..
@@ -1,1003 +1,1030 b''
1 test merge-tools configuration - mostly exercising filemerge.py
1 test merge-tools configuration - mostly exercising filemerge.py
2
2
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
3 $ unset HGMERGE # make sure HGMERGE doesn't interfere with the test
4 $ hg init
4 $ hg init
5
5
6 revision 0
6 revision 0
7
7
8 $ echo "revision 0" > f
8 $ echo "revision 0" > f
9 $ echo "space" >> f
9 $ echo "space" >> f
10 $ hg commit -Am "revision 0"
10 $ hg commit -Am "revision 0"
11 adding f
11 adding f
12
12
13 revision 1
13 revision 1
14
14
15 $ echo "revision 1" > f
15 $ echo "revision 1" > f
16 $ echo "space" >> f
16 $ echo "space" >> f
17 $ hg commit -Am "revision 1"
17 $ hg commit -Am "revision 1"
18 $ hg update 0 > /dev/null
18 $ hg update 0 > /dev/null
19
19
20 revision 2
20 revision 2
21
21
22 $ echo "revision 2" > f
22 $ echo "revision 2" > f
23 $ echo "space" >> f
23 $ echo "space" >> f
24 $ hg commit -Am "revision 2"
24 $ hg commit -Am "revision 2"
25 created new head
25 created new head
26 $ hg update 0 > /dev/null
26 $ hg update 0 > /dev/null
27
27
28 revision 3 - simple to merge
28 revision 3 - simple to merge
29
29
30 $ echo "revision 3" >> f
30 $ echo "revision 3" >> f
31 $ hg commit -Am "revision 3"
31 $ hg commit -Am "revision 3"
32 created new head
32 created new head
33
33
34 revision 4 - hard to merge
34 revision 4 - hard to merge
35
35
36 $ hg update 0 > /dev/null
36 $ hg update 0 > /dev/null
37 $ echo "revision 4" > f
37 $ echo "revision 4" > f
38 $ hg commit -Am "revision 4"
38 $ hg commit -Am "revision 4"
39 created new head
39 created new head
40
40
41 $ echo "[merge-tools]" > .hg/hgrc
41 $ echo "[merge-tools]" > .hg/hgrc
42
42
43 $ beforemerge() {
43 $ beforemerge() {
44 > cat .hg/hgrc
44 > cat .hg/hgrc
45 > echo "# hg update -C 1"
45 > echo "# hg update -C 1"
46 > hg update -C 1 > /dev/null
46 > hg update -C 1 > /dev/null
47 > }
47 > }
48 $ aftermerge() {
48 $ aftermerge() {
49 > echo "# cat f"
49 > echo "# cat f"
50 > cat f
50 > cat f
51 > echo "# hg stat"
51 > echo "# hg stat"
52 > hg stat
52 > hg stat
53 > rm -f f.orig
53 > rm -f f.orig
54 > }
54 > }
55
55
56 Tool selection
56 Tool selection
57
57
58 default is internal merge:
58 default is internal merge:
59
59
60 $ beforemerge
60 $ beforemerge
61 [merge-tools]
61 [merge-tools]
62 # hg update -C 1
62 # hg update -C 1
63
63
64 hg merge -r 2
64 hg merge -r 2
65 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
65 override $PATH to ensure hgmerge not visible; use $PYTHON in case we're
66 running from a devel copy, not a temp installation
66 running from a devel copy, not a temp installation
67
67
68 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
68 $ PATH="$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
69 merging f
69 merging f
70 warning: conflicts during merge.
70 warning: conflicts during merge.
71 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
71 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
72 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
72 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
73 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
73 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
74 [1]
74 [1]
75 $ aftermerge
75 $ aftermerge
76 # cat f
76 # cat f
77 <<<<<<< local: ef83787e2614 - test: revision 1
77 <<<<<<< local: ef83787e2614 - test: revision 1
78 revision 1
78 revision 1
79 =======
79 =======
80 revision 2
80 revision 2
81 >>>>>>> other: 0185f4e0cf02 - test: revision 2
81 >>>>>>> other: 0185f4e0cf02 - test: revision 2
82 space
82 space
83 # hg stat
83 # hg stat
84 M f
84 M f
85 ? f.orig
85 ? f.orig
86
86
87 simplest hgrc using false for merge:
87 simplest hgrc using false for merge:
88
88
89 $ echo "false.whatever=" >> .hg/hgrc
89 $ echo "false.whatever=" >> .hg/hgrc
90 $ beforemerge
90 $ beforemerge
91 [merge-tools]
91 [merge-tools]
92 false.whatever=
92 false.whatever=
93 # hg update -C 1
93 # hg update -C 1
94 $ hg merge -r 2
94 $ hg merge -r 2
95 merging f
95 merging f
96 merging f failed!
96 merging f failed!
97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
97 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
98 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
98 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
99 [1]
99 [1]
100 $ aftermerge
100 $ aftermerge
101 # cat f
101 # cat f
102 revision 1
102 revision 1
103 space
103 space
104 # hg stat
104 # hg stat
105 M f
105 M f
106 ? f.orig
106 ? f.orig
107
107
108 #if unix-permissions
108 #if unix-permissions
109
109
110 unexecutable file in $PATH shouldn't be found:
110 unexecutable file in $PATH shouldn't be found:
111
111
112 $ echo "echo fail" > false
112 $ echo "echo fail" > false
113 $ hg up -qC 1
113 $ hg up -qC 1
114 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
114 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
115 merging f
115 merging f
116 warning: conflicts during merge.
116 warning: conflicts during merge.
117 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
117 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
118 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
118 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
119 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
119 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
120 [1]
120 [1]
121 $ rm false
121 $ rm false
122
122
123 #endif
123 #endif
124
124
125 executable directory in $PATH shouldn't be found:
125 executable directory in $PATH shouldn't be found:
126
126
127 $ mkdir false
127 $ mkdir false
128 $ hg up -qC 1
128 $ hg up -qC 1
129 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
129 $ PATH="`pwd`:$BINDIR" $PYTHON "$BINDIR"/hg merge -r 2
130 merging f
130 merging f
131 warning: conflicts during merge.
131 warning: conflicts during merge.
132 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
132 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
133 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
133 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
134 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
134 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
135 [1]
135 [1]
136 $ rmdir false
136 $ rmdir false
137
137
138 true with higher .priority gets precedence:
138 true with higher .priority gets precedence:
139
139
140 $ echo "true.priority=1" >> .hg/hgrc
140 $ echo "true.priority=1" >> .hg/hgrc
141 $ beforemerge
141 $ beforemerge
142 [merge-tools]
142 [merge-tools]
143 false.whatever=
143 false.whatever=
144 true.priority=1
144 true.priority=1
145 # hg update -C 1
145 # hg update -C 1
146 $ hg merge -r 2
146 $ hg merge -r 2
147 merging f
147 merging f
148 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
148 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
149 (branch merge, don't forget to commit)
149 (branch merge, don't forget to commit)
150 $ aftermerge
150 $ aftermerge
151 # cat f
151 # cat f
152 revision 1
152 revision 1
153 space
153 space
154 # hg stat
154 # hg stat
155 M f
155 M f
156
156
157 unless lowered on command line:
157 unless lowered on command line:
158
158
159 $ beforemerge
159 $ beforemerge
160 [merge-tools]
160 [merge-tools]
161 false.whatever=
161 false.whatever=
162 true.priority=1
162 true.priority=1
163 # hg update -C 1
163 # hg update -C 1
164 $ hg merge -r 2 --config merge-tools.true.priority=-7
164 $ hg merge -r 2 --config merge-tools.true.priority=-7
165 merging f
165 merging f
166 merging f failed!
166 merging f failed!
167 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
167 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
168 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
168 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
169 [1]
169 [1]
170 $ aftermerge
170 $ aftermerge
171 # cat f
171 # cat f
172 revision 1
172 revision 1
173 space
173 space
174 # hg stat
174 # hg stat
175 M f
175 M f
176 ? f.orig
176 ? f.orig
177
177
178 or false set higher on command line:
178 or false set higher on command line:
179
179
180 $ beforemerge
180 $ beforemerge
181 [merge-tools]
181 [merge-tools]
182 false.whatever=
182 false.whatever=
183 true.priority=1
183 true.priority=1
184 # hg update -C 1
184 # hg update -C 1
185 $ hg merge -r 2 --config merge-tools.false.priority=117
185 $ hg merge -r 2 --config merge-tools.false.priority=117
186 merging f
186 merging f
187 merging f failed!
187 merging f failed!
188 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
188 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
189 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
189 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
190 [1]
190 [1]
191 $ aftermerge
191 $ aftermerge
192 # cat f
192 # cat f
193 revision 1
193 revision 1
194 space
194 space
195 # hg stat
195 # hg stat
196 M f
196 M f
197 ? f.orig
197 ? f.orig
198
198
199 or true.executable not found in PATH:
199 or true.executable not found in PATH:
200
200
201 $ beforemerge
201 $ beforemerge
202 [merge-tools]
202 [merge-tools]
203 false.whatever=
203 false.whatever=
204 true.priority=1
204 true.priority=1
205 # hg update -C 1
205 # hg update -C 1
206 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
206 $ hg merge -r 2 --config merge-tools.true.executable=nonexistentmergetool
207 merging f
207 merging f
208 merging f failed!
208 merging f failed!
209 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
209 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
210 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
210 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
211 [1]
211 [1]
212 $ aftermerge
212 $ aftermerge
213 # cat f
213 # cat f
214 revision 1
214 revision 1
215 space
215 space
216 # hg stat
216 # hg stat
217 M f
217 M f
218 ? f.orig
218 ? f.orig
219
219
220 or true.executable with bogus path:
220 or true.executable with bogus path:
221
221
222 $ beforemerge
222 $ beforemerge
223 [merge-tools]
223 [merge-tools]
224 false.whatever=
224 false.whatever=
225 true.priority=1
225 true.priority=1
226 # hg update -C 1
226 # hg update -C 1
227 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
227 $ hg merge -r 2 --config merge-tools.true.executable=/nonexistent/mergetool
228 merging f
228 merging f
229 merging f failed!
229 merging f failed!
230 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
230 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
231 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
231 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
232 [1]
232 [1]
233 $ aftermerge
233 $ aftermerge
234 # cat f
234 # cat f
235 revision 1
235 revision 1
236 space
236 space
237 # hg stat
237 # hg stat
238 M f
238 M f
239 ? f.orig
239 ? f.orig
240
240
241 but true.executable set to cat found in PATH works:
241 but true.executable set to cat found in PATH works:
242
242
243 $ echo "true.executable=cat" >> .hg/hgrc
243 $ echo "true.executable=cat" >> .hg/hgrc
244 $ beforemerge
244 $ beforemerge
245 [merge-tools]
245 [merge-tools]
246 false.whatever=
246 false.whatever=
247 true.priority=1
247 true.priority=1
248 true.executable=cat
248 true.executable=cat
249 # hg update -C 1
249 # hg update -C 1
250 $ hg merge -r 2
250 $ hg merge -r 2
251 merging f
251 merging f
252 revision 1
252 revision 1
253 space
253 space
254 revision 0
254 revision 0
255 space
255 space
256 revision 2
256 revision 2
257 space
257 space
258 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
258 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
259 (branch merge, don't forget to commit)
259 (branch merge, don't forget to commit)
260 $ aftermerge
260 $ aftermerge
261 # cat f
261 # cat f
262 revision 1
262 revision 1
263 space
263 space
264 # hg stat
264 # hg stat
265 M f
265 M f
266
266
267 and true.executable set to cat with path works:
267 and true.executable set to cat with path works:
268
268
269 $ beforemerge
269 $ beforemerge
270 [merge-tools]
270 [merge-tools]
271 false.whatever=
271 false.whatever=
272 true.priority=1
272 true.priority=1
273 true.executable=cat
273 true.executable=cat
274 # hg update -C 1
274 # hg update -C 1
275 $ hg merge -r 2 --config merge-tools.true.executable=cat
275 $ hg merge -r 2 --config merge-tools.true.executable=cat
276 merging f
276 merging f
277 revision 1
277 revision 1
278 space
278 space
279 revision 0
279 revision 0
280 space
280 space
281 revision 2
281 revision 2
282 space
282 space
283 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
283 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
284 (branch merge, don't forget to commit)
284 (branch merge, don't forget to commit)
285 $ aftermerge
285 $ aftermerge
286 # cat f
286 # cat f
287 revision 1
287 revision 1
288 space
288 space
289 # hg stat
289 # hg stat
290 M f
290 M f
291
291
292 #if unix-permissions
292 #if unix-permissions
293
293
294 environment variables in true.executable are handled:
294 environment variables in true.executable are handled:
295
295
296 $ echo 'echo "custom merge tool"' > .hg/merge.sh
296 $ echo 'echo "custom merge tool"' > .hg/merge.sh
297 $ beforemerge
297 $ beforemerge
298 [merge-tools]
298 [merge-tools]
299 false.whatever=
299 false.whatever=
300 true.priority=1
300 true.priority=1
301 true.executable=cat
301 true.executable=cat
302 # hg update -C 1
302 # hg update -C 1
303 $ hg --config merge-tools.true.executable='sh' \
303 $ hg --config merge-tools.true.executable='sh' \
304 > --config merge-tools.true.args=.hg/merge.sh \
304 > --config merge-tools.true.args=.hg/merge.sh \
305 > merge -r 2
305 > merge -r 2
306 merging f
306 merging f
307 custom merge tool
307 custom merge tool
308 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
308 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
309 (branch merge, don't forget to commit)
309 (branch merge, don't forget to commit)
310 $ aftermerge
310 $ aftermerge
311 # cat f
311 # cat f
312 revision 1
312 revision 1
313 space
313 space
314 # hg stat
314 # hg stat
315 M f
315 M f
316
316
317 #endif
317 #endif
318
318
319 Tool selection and merge-patterns
319 Tool selection and merge-patterns
320
320
321 merge-patterns specifies new tool false:
321 merge-patterns specifies new tool false:
322
322
323 $ beforemerge
323 $ beforemerge
324 [merge-tools]
324 [merge-tools]
325 false.whatever=
325 false.whatever=
326 true.priority=1
326 true.priority=1
327 true.executable=cat
327 true.executable=cat
328 # hg update -C 1
328 # hg update -C 1
329 $ hg merge -r 2 --config merge-patterns.f=false
329 $ hg merge -r 2 --config merge-patterns.f=false
330 merging f
330 merging f
331 merging f failed!
331 merging f failed!
332 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
332 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
333 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
333 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
334 [1]
334 [1]
335 $ aftermerge
335 $ aftermerge
336 # cat f
336 # cat f
337 revision 1
337 revision 1
338 space
338 space
339 # hg stat
339 # hg stat
340 M f
340 M f
341 ? f.orig
341 ? f.orig
342
342
343 merge-patterns specifies executable not found in PATH and gets warning:
343 merge-patterns specifies executable not found in PATH and gets warning:
344
344
345 $ beforemerge
345 $ beforemerge
346 [merge-tools]
346 [merge-tools]
347 false.whatever=
347 false.whatever=
348 true.priority=1
348 true.priority=1
349 true.executable=cat
349 true.executable=cat
350 # hg update -C 1
350 # hg update -C 1
351 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
351 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=nonexistentmergetool
352 couldn't find merge tool true specified for f
352 couldn't find merge tool true specified for f
353 merging f
353 merging f
354 merging f failed!
354 merging f failed!
355 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
355 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
356 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
356 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
357 [1]
357 [1]
358 $ aftermerge
358 $ aftermerge
359 # cat f
359 # cat f
360 revision 1
360 revision 1
361 space
361 space
362 # hg stat
362 # hg stat
363 M f
363 M f
364 ? f.orig
364 ? f.orig
365
365
366 merge-patterns specifies executable with bogus path and gets warning:
366 merge-patterns specifies executable with bogus path and gets warning:
367
367
368 $ beforemerge
368 $ beforemerge
369 [merge-tools]
369 [merge-tools]
370 false.whatever=
370 false.whatever=
371 true.priority=1
371 true.priority=1
372 true.executable=cat
372 true.executable=cat
373 # hg update -C 1
373 # hg update -C 1
374 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
374 $ hg merge -r 2 --config merge-patterns.f=true --config merge-tools.true.executable=/nonexistent/mergetool
375 couldn't find merge tool true specified for f
375 couldn't find merge tool true specified for f
376 merging f
376 merging f
377 merging f failed!
377 merging f failed!
378 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
378 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
379 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
379 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
380 [1]
380 [1]
381 $ aftermerge
381 $ aftermerge
382 # cat f
382 # cat f
383 revision 1
383 revision 1
384 space
384 space
385 # hg stat
385 # hg stat
386 M f
386 M f
387 ? f.orig
387 ? f.orig
388
388
389 ui.merge overrules priority
389 ui.merge overrules priority
390
390
391 ui.merge specifies false:
391 ui.merge specifies false:
392
392
393 $ beforemerge
393 $ beforemerge
394 [merge-tools]
394 [merge-tools]
395 false.whatever=
395 false.whatever=
396 true.priority=1
396 true.priority=1
397 true.executable=cat
397 true.executable=cat
398 # hg update -C 1
398 # hg update -C 1
399 $ hg merge -r 2 --config ui.merge=false
399 $ hg merge -r 2 --config ui.merge=false
400 merging f
400 merging f
401 merging f failed!
401 merging f failed!
402 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
402 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
403 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
403 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
404 [1]
404 [1]
405 $ aftermerge
405 $ aftermerge
406 # cat f
406 # cat f
407 revision 1
407 revision 1
408 space
408 space
409 # hg stat
409 # hg stat
410 M f
410 M f
411 ? f.orig
411 ? f.orig
412
412
413 ui.merge specifies internal:fail:
413 ui.merge specifies internal:fail:
414
414
415 $ beforemerge
415 $ beforemerge
416 [merge-tools]
416 [merge-tools]
417 false.whatever=
417 false.whatever=
418 true.priority=1
418 true.priority=1
419 true.executable=cat
419 true.executable=cat
420 # hg update -C 1
420 # hg update -C 1
421 $ hg merge -r 2 --config ui.merge=internal:fail
421 $ hg merge -r 2 --config ui.merge=internal:fail
422 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
422 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
423 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
423 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
424 [1]
424 [1]
425 $ aftermerge
425 $ aftermerge
426 # cat f
426 # cat f
427 revision 1
427 revision 1
428 space
428 space
429 # hg stat
429 # hg stat
430 M f
430 M f
431
431
432 ui.merge specifies :local (without internal prefix):
432 ui.merge specifies :local (without internal prefix):
433
433
434 $ beforemerge
434 $ beforemerge
435 [merge-tools]
435 [merge-tools]
436 false.whatever=
436 false.whatever=
437 true.priority=1
437 true.priority=1
438 true.executable=cat
438 true.executable=cat
439 # hg update -C 1
439 # hg update -C 1
440 $ hg merge -r 2 --config ui.merge=:local
440 $ hg merge -r 2 --config ui.merge=:local
441 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
441 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
442 (branch merge, don't forget to commit)
442 (branch merge, don't forget to commit)
443 $ aftermerge
443 $ aftermerge
444 # cat f
444 # cat f
445 revision 1
445 revision 1
446 space
446 space
447 # hg stat
447 # hg stat
448 M f
448 M f
449
449
450 ui.merge specifies internal:other:
450 ui.merge specifies internal:other:
451
451
452 $ beforemerge
452 $ beforemerge
453 [merge-tools]
453 [merge-tools]
454 false.whatever=
454 false.whatever=
455 true.priority=1
455 true.priority=1
456 true.executable=cat
456 true.executable=cat
457 # hg update -C 1
457 # hg update -C 1
458 $ hg merge -r 2 --config ui.merge=internal:other
458 $ hg merge -r 2 --config ui.merge=internal:other
459 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
459 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
460 (branch merge, don't forget to commit)
460 (branch merge, don't forget to commit)
461 $ aftermerge
461 $ aftermerge
462 # cat f
462 # cat f
463 revision 2
463 revision 2
464 space
464 space
465 # hg stat
465 # hg stat
466 M f
466 M f
467
467
468 ui.merge specifies internal:prompt:
468 ui.merge specifies internal:prompt:
469
469
470 $ beforemerge
470 $ beforemerge
471 [merge-tools]
471 [merge-tools]
472 false.whatever=
472 false.whatever=
473 true.priority=1
473 true.priority=1
474 true.executable=cat
474 true.executable=cat
475 # hg update -C 1
475 # hg update -C 1
476 $ hg merge -r 2 --config ui.merge=internal:prompt
476 $ hg merge -r 2 --config ui.merge=internal:prompt
477 no tool found to merge f
477 no tool found to merge f
478 keep (l)ocal or take (o)ther? l
478 keep (l)ocal or take (o)ther? l
479 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
479 0 files updated, 1 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 $ aftermerge
481 $ aftermerge
482 # cat f
482 # cat f
483 revision 1
483 revision 1
484 space
484 space
485 # hg stat
485 # hg stat
486 M f
486 M f
487
487
488 ui.merge specifies internal:dump:
488 ui.merge specifies internal:dump:
489
489
490 $ beforemerge
490 $ beforemerge
491 [merge-tools]
491 [merge-tools]
492 false.whatever=
492 false.whatever=
493 true.priority=1
493 true.priority=1
494 true.executable=cat
494 true.executable=cat
495 # hg update -C 1
495 # hg update -C 1
496 $ hg merge -r 2 --config ui.merge=internal:dump
496 $ hg merge -r 2 --config ui.merge=internal:dump
497 merging f
497 merging f
498 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
498 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
499 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
499 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
500 [1]
500 [1]
501 $ aftermerge
501 $ aftermerge
502 # cat f
502 # cat f
503 revision 1
503 revision 1
504 space
504 space
505 # hg stat
505 # hg stat
506 M f
506 M f
507 ? f.base
507 ? f.base
508 ? f.local
508 ? f.local
509 ? f.orig
509 ? f.orig
510 ? f.other
510 ? f.other
511
511
512 f.base:
512 f.base:
513
513
514 $ cat f.base
514 $ cat f.base
515 revision 0
515 revision 0
516 space
516 space
517
517
518 f.local:
518 f.local:
519
519
520 $ cat f.local
520 $ cat f.local
521 revision 1
521 revision 1
522 space
522 space
523
523
524 f.other:
524 f.other:
525
525
526 $ cat f.other
526 $ cat f.other
527 revision 2
527 revision 2
528 space
528 space
529 $ rm f.base f.local f.other
529 $ rm f.base f.local f.other
530
530
531 ui.merge specifies internal:other but is overruled by pattern for false:
531 ui.merge specifies internal:other but is overruled by pattern for false:
532
532
533 $ beforemerge
533 $ beforemerge
534 [merge-tools]
534 [merge-tools]
535 false.whatever=
535 false.whatever=
536 true.priority=1
536 true.priority=1
537 true.executable=cat
537 true.executable=cat
538 # hg update -C 1
538 # hg update -C 1
539 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
539 $ hg merge -r 2 --config ui.merge=internal:other --config merge-patterns.f=false
540 merging f
540 merging f
541 merging f failed!
541 merging f failed!
542 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
542 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
543 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
543 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
544 [1]
544 [1]
545 $ aftermerge
545 $ aftermerge
546 # cat f
546 # cat f
547 revision 1
547 revision 1
548 space
548 space
549 # hg stat
549 # hg stat
550 M f
550 M f
551 ? f.orig
551 ? f.orig
552
552
553 Premerge
553 Premerge
554
554
555 ui.merge specifies internal:other but is overruled by --tool=false
555 ui.merge specifies internal:other but is overruled by --tool=false
556
556
557 $ beforemerge
557 $ beforemerge
558 [merge-tools]
558 [merge-tools]
559 false.whatever=
559 false.whatever=
560 true.priority=1
560 true.priority=1
561 true.executable=cat
561 true.executable=cat
562 # hg update -C 1
562 # hg update -C 1
563 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
563 $ hg merge -r 2 --config ui.merge=internal:other --tool=false
564 merging f
564 merging f
565 merging f failed!
565 merging f failed!
566 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
566 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
567 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
567 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
568 [1]
568 [1]
569 $ aftermerge
569 $ aftermerge
570 # cat f
570 # cat f
571 revision 1
571 revision 1
572 space
572 space
573 # hg stat
573 # hg stat
574 M f
574 M f
575 ? f.orig
575 ? f.orig
576
576
577 HGMERGE specifies internal:other but is overruled by --tool=false
577 HGMERGE specifies internal:other but is overruled by --tool=false
578
578
579 $ HGMERGE=internal:other ; export HGMERGE
579 $ HGMERGE=internal:other ; export HGMERGE
580 $ beforemerge
580 $ beforemerge
581 [merge-tools]
581 [merge-tools]
582 false.whatever=
582 false.whatever=
583 true.priority=1
583 true.priority=1
584 true.executable=cat
584 true.executable=cat
585 # hg update -C 1
585 # hg update -C 1
586 $ hg merge -r 2 --tool=false
586 $ hg merge -r 2 --tool=false
587 merging f
587 merging f
588 merging f failed!
588 merging f failed!
589 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
589 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
590 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
590 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
591 [1]
591 [1]
592 $ aftermerge
592 $ aftermerge
593 # cat f
593 # cat f
594 revision 1
594 revision 1
595 space
595 space
596 # hg stat
596 # hg stat
597 M f
597 M f
598 ? f.orig
598 ? f.orig
599
599
600 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
600 $ unset HGMERGE # make sure HGMERGE doesn't interfere with remaining tests
601
601
602 update is a merge ...
602 update is a merge ...
603
603
604 (this also tests that files reverted with '--rev REV' are treated as
605 "modified", even if none of mode, size and timestamp of them isn't
606 changed on the filesystem (see also issue4583))
607
608 $ cat >> $HGRCPATH <<EOF
609 > [fakedirstatewritetime]
610 > # emulate invoking dirstate.write() via repo.status()
611 > # at 2000-01-01 00:00
612 > fakenow = 200001010000
613 > EOF
614
604 $ beforemerge
615 $ beforemerge
605 [merge-tools]
616 [merge-tools]
606 false.whatever=
617 false.whatever=
607 true.priority=1
618 true.priority=1
608 true.executable=cat
619 true.executable=cat
609 # hg update -C 1
620 # hg update -C 1
610 $ hg update -q 0
621 $ hg update -q 0
611 $ f -s f
622 $ f -s f
612 f: size=17
623 f: size=17
613 $ touch -t 200001010000 f
624 $ touch -t 200001010000 f
614 $ hg status f
625 $ hg debugrebuildstate
626 $ cat >> $HGRCPATH <<EOF
627 > [extensions]
628 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
629 > EOF
615 $ hg revert -q -r 1 .
630 $ hg revert -q -r 1 .
631 $ cat >> $HGRCPATH <<EOF
632 > [extensions]
633 > fakedirstatewritetime = !
634 > EOF
616 $ f -s f
635 $ f -s f
617 f: size=17
636 f: size=17
618 $ touch -t 200001010000 f
637 $ touch -t 200001010000 f
619 $ hg status f
638 $ hg status f
620 M f
639 M f
621 $ hg update -r 2
640 $ hg update -r 2
622 merging f
641 merging f
623 revision 1
642 revision 1
624 space
643 space
625 revision 0
644 revision 0
626 space
645 space
627 revision 2
646 revision 2
628 space
647 space
629 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
648 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
630 $ aftermerge
649 $ aftermerge
631 # cat f
650 # cat f
632 revision 1
651 revision 1
633 space
652 space
634 # hg stat
653 # hg stat
635 M f
654 M f
636
655
637 update should also have --tool
656 update should also have --tool
638
657
639 $ beforemerge
658 $ beforemerge
640 [merge-tools]
659 [merge-tools]
641 false.whatever=
660 false.whatever=
642 true.priority=1
661 true.priority=1
643 true.executable=cat
662 true.executable=cat
644 # hg update -C 1
663 # hg update -C 1
645 $ hg update -q 0
664 $ hg update -q 0
646 $ f -s f
665 $ f -s f
647 f: size=17
666 f: size=17
648 $ touch -t 200001010000 f
667 $ touch -t 200001010000 f
649 $ hg status f
668 $ hg debugrebuildstate
669 $ cat >> $HGRCPATH <<EOF
670 > [extensions]
671 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
672 > EOF
650 $ hg revert -q -r 1 .
673 $ hg revert -q -r 1 .
674 $ cat >> $HGRCPATH <<EOF
675 > [extensions]
676 > fakedirstatewritetime = !
677 > EOF
651 $ f -s f
678 $ f -s f
652 f: size=17
679 f: size=17
653 $ touch -t 200001010000 f
680 $ touch -t 200001010000 f
654 $ hg status f
681 $ hg status f
655 M f
682 M f
656 $ hg update -r 2 --tool false
683 $ hg update -r 2 --tool false
657 merging f
684 merging f
658 merging f failed!
685 merging f failed!
659 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
686 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
660 use 'hg resolve' to retry unresolved file merges
687 use 'hg resolve' to retry unresolved file merges
661 [1]
688 [1]
662 $ aftermerge
689 $ aftermerge
663 # cat f
690 # cat f
664 revision 1
691 revision 1
665 space
692 space
666 # hg stat
693 # hg stat
667 M f
694 M f
668 ? f.orig
695 ? f.orig
669
696
670 Default is silent simplemerge:
697 Default is silent simplemerge:
671
698
672 $ beforemerge
699 $ beforemerge
673 [merge-tools]
700 [merge-tools]
674 false.whatever=
701 false.whatever=
675 true.priority=1
702 true.priority=1
676 true.executable=cat
703 true.executable=cat
677 # hg update -C 1
704 # hg update -C 1
678 $ hg merge -r 3
705 $ hg merge -r 3
679 merging f
706 merging f
680 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
707 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
681 (branch merge, don't forget to commit)
708 (branch merge, don't forget to commit)
682 $ aftermerge
709 $ aftermerge
683 # cat f
710 # cat f
684 revision 1
711 revision 1
685 space
712 space
686 revision 3
713 revision 3
687 # hg stat
714 # hg stat
688 M f
715 M f
689
716
690 .premerge=True is same:
717 .premerge=True is same:
691
718
692 $ beforemerge
719 $ beforemerge
693 [merge-tools]
720 [merge-tools]
694 false.whatever=
721 false.whatever=
695 true.priority=1
722 true.priority=1
696 true.executable=cat
723 true.executable=cat
697 # hg update -C 1
724 # hg update -C 1
698 $ hg merge -r 3 --config merge-tools.true.premerge=True
725 $ hg merge -r 3 --config merge-tools.true.premerge=True
699 merging f
726 merging f
700 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
727 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
701 (branch merge, don't forget to commit)
728 (branch merge, don't forget to commit)
702 $ aftermerge
729 $ aftermerge
703 # cat f
730 # cat f
704 revision 1
731 revision 1
705 space
732 space
706 revision 3
733 revision 3
707 # hg stat
734 # hg stat
708 M f
735 M f
709
736
710 .premerge=False executes merge-tool:
737 .premerge=False executes merge-tool:
711
738
712 $ beforemerge
739 $ beforemerge
713 [merge-tools]
740 [merge-tools]
714 false.whatever=
741 false.whatever=
715 true.priority=1
742 true.priority=1
716 true.executable=cat
743 true.executable=cat
717 # hg update -C 1
744 # hg update -C 1
718 $ hg merge -r 3 --config merge-tools.true.premerge=False
745 $ hg merge -r 3 --config merge-tools.true.premerge=False
719 merging f
746 merging f
720 revision 1
747 revision 1
721 space
748 space
722 revision 0
749 revision 0
723 space
750 space
724 revision 0
751 revision 0
725 space
752 space
726 revision 3
753 revision 3
727 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
754 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
728 (branch merge, don't forget to commit)
755 (branch merge, don't forget to commit)
729 $ aftermerge
756 $ aftermerge
730 # cat f
757 # cat f
731 revision 1
758 revision 1
732 space
759 space
733 # hg stat
760 # hg stat
734 M f
761 M f
735
762
736 premerge=keep keeps conflict markers in:
763 premerge=keep keeps conflict markers in:
737
764
738 $ beforemerge
765 $ beforemerge
739 [merge-tools]
766 [merge-tools]
740 false.whatever=
767 false.whatever=
741 true.priority=1
768 true.priority=1
742 true.executable=cat
769 true.executable=cat
743 # hg update -C 1
770 # hg update -C 1
744 $ hg merge -r 4 --config merge-tools.true.premerge=keep
771 $ hg merge -r 4 --config merge-tools.true.premerge=keep
745 merging f
772 merging f
746 <<<<<<< local: ef83787e2614 - test: revision 1
773 <<<<<<< local: ef83787e2614 - test: revision 1
747 revision 1
774 revision 1
748 space
775 space
749 =======
776 =======
750 revision 4
777 revision 4
751 >>>>>>> other: 81448d39c9a0 - test: revision 4
778 >>>>>>> other: 81448d39c9a0 - test: revision 4
752 revision 0
779 revision 0
753 space
780 space
754 revision 4
781 revision 4
755 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
782 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
756 (branch merge, don't forget to commit)
783 (branch merge, don't forget to commit)
757 $ aftermerge
784 $ aftermerge
758 # cat f
785 # cat f
759 <<<<<<< local: ef83787e2614 - test: revision 1
786 <<<<<<< local: ef83787e2614 - test: revision 1
760 revision 1
787 revision 1
761 space
788 space
762 =======
789 =======
763 revision 4
790 revision 4
764 >>>>>>> other: 81448d39c9a0 - test: revision 4
791 >>>>>>> other: 81448d39c9a0 - test: revision 4
765 # hg stat
792 # hg stat
766 M f
793 M f
767
794
768 premerge=keep-merge3 keeps conflict markers with base content:
795 premerge=keep-merge3 keeps conflict markers with base content:
769
796
770 $ beforemerge
797 $ beforemerge
771 [merge-tools]
798 [merge-tools]
772 false.whatever=
799 false.whatever=
773 true.priority=1
800 true.priority=1
774 true.executable=cat
801 true.executable=cat
775 # hg update -C 1
802 # hg update -C 1
776 $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3
803 $ hg merge -r 4 --config merge-tools.true.premerge=keep-merge3
777 merging f
804 merging f
778 <<<<<<< local: ef83787e2614 - test: revision 1
805 <<<<<<< local: ef83787e2614 - test: revision 1
779 revision 1
806 revision 1
780 space
807 space
781 ||||||| base
808 ||||||| base
782 revision 0
809 revision 0
783 space
810 space
784 =======
811 =======
785 revision 4
812 revision 4
786 >>>>>>> other: 81448d39c9a0 - test: revision 4
813 >>>>>>> other: 81448d39c9a0 - test: revision 4
787 revision 0
814 revision 0
788 space
815 space
789 revision 4
816 revision 4
790 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
817 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
791 (branch merge, don't forget to commit)
818 (branch merge, don't forget to commit)
792 $ aftermerge
819 $ aftermerge
793 # cat f
820 # cat f
794 <<<<<<< local: ef83787e2614 - test: revision 1
821 <<<<<<< local: ef83787e2614 - test: revision 1
795 revision 1
822 revision 1
796 space
823 space
797 ||||||| base
824 ||||||| base
798 revision 0
825 revision 0
799 space
826 space
800 =======
827 =======
801 revision 4
828 revision 4
802 >>>>>>> other: 81448d39c9a0 - test: revision 4
829 >>>>>>> other: 81448d39c9a0 - test: revision 4
803 # hg stat
830 # hg stat
804 M f
831 M f
805
832
806
833
807 Tool execution
834 Tool execution
808
835
809 set tools.args explicit to include $base $local $other $output:
836 set tools.args explicit to include $base $local $other $output:
810
837
811 $ beforemerge
838 $ beforemerge
812 [merge-tools]
839 [merge-tools]
813 false.whatever=
840 false.whatever=
814 true.priority=1
841 true.priority=1
815 true.executable=cat
842 true.executable=cat
816 # hg update -C 1
843 # hg update -C 1
817 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
844 $ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
818 > | sed 's,==> .* <==,==> ... <==,g'
845 > | sed 's,==> .* <==,==> ... <==,g'
819 merging f
846 merging f
820 ==> ... <==
847 ==> ... <==
821 revision 0
848 revision 0
822 space
849 space
823
850
824 ==> ... <==
851 ==> ... <==
825 revision 1
852 revision 1
826 space
853 space
827
854
828 ==> ... <==
855 ==> ... <==
829 revision 2
856 revision 2
830 space
857 space
831
858
832 ==> ... <==
859 ==> ... <==
833 revision 1
860 revision 1
834 space
861 space
835 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
862 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
836 (branch merge, don't forget to commit)
863 (branch merge, don't forget to commit)
837 $ aftermerge
864 $ aftermerge
838 # cat f
865 # cat f
839 revision 1
866 revision 1
840 space
867 space
841 # hg stat
868 # hg stat
842 M f
869 M f
843
870
844 Merge with "echo mergeresult > $local":
871 Merge with "echo mergeresult > $local":
845
872
846 $ beforemerge
873 $ beforemerge
847 [merge-tools]
874 [merge-tools]
848 false.whatever=
875 false.whatever=
849 true.priority=1
876 true.priority=1
850 true.executable=cat
877 true.executable=cat
851 # hg update -C 1
878 # hg update -C 1
852 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
879 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $local'
853 merging f
880 merging f
854 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
881 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
855 (branch merge, don't forget to commit)
882 (branch merge, don't forget to commit)
856 $ aftermerge
883 $ aftermerge
857 # cat f
884 # cat f
858 mergeresult
885 mergeresult
859 # hg stat
886 # hg stat
860 M f
887 M f
861
888
862 - and $local is the file f:
889 - and $local is the file f:
863
890
864 $ beforemerge
891 $ beforemerge
865 [merge-tools]
892 [merge-tools]
866 false.whatever=
893 false.whatever=
867 true.priority=1
894 true.priority=1
868 true.executable=cat
895 true.executable=cat
869 # hg update -C 1
896 # hg update -C 1
870 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
897 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > f'
871 merging f
898 merging f
872 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
899 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
873 (branch merge, don't forget to commit)
900 (branch merge, don't forget to commit)
874 $ aftermerge
901 $ aftermerge
875 # cat f
902 # cat f
876 mergeresult
903 mergeresult
877 # hg stat
904 # hg stat
878 M f
905 M f
879
906
880 Merge with "echo mergeresult > $output" - the variable is a bit magic:
907 Merge with "echo mergeresult > $output" - the variable is a bit magic:
881
908
882 $ beforemerge
909 $ beforemerge
883 [merge-tools]
910 [merge-tools]
884 false.whatever=
911 false.whatever=
885 true.priority=1
912 true.priority=1
886 true.executable=cat
913 true.executable=cat
887 # hg update -C 1
914 # hg update -C 1
888 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
915 $ hg merge -r 2 --config merge-tools.true.executable=echo --config merge-tools.true.args='mergeresult > $output'
889 merging f
916 merging f
890 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
917 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
891 (branch merge, don't forget to commit)
918 (branch merge, don't forget to commit)
892 $ aftermerge
919 $ aftermerge
893 # cat f
920 # cat f
894 mergeresult
921 mergeresult
895 # hg stat
922 # hg stat
896 M f
923 M f
897
924
898 Merge using tool with a path that must be quoted:
925 Merge using tool with a path that must be quoted:
899
926
900 $ beforemerge
927 $ beforemerge
901 [merge-tools]
928 [merge-tools]
902 false.whatever=
929 false.whatever=
903 true.priority=1
930 true.priority=1
904 true.executable=cat
931 true.executable=cat
905 # hg update -C 1
932 # hg update -C 1
906 $ cat <<EOF > 'my merge tool'
933 $ cat <<EOF > 'my merge tool'
907 > cat "\$1" "\$2" "\$3" > "\$4"
934 > cat "\$1" "\$2" "\$3" > "\$4"
908 > EOF
935 > EOF
909 $ hg --config merge-tools.true.executable='sh' \
936 $ hg --config merge-tools.true.executable='sh' \
910 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
937 > --config merge-tools.true.args='"./my merge tool" $base $local $other $output' \
911 > merge -r 2
938 > merge -r 2
912 merging f
939 merging f
913 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
940 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
914 (branch merge, don't forget to commit)
941 (branch merge, don't forget to commit)
915 $ rm -f 'my merge tool'
942 $ rm -f 'my merge tool'
916 $ aftermerge
943 $ aftermerge
917 # cat f
944 # cat f
918 revision 0
945 revision 0
919 space
946 space
920 revision 1
947 revision 1
921 space
948 space
922 revision 2
949 revision 2
923 space
950 space
924 # hg stat
951 # hg stat
925 M f
952 M f
926
953
927 Issue3581: Merging a filename that needs to be quoted
954 Issue3581: Merging a filename that needs to be quoted
928 (This test doesn't work on Windows filesystems even on Linux, so check
955 (This test doesn't work on Windows filesystems even on Linux, so check
929 for Unix-like permission)
956 for Unix-like permission)
930
957
931 #if unix-permissions
958 #if unix-permissions
932 $ beforemerge
959 $ beforemerge
933 [merge-tools]
960 [merge-tools]
934 false.whatever=
961 false.whatever=
935 true.priority=1
962 true.priority=1
936 true.executable=cat
963 true.executable=cat
937 # hg update -C 1
964 # hg update -C 1
938 $ echo "revision 5" > '"; exit 1; echo "'
965 $ echo "revision 5" > '"; exit 1; echo "'
939 $ hg commit -Am "revision 5"
966 $ hg commit -Am "revision 5"
940 adding "; exit 1; echo "
967 adding "; exit 1; echo "
941 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
968 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
942 $ hg update -C 1 > /dev/null
969 $ hg update -C 1 > /dev/null
943 $ echo "revision 6" > '"; exit 1; echo "'
970 $ echo "revision 6" > '"; exit 1; echo "'
944 $ hg commit -Am "revision 6"
971 $ hg commit -Am "revision 6"
945 adding "; exit 1; echo "
972 adding "; exit 1; echo "
946 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
973 warning: filename contains '"', which is reserved on Windows: '"; exit 1; echo "'
947 created new head
974 created new head
948 $ hg merge --config merge-tools.true.executable="true" -r 5
975 $ hg merge --config merge-tools.true.executable="true" -r 5
949 merging "; exit 1; echo "
976 merging "; exit 1; echo "
950 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
977 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
951 (branch merge, don't forget to commit)
978 (branch merge, don't forget to commit)
952 $ hg update -C 1 > /dev/null
979 $ hg update -C 1 > /dev/null
953 #endif
980 #endif
954
981
955 Merge post-processing
982 Merge post-processing
956
983
957 cat is a bad merge-tool and doesn't change:
984 cat is a bad merge-tool and doesn't change:
958
985
959 $ beforemerge
986 $ beforemerge
960 [merge-tools]
987 [merge-tools]
961 false.whatever=
988 false.whatever=
962 true.priority=1
989 true.priority=1
963 true.executable=cat
990 true.executable=cat
964 # hg update -C 1
991 # hg update -C 1
965 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
992 $ hg merge -y -r 2 --config merge-tools.true.checkchanged=1
966 merging f
993 merging f
967 revision 1
994 revision 1
968 space
995 space
969 revision 0
996 revision 0
970 space
997 space
971 revision 2
998 revision 2
972 space
999 space
973 output file f appears unchanged
1000 output file f appears unchanged
974 was merge successful (yn)? n
1001 was merge successful (yn)? n
975 merging f failed!
1002 merging f failed!
976 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1003 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
977 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1004 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
978 [1]
1005 [1]
979 $ aftermerge
1006 $ aftermerge
980 # cat f
1007 # cat f
981 revision 1
1008 revision 1
982 space
1009 space
983 # hg stat
1010 # hg stat
984 M f
1011 M f
985 ? f.orig
1012 ? f.orig
986
1013
987 #if symlink
1014 #if symlink
988
1015
989 internal merge cannot handle symlinks and shouldn't try:
1016 internal merge cannot handle symlinks and shouldn't try:
990
1017
991 $ hg update -q -C 1
1018 $ hg update -q -C 1
992 $ rm f
1019 $ rm f
993 $ ln -s symlink f
1020 $ ln -s symlink f
994 $ hg commit -qm 'f is symlink'
1021 $ hg commit -qm 'f is symlink'
995 $ hg merge -r 2 --tool internal:merge
1022 $ hg merge -r 2 --tool internal:merge
996 merging f
1023 merging f
997 warning: internal :merge cannot merge symlinks for f
1024 warning: internal :merge cannot merge symlinks for f
998 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
1025 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
999 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1026 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
1000 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1027 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
1001 [1]
1028 [1]
1002
1029
1003 #endif
1030 #endif
@@ -1,209 +1,296 b''
1 $ cat <<EOF > merge
1 $ cat <<EOF > merge
2 > import sys, os
2 > import sys, os
3 >
3 >
4 > try:
4 > try:
5 > import msvcrt
5 > import msvcrt
6 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
6 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
7 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
7 > msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
8 > except ImportError:
8 > except ImportError:
9 > pass
9 > pass
10 >
10 >
11 > print "merging for", os.path.basename(sys.argv[1])
11 > print "merging for", os.path.basename(sys.argv[1])
12 > EOF
12 > EOF
13 $ HGMERGE="python ../merge"; export HGMERGE
13 $ HGMERGE="python ../merge"; export HGMERGE
14
14
15 $ hg init t
15 $ hg init t
16 $ cd t
16 $ cd t
17 $ echo This is file a1 > a
17 $ echo This is file a1 > a
18 $ hg add a
18 $ hg add a
19 $ hg commit -m "commit #0"
19 $ hg commit -m "commit #0"
20 $ echo This is file b1 > b
20 $ echo This is file b1 > b
21 $ hg add b
21 $ hg add b
22 $ hg commit -m "commit #1"
22 $ hg commit -m "commit #1"
23
23
24 $ hg update 0
24 $ hg update 0
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
25 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
26
26
27 Test interrupted updates by exploiting our non-handling of directory collisions
27 Test interrupted updates by exploiting our non-handling of directory collisions
28
28
29 $ mkdir b
29 $ mkdir b
30 $ hg up
30 $ hg up
31 abort: *: '$TESTTMP/t/b' (glob)
31 abort: *: '$TESTTMP/t/b' (glob)
32 [255]
32 [255]
33 $ hg ci
33 $ hg ci
34 abort: last update was interrupted
34 abort: last update was interrupted
35 (use 'hg update' to get a consistent checkout)
35 (use 'hg update' to get a consistent checkout)
36 [255]
36 [255]
37 $ hg sum
37 $ hg sum
38 parent: 0:538afb845929
38 parent: 0:538afb845929
39 commit #0
39 commit #0
40 branch: default
40 branch: default
41 commit: (interrupted update)
41 commit: (interrupted update)
42 update: 1 new changesets (update)
42 update: 1 new changesets (update)
43 phases: 2 draft
43 phases: 2 draft
44 $ rmdir b
44 $ rmdir b
45 $ hg up
45 $ hg up
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 $ hg sum
47 $ hg sum
48 parent: 1:b8bb4a988f25 tip
48 parent: 1:b8bb4a988f25 tip
49 commit #1
49 commit #1
50 branch: default
50 branch: default
51 commit: (clean)
51 commit: (clean)
52 update: (current)
52 update: (current)
53 phases: 2 draft
53 phases: 2 draft
54
54
55 Prepare a basic merge
55 Prepare a basic merge
56
56
57 $ hg up 0
57 $ hg up 0
58 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
58 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
59 $ echo This is file c1 > c
59 $ echo This is file c1 > c
60 $ hg add c
60 $ hg add c
61 $ hg commit -m "commit #2"
61 $ hg commit -m "commit #2"
62 created new head
62 created new head
63 $ echo This is file b1 > b
63 $ echo This is file b1 > b
64 no merges expected
64 no merges expected
65 $ hg merge -P 1
65 $ hg merge -P 1
66 changeset: 1:b8bb4a988f25
66 changeset: 1:b8bb4a988f25
67 user: test
67 user: test
68 date: Thu Jan 01 00:00:00 1970 +0000
68 date: Thu Jan 01 00:00:00 1970 +0000
69 summary: commit #1
69 summary: commit #1
70
70
71 $ hg merge 1
71 $ hg merge 1
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
73 (branch merge, don't forget to commit)
73 (branch merge, don't forget to commit)
74 $ hg diff --nodates
74 $ hg diff --nodates
75 diff -r 49035e18a8e6 b
75 diff -r 49035e18a8e6 b
76 --- /dev/null
76 --- /dev/null
77 +++ b/b
77 +++ b/b
78 @@ -0,0 +1,1 @@
78 @@ -0,0 +1,1 @@
79 +This is file b1
79 +This is file b1
80 $ hg status
80 $ hg status
81 M b
81 M b
82 $ cd ..; rm -r t
82 $ cd ..; rm -r t
83
83
84 $ hg init t
84 $ hg init t
85 $ cd t
85 $ cd t
86 $ echo This is file a1 > a
86 $ echo This is file a1 > a
87 $ hg add a
87 $ hg add a
88 $ hg commit -m "commit #0"
88 $ hg commit -m "commit #0"
89 $ echo This is file b1 > b
89 $ echo This is file b1 > b
90 $ hg add b
90 $ hg add b
91 $ hg commit -m "commit #1"
91 $ hg commit -m "commit #1"
92
92
93 $ hg update 0
93 $ hg update 0
94 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
94 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
95 $ echo This is file c1 > c
95 $ echo This is file c1 > c
96 $ hg add c
96 $ hg add c
97 $ hg commit -m "commit #2"
97 $ hg commit -m "commit #2"
98 created new head
98 created new head
99 $ echo This is file b2 > b
99 $ echo This is file b2 > b
100 merge should fail
100 merge should fail
101 $ hg merge 1
101 $ hg merge 1
102 b: untracked file differs
102 b: untracked file differs
103 abort: untracked files in working directory differ from files in requested revision
103 abort: untracked files in working directory differ from files in requested revision
104 [255]
104 [255]
105 merge of b expected
105 merge of b expected
106 $ hg merge -f 1
106 $ hg merge -f 1
107 merging b
107 merging b
108 merging for b
108 merging for b
109 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
109 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
110 (branch merge, don't forget to commit)
110 (branch merge, don't forget to commit)
111 $ hg diff --nodates
111 $ hg diff --nodates
112 diff -r 49035e18a8e6 b
112 diff -r 49035e18a8e6 b
113 --- /dev/null
113 --- /dev/null
114 +++ b/b
114 +++ b/b
115 @@ -0,0 +1,1 @@
115 @@ -0,0 +1,1 @@
116 +This is file b2
116 +This is file b2
117 $ hg status
117 $ hg status
118 M b
118 M b
119 $ cd ..; rm -r t
119 $ cd ..; rm -r t
120
120
121 $ hg init t
121 $ hg init t
122 $ cd t
122 $ cd t
123 $ echo This is file a1 > a
123 $ echo This is file a1 > a
124 $ hg add a
124 $ hg add a
125 $ hg commit -m "commit #0"
125 $ hg commit -m "commit #0"
126 $ echo This is file b1 > b
126 $ echo This is file b1 > b
127 $ hg add b
127 $ hg add b
128 $ hg commit -m "commit #1"
128 $ hg commit -m "commit #1"
129 $ echo This is file b22 > b
129 $ echo This is file b22 > b
130 $ hg commit -m "commit #2"
130 $ hg commit -m "commit #2"
131 $ hg update 1
131 $ hg update 1
132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
133 $ echo This is file c1 > c
133 $ echo This is file c1 > c
134 $ hg add c
134 $ hg add c
135 $ hg commit -m "commit #3"
135 $ hg commit -m "commit #3"
136 created new head
136 created new head
137
137
138 Contents of b should be "this is file b1"
138 Contents of b should be "this is file b1"
139 $ cat b
139 $ cat b
140 This is file b1
140 This is file b1
141
141
142 $ echo This is file b22 > b
142 $ echo This is file b22 > b
143 merge fails
143 merge fails
144 $ hg merge 2
144 $ hg merge 2
145 abort: uncommitted changes
145 abort: uncommitted changes
146 (use 'hg status' to list changes)
146 (use 'hg status' to list changes)
147 [255]
147 [255]
148 merge expected!
148 merge expected!
149 $ hg merge -f 2
149 $ hg merge -f 2
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 (branch merge, don't forget to commit)
151 (branch merge, don't forget to commit)
152 $ hg diff --nodates
152 $ hg diff --nodates
153 diff -r 85de557015a8 b
153 diff -r 85de557015a8 b
154 --- a/b
154 --- a/b
155 +++ b/b
155 +++ b/b
156 @@ -1,1 +1,1 @@
156 @@ -1,1 +1,1 @@
157 -This is file b1
157 -This is file b1
158 +This is file b22
158 +This is file b22
159 $ hg status
159 $ hg status
160 M b
160 M b
161 $ cd ..; rm -r t
161 $ cd ..; rm -r t
162
162
163 $ hg init t
163 $ hg init t
164 $ cd t
164 $ cd t
165 $ echo This is file a1 > a
165 $ echo This is file a1 > a
166 $ hg add a
166 $ hg add a
167 $ hg commit -m "commit #0"
167 $ hg commit -m "commit #0"
168 $ echo This is file b1 > b
168 $ echo This is file b1 > b
169 $ hg add b
169 $ hg add b
170 $ hg commit -m "commit #1"
170 $ hg commit -m "commit #1"
171 $ echo This is file b22 > b
171 $ echo This is file b22 > b
172 $ hg commit -m "commit #2"
172 $ hg commit -m "commit #2"
173 $ hg update 1
173 $ hg update 1
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 $ echo This is file c1 > c
175 $ echo This is file c1 > c
176 $ hg add c
176 $ hg add c
177 $ hg commit -m "commit #3"
177 $ hg commit -m "commit #3"
178 created new head
178 created new head
179 $ echo This is file b33 > b
179 $ echo This is file b33 > b
180 merge of b should fail
180 merge of b should fail
181 $ hg merge 2
181 $ hg merge 2
182 abort: uncommitted changes
182 abort: uncommitted changes
183 (use 'hg status' to list changes)
183 (use 'hg status' to list changes)
184 [255]
184 [255]
185 merge of b expected
185 merge of b expected
186 $ hg merge -f 2
186 $ hg merge -f 2
187 merging b
187 merging b
188 merging for b
188 merging for b
189 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
189 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
190 (branch merge, don't forget to commit)
190 (branch merge, don't forget to commit)
191 $ hg diff --nodates
191 $ hg diff --nodates
192 diff -r 85de557015a8 b
192 diff -r 85de557015a8 b
193 --- a/b
193 --- a/b
194 +++ b/b
194 +++ b/b
195 @@ -1,1 +1,1 @@
195 @@ -1,1 +1,1 @@
196 -This is file b1
196 -This is file b1
197 +This is file b33
197 +This is file b33
198 $ hg status
198 $ hg status
199 M b
199 M b
200
200
201 Test for issue2364
201 Test for issue2364
202
202
203 $ hg up -qC .
203 $ hg up -qC .
204 $ hg rm b
204 $ hg rm b
205 $ hg ci -md
205 $ hg ci -md
206 $ hg revert -r -2 b
206 $ hg revert -r -2 b
207 $ hg up -q -- -2
207 $ hg up -q -- -2
208
208
209 Test that updated files are treated as "modified", when
210 'merge.update()' is aborted before 'merge.recordupdates()' (= parents
211 aren't changed), even if none of mode, size and timestamp of them
212 isn't changed on the filesystem (see also issue4583).
213
214 $ cat > $TESTTMP/abort.py <<EOF
215 > # emulate aborting before "recordupdates()". in this case, files
216 > # are changed without updating dirstate
217 > from mercurial import extensions, merge, util
218 > def applyupdates(orig, *args, **kwargs):
219 > orig(*args, **kwargs)
220 > raise util.Abort('intentional aborting')
221 > def extsetup(ui):
222 > extensions.wrapfunction(merge, "applyupdates", applyupdates)
223 > EOF
224
225 $ cat >> .hg/hgrc <<EOF
226 > [fakedirstatewritetime]
227 > # emulate invoking dirstate.write() via repo.status()
228 > # at 2000-01-01 00:00
229 > fakenow = 200001010000
230 > EOF
231
232 (file gotten from other revision)
233
234 $ hg update -q -C 2
235 $ echo 'THIS IS FILE B5' > b
236 $ hg commit -m 'commit #5'
237
238 $ hg update -q -C 3
239 $ cat b
240 This is file b1
241 $ touch -t 200001010000 b
242 $ hg debugrebuildstate
243
244 $ cat >> .hg/hgrc <<EOF
245 > [extensions]
246 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
247 > abort = $TESTTMP/abort.py
248 > EOF
249 $ hg merge 5
250 abort: intentional aborting
251 [255]
252 $ cat >> .hg/hgrc <<EOF
253 > [extensions]
254 > fakedirstatewritetime = !
255 > abort = !
256 > EOF
257
258 $ cat b
259 THIS IS FILE B5
260 $ touch -t 200001010000 b
261 $ hg status -A b
262 M b
263
264 (file merged from other revision)
265
266 $ hg update -q -C 3
267 $ echo 'this is file b6' > b
268 $ hg commit -m 'commit #6'
269 created new head
270
271 $ cat b
272 this is file b6
273 $ touch -t 200001010000 b
274 $ hg debugrebuildstate
275
276 $ cat >> .hg/hgrc <<EOF
277 > [extensions]
278 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
279 > abort = $TESTTMP/abort.py
280 > EOF
281 $ hg merge --tool internal:other 5
282 abort: intentional aborting
283 [255]
284 $ cat >> .hg/hgrc <<EOF
285 > [extensions]
286 > fakedirstatewritetime = !
287 > abort = !
288 > EOF
289
290 $ cat b
291 THIS IS FILE B5
292 $ touch -t 200001010000 b
293 $ hg status -A b
294 M b
295
209 $ cd ..
296 $ cd ..
@@ -1,1028 +1,1068 b''
1 $ hg init repo
1 $ hg init repo
2 $ cd repo
2 $ cd repo
3 $ echo 123 > a
3 $ echo 123 > a
4 $ echo 123 > c
4 $ echo 123 > c
5 $ echo 123 > e
5 $ echo 123 > e
6 $ hg add a c e
6 $ hg add a c e
7 $ hg commit -m "first" a c e
7 $ hg commit -m "first" a c e
8
8
9 nothing changed
9 nothing changed
10
10
11 $ hg revert
11 $ hg revert
12 abort: no files or directories specified
12 abort: no files or directories specified
13 (use --all to revert all files)
13 (use --all to revert all files)
14 [255]
14 [255]
15 $ hg revert --all
15 $ hg revert --all
16
16
17 Introduce some changes and revert them
17 Introduce some changes and revert them
18 --------------------------------------
18 --------------------------------------
19
19
20 $ echo 123 > b
20 $ echo 123 > b
21
21
22 $ hg status
22 $ hg status
23 ? b
23 ? b
24 $ echo 12 > c
24 $ echo 12 > c
25
25
26 $ hg status
26 $ hg status
27 M c
27 M c
28 ? b
28 ? b
29 $ hg add b
29 $ hg add b
30
30
31 $ hg status
31 $ hg status
32 M c
32 M c
33 A b
33 A b
34 $ hg rm a
34 $ hg rm a
35
35
36 $ hg status
36 $ hg status
37 M c
37 M c
38 A b
38 A b
39 R a
39 R a
40
40
41 revert removal of a file
41 revert removal of a file
42
42
43 $ hg revert a
43 $ hg revert a
44 $ hg status
44 $ hg status
45 M c
45 M c
46 A b
46 A b
47
47
48 revert addition of a file
48 revert addition of a file
49
49
50 $ hg revert b
50 $ hg revert b
51 $ hg status
51 $ hg status
52 M c
52 M c
53 ? b
53 ? b
54
54
55 revert modification of a file (--no-backup)
55 revert modification of a file (--no-backup)
56
56
57 $ hg revert --no-backup c
57 $ hg revert --no-backup c
58 $ hg status
58 $ hg status
59 ? b
59 ? b
60
60
61 revert deletion (! status) of a added file
61 revert deletion (! status) of a added file
62 ------------------------------------------
62 ------------------------------------------
63
63
64 $ hg add b
64 $ hg add b
65
65
66 $ hg status b
66 $ hg status b
67 A b
67 A b
68 $ rm b
68 $ rm b
69 $ hg status b
69 $ hg status b
70 ! b
70 ! b
71 $ hg revert -v b
71 $ hg revert -v b
72 forgetting b
72 forgetting b
73 $ hg status b
73 $ hg status b
74 b: * (glob)
74 b: * (glob)
75
75
76 $ ls
76 $ ls
77 a
77 a
78 c
78 c
79 e
79 e
80
80
81 Test creation of backup (.orig) files
81 Test creation of backup (.orig) files
82 -------------------------------------
82 -------------------------------------
83
83
84 $ echo z > e
84 $ echo z > e
85 $ hg revert --all -v
85 $ hg revert --all -v
86 saving current version of e as e.orig
86 saving current version of e as e.orig
87 reverting e
87 reverting e
88
88
89 revert on clean file (no change)
89 revert on clean file (no change)
90 --------------------------------
90 --------------------------------
91
91
92 $ hg revert a
92 $ hg revert a
93 no changes needed to a
93 no changes needed to a
94
94
95 revert on an untracked file
95 revert on an untracked file
96 ---------------------------
96 ---------------------------
97
97
98 $ echo q > q
98 $ echo q > q
99 $ hg revert q
99 $ hg revert q
100 file not managed: q
100 file not managed: q
101 $ rm q
101 $ rm q
102
102
103 revert on file that does not exists
103 revert on file that does not exists
104 -----------------------------------
104 -----------------------------------
105
105
106 $ hg revert notfound
106 $ hg revert notfound
107 notfound: no such file in rev 334a9e57682c
107 notfound: no such file in rev 334a9e57682c
108 $ touch d
108 $ touch d
109 $ hg add d
109 $ hg add d
110 $ hg rm a
110 $ hg rm a
111 $ hg commit -m "second"
111 $ hg commit -m "second"
112 $ echo z > z
112 $ echo z > z
113 $ hg add z
113 $ hg add z
114 $ hg st
114 $ hg st
115 A z
115 A z
116 ? e.orig
116 ? e.orig
117
117
118 revert to another revision (--rev)
118 revert to another revision (--rev)
119 ----------------------------------
119 ----------------------------------
120
120
121 $ hg revert --all -r0
121 $ hg revert --all -r0
122 adding a
122 adding a
123 removing d
123 removing d
124 forgetting z
124 forgetting z
125
125
126 revert explicitly to parent (--rev)
126 revert explicitly to parent (--rev)
127 -----------------------------------
127 -----------------------------------
128
128
129 $ hg revert --all -rtip
129 $ hg revert --all -rtip
130 forgetting a
130 forgetting a
131 undeleting d
131 undeleting d
132 $ rm a *.orig
132 $ rm a *.orig
133
133
134 revert to another revision (--rev) and exact match
134 revert to another revision (--rev) and exact match
135 --------------------------------------------------
135 --------------------------------------------------
136
136
137 exact match are more silent
137 exact match are more silent
138
138
139 $ hg revert -r0 a
139 $ hg revert -r0 a
140 $ hg st a
140 $ hg st a
141 A a
141 A a
142 $ hg rm d
142 $ hg rm d
143 $ hg st d
143 $ hg st d
144 R d
144 R d
145
145
146 should keep d removed
146 should keep d removed
147
147
148 $ hg revert -r0 d
148 $ hg revert -r0 d
149 no changes needed to d
149 no changes needed to d
150 $ hg st d
150 $ hg st d
151 R d
151 R d
152
152
153 $ hg update -C
153 $ hg update -C
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
155
155
156 revert of exec bit
156 revert of exec bit
157 ------------------
157 ------------------
158
158
159 #if execbit
159 #if execbit
160 $ chmod +x c
160 $ chmod +x c
161 $ hg revert --all
161 $ hg revert --all
162 reverting c
162 reverting c
163
163
164 $ test -x c || echo non-executable
164 $ test -x c || echo non-executable
165 non-executable
165 non-executable
166
166
167 $ chmod +x c
167 $ chmod +x c
168 $ hg commit -m exe
168 $ hg commit -m exe
169
169
170 $ chmod -x c
170 $ chmod -x c
171 $ hg revert --all
171 $ hg revert --all
172 reverting c
172 reverting c
173
173
174 $ test -x c && echo executable
174 $ test -x c && echo executable
175 executable
175 executable
176 #endif
176 #endif
177
177
178 Test that files reverted to other than the parent are treated as
179 "modified", even if none of mode, size and timestamp of it isn't
180 changed on the filesystem (see also issue4583).
181
182 $ echo 321 > e
183 $ hg diff --git
184 diff --git a/e b/e
185 --- a/e
186 +++ b/e
187 @@ -1,1 +1,1 @@
188 -123
189 +321
190 $ hg commit -m 'ambiguity from size'
191
192 $ cat e
193 321
194 $ touch -t 200001010000 e
195 $ hg debugrebuildstate
196
197 $ cat >> .hg/hgrc <<EOF
198 > [fakedirstatewritetime]
199 > # emulate invoking dirstate.write() via repo.status()
200 > # at 2000-01-01 00:00
201 > fakenow = 200001010000
202 >
203 > [extensions]
204 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
205 > EOF
206 $ hg revert -r 0 e
207 $ cat >> .hg/hgrc <<EOF
208 > [extensions]
209 > fakedirstatewritetime = !
210 > EOF
211
212 $ cat e
213 123
214 $ touch -t 200001010000 e
215 $ hg status -A e
216 M e
217
178 $ cd ..
218 $ cd ..
179
219
180
220
181 Issue241: update and revert produces inconsistent repositories
221 Issue241: update and revert produces inconsistent repositories
182 --------------------------------------------------------------
222 --------------------------------------------------------------
183
223
184 $ hg init a
224 $ hg init a
185 $ cd a
225 $ cd a
186 $ echo a >> a
226 $ echo a >> a
187 $ hg commit -A -d '1 0' -m a
227 $ hg commit -A -d '1 0' -m a
188 adding a
228 adding a
189 $ echo a >> a
229 $ echo a >> a
190 $ hg commit -d '2 0' -m a
230 $ hg commit -d '2 0' -m a
191 $ hg update 0
231 $ hg update 0
192 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 $ mkdir b
233 $ mkdir b
194 $ echo b > b/b
234 $ echo b > b/b
195
235
196 call `hg revert` with no file specified
236 call `hg revert` with no file specified
197 ---------------------------------------
237 ---------------------------------------
198
238
199 $ hg revert -rtip
239 $ hg revert -rtip
200 abort: no files or directories specified
240 abort: no files or directories specified
201 (use --all to revert all files, or 'hg update 1' to update)
241 (use --all to revert all files, or 'hg update 1' to update)
202 [255]
242 [255]
203
243
204 call `hg revert` with -I
244 call `hg revert` with -I
205 ---------------------------
245 ---------------------------
206
246
207 $ echo a >> a
247 $ echo a >> a
208 $ hg revert -I a
248 $ hg revert -I a
209 reverting a
249 reverting a
210
250
211 call `hg revert` with -X
251 call `hg revert` with -X
212 ---------------------------
252 ---------------------------
213
253
214 $ echo a >> a
254 $ echo a >> a
215 $ hg revert -X d
255 $ hg revert -X d
216 reverting a
256 reverting a
217
257
218 call `hg revert` with --all
258 call `hg revert` with --all
219 ---------------------------
259 ---------------------------
220
260
221 $ hg revert --all -rtip
261 $ hg revert --all -rtip
222 reverting a
262 reverting a
223 $ rm *.orig
263 $ rm *.orig
224
264
225 Issue332: confusing message when reverting directory
265 Issue332: confusing message when reverting directory
226 ----------------------------------------------------
266 ----------------------------------------------------
227
267
228 $ hg ci -A -m b
268 $ hg ci -A -m b
229 adding b/b
269 adding b/b
230 created new head
270 created new head
231 $ echo foobar > b/b
271 $ echo foobar > b/b
232 $ mkdir newdir
272 $ mkdir newdir
233 $ echo foo > newdir/newfile
273 $ echo foo > newdir/newfile
234 $ hg add newdir/newfile
274 $ hg add newdir/newfile
235 $ hg revert b newdir
275 $ hg revert b newdir
236 reverting b/b (glob)
276 reverting b/b (glob)
237 forgetting newdir/newfile (glob)
277 forgetting newdir/newfile (glob)
238 $ echo foobar > b/b
278 $ echo foobar > b/b
239 $ hg revert .
279 $ hg revert .
240 reverting b/b (glob)
280 reverting b/b (glob)
241
281
242
282
243 reverting a rename target should revert the source
283 reverting a rename target should revert the source
244 --------------------------------------------------
284 --------------------------------------------------
245
285
246 $ hg mv a newa
286 $ hg mv a newa
247 $ hg revert newa
287 $ hg revert newa
248 $ hg st a newa
288 $ hg st a newa
249 ? newa
289 ? newa
250
290
251 Also true for move overwriting an existing file
291 Also true for move overwriting an existing file
252
292
253 $ hg mv --force a b/b
293 $ hg mv --force a b/b
254 $ hg revert b/b
294 $ hg revert b/b
255 $ hg status a b/b
295 $ hg status a b/b
256
296
257 $ cd ..
297 $ cd ..
258
298
259 $ hg init ignored
299 $ hg init ignored
260 $ cd ignored
300 $ cd ignored
261 $ echo '^ignored$' > .hgignore
301 $ echo '^ignored$' > .hgignore
262 $ echo '^ignoreddir$' >> .hgignore
302 $ echo '^ignoreddir$' >> .hgignore
263 $ echo '^removed$' >> .hgignore
303 $ echo '^removed$' >> .hgignore
264
304
265 $ mkdir ignoreddir
305 $ mkdir ignoreddir
266 $ touch ignoreddir/file
306 $ touch ignoreddir/file
267 $ touch ignoreddir/removed
307 $ touch ignoreddir/removed
268 $ touch ignored
308 $ touch ignored
269 $ touch removed
309 $ touch removed
270
310
271 4 ignored files (we will add/commit everything)
311 4 ignored files (we will add/commit everything)
272
312
273 $ hg st -A -X .hgignore
313 $ hg st -A -X .hgignore
274 I ignored
314 I ignored
275 I ignoreddir/file
315 I ignoreddir/file
276 I ignoreddir/removed
316 I ignoreddir/removed
277 I removed
317 I removed
278 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
318 $ hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed
279
319
280 $ echo >> ignored
320 $ echo >> ignored
281 $ echo >> ignoreddir/file
321 $ echo >> ignoreddir/file
282 $ hg rm removed ignoreddir/removed
322 $ hg rm removed ignoreddir/removed
283
323
284 should revert ignored* and undelete *removed
324 should revert ignored* and undelete *removed
285 --------------------------------------------
325 --------------------------------------------
286
326
287 $ hg revert -a --no-backup
327 $ hg revert -a --no-backup
288 reverting ignored
328 reverting ignored
289 reverting ignoreddir/file (glob)
329 reverting ignoreddir/file (glob)
290 undeleting ignoreddir/removed (glob)
330 undeleting ignoreddir/removed (glob)
291 undeleting removed
331 undeleting removed
292 $ hg st -mardi
332 $ hg st -mardi
293
333
294 $ hg up -qC
334 $ hg up -qC
295 $ echo >> ignored
335 $ echo >> ignored
296 $ hg rm removed
336 $ hg rm removed
297
337
298 should silently revert the named files
338 should silently revert the named files
299 --------------------------------------
339 --------------------------------------
300
340
301 $ hg revert --no-backup ignored removed
341 $ hg revert --no-backup ignored removed
302 $ hg st -mardi
342 $ hg st -mardi
303
343
304 Reverting copy (issue3920)
344 Reverting copy (issue3920)
305 --------------------------
345 --------------------------
306
346
307 someone set up us the copies
347 someone set up us the copies
308
348
309 $ rm .hgignore
349 $ rm .hgignore
310 $ hg update -C
350 $ hg update -C
311 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
351 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
312 $ hg mv ignored allyour
352 $ hg mv ignored allyour
313 $ hg copy removed base
353 $ hg copy removed base
314 $ hg commit -m rename
354 $ hg commit -m rename
315
355
316 copies and renames, you have no chance to survive make your time (issue3920)
356 copies and renames, you have no chance to survive make your time (issue3920)
317
357
318 $ hg update '.^'
358 $ hg update '.^'
319 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
359 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
320 $ hg revert -rtip -a
360 $ hg revert -rtip -a
321 adding allyour
361 adding allyour
322 adding base
362 adding base
323 removing ignored
363 removing ignored
324 $ hg status -C
364 $ hg status -C
325 A allyour
365 A allyour
326 ignored
366 ignored
327 A base
367 A base
328 removed
368 removed
329 R ignored
369 R ignored
330
370
331 Test revert of a file added by one side of the merge
371 Test revert of a file added by one side of the merge
332 ====================================================
372 ====================================================
333
373
334 remove any pending change
374 remove any pending change
335
375
336 $ hg revert --all
376 $ hg revert --all
337 forgetting allyour
377 forgetting allyour
338 forgetting base
378 forgetting base
339 undeleting ignored
379 undeleting ignored
340 $ hg purge --all --config extensions.purge=
380 $ hg purge --all --config extensions.purge=
341
381
342 Adds a new commit
382 Adds a new commit
343
383
344 $ echo foo > newadd
384 $ echo foo > newadd
345 $ hg add newadd
385 $ hg add newadd
346 $ hg commit -m 'other adds'
386 $ hg commit -m 'other adds'
347 created new head
387 created new head
348
388
349
389
350 merge it with the other head
390 merge it with the other head
351
391
352 $ hg merge # merge 1 into 2
392 $ hg merge # merge 1 into 2
353 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
393 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
354 (branch merge, don't forget to commit)
394 (branch merge, don't forget to commit)
355 $ hg summary
395 $ hg summary
356 parent: 2:b8ec310b2d4e tip
396 parent: 2:b8ec310b2d4e tip
357 other adds
397 other adds
358 parent: 1:f6180deb8fbe
398 parent: 1:f6180deb8fbe
359 rename
399 rename
360 branch: default
400 branch: default
361 commit: 2 modified, 1 removed (merge)
401 commit: 2 modified, 1 removed (merge)
362 update: (current)
402 update: (current)
363 phases: 3 draft
403 phases: 3 draft
364
404
365 clarifies who added what
405 clarifies who added what
366
406
367 $ hg status
407 $ hg status
368 M allyour
408 M allyour
369 M base
409 M base
370 R ignored
410 R ignored
371 $ hg status --change 'p1()'
411 $ hg status --change 'p1()'
372 A newadd
412 A newadd
373 $ hg status --change 'p2()'
413 $ hg status --change 'p2()'
374 A allyour
414 A allyour
375 A base
415 A base
376 R ignored
416 R ignored
377
417
378 revert file added by p1() to p1() state
418 revert file added by p1() to p1() state
379 -----------------------------------------
419 -----------------------------------------
380
420
381 $ hg revert -r 'p1()' 'glob:newad?'
421 $ hg revert -r 'p1()' 'glob:newad?'
382 $ hg status
422 $ hg status
383 M allyour
423 M allyour
384 M base
424 M base
385 R ignored
425 R ignored
386
426
387 revert file added by p1() to p2() state
427 revert file added by p1() to p2() state
388 ------------------------------------------
428 ------------------------------------------
389
429
390 $ hg revert -r 'p2()' 'glob:newad?'
430 $ hg revert -r 'p2()' 'glob:newad?'
391 removing newadd
431 removing newadd
392 $ hg status
432 $ hg status
393 M allyour
433 M allyour
394 M base
434 M base
395 R ignored
435 R ignored
396 R newadd
436 R newadd
397
437
398 revert file added by p2() to p2() state
438 revert file added by p2() to p2() state
399 ------------------------------------------
439 ------------------------------------------
400
440
401 $ hg revert -r 'p2()' 'glob:allyou?'
441 $ hg revert -r 'p2()' 'glob:allyou?'
402 $ hg status
442 $ hg status
403 M allyour
443 M allyour
404 M base
444 M base
405 R ignored
445 R ignored
406 R newadd
446 R newadd
407
447
408 revert file added by p2() to p1() state
448 revert file added by p2() to p1() state
409 ------------------------------------------
449 ------------------------------------------
410
450
411 $ hg revert -r 'p1()' 'glob:allyou?'
451 $ hg revert -r 'p1()' 'glob:allyou?'
412 removing allyour
452 removing allyour
413 $ hg status
453 $ hg status
414 M base
454 M base
415 R allyour
455 R allyour
416 R ignored
456 R ignored
417 R newadd
457 R newadd
418
458
419 Systematic behavior validation of most possible cases
459 Systematic behavior validation of most possible cases
420 =====================================================
460 =====================================================
421
461
422 This section tests most of the possible combinations of revision states and
462 This section tests most of the possible combinations of revision states and
423 working directory states. The number of possible cases is significant but they
463 working directory states. The number of possible cases is significant but they
424 but they all have a slightly different handling. So this section commits to
464 but they all have a slightly different handling. So this section commits to
425 and testing all of them to allow safe refactoring of the revert code.
465 and testing all of them to allow safe refactoring of the revert code.
426
466
427 A python script is used to generate a file history for each combination of
467 A python script is used to generate a file history for each combination of
428 states, on one side the content (or lack thereof) in two revisions, and
468 states, on one side the content (or lack thereof) in two revisions, and
429 on the other side, the content and "tracked-ness" of the working directory. The
469 on the other side, the content and "tracked-ness" of the working directory. The
430 three states generated are:
470 three states generated are:
431
471
432 - a "base" revision
472 - a "base" revision
433 - a "parent" revision
473 - a "parent" revision
434 - the working directory (based on "parent")
474 - the working directory (based on "parent")
435
475
436 The files generated have names of the form:
476 The files generated have names of the form:
437
477
438 <rev1-content>_<rev2-content>_<working-copy-content>-<tracked-ness>
478 <rev1-content>_<rev2-content>_<working-copy-content>-<tracked-ness>
439
479
440 All known states are not tested yet. See inline documentation for details.
480 All known states are not tested yet. See inline documentation for details.
441 Special cases from merge and rename are not tested by this section.
481 Special cases from merge and rename are not tested by this section.
442
482
443 Write the python script to disk
483 Write the python script to disk
444 -------------------------------
484 -------------------------------
445
485
446 check list of planned files
486 check list of planned files
447
487
448 $ python $TESTDIR/generate-working-copy-states.py filelist 2
488 $ python $TESTDIR/generate-working-copy-states.py filelist 2
449 content1_content1_content1-tracked
489 content1_content1_content1-tracked
450 content1_content1_content1-untracked
490 content1_content1_content1-untracked
451 content1_content1_content3-tracked
491 content1_content1_content3-tracked
452 content1_content1_content3-untracked
492 content1_content1_content3-untracked
453 content1_content1_missing-tracked
493 content1_content1_missing-tracked
454 content1_content1_missing-untracked
494 content1_content1_missing-untracked
455 content1_content2_content1-tracked
495 content1_content2_content1-tracked
456 content1_content2_content1-untracked
496 content1_content2_content1-untracked
457 content1_content2_content2-tracked
497 content1_content2_content2-tracked
458 content1_content2_content2-untracked
498 content1_content2_content2-untracked
459 content1_content2_content3-tracked
499 content1_content2_content3-tracked
460 content1_content2_content3-untracked
500 content1_content2_content3-untracked
461 content1_content2_missing-tracked
501 content1_content2_missing-tracked
462 content1_content2_missing-untracked
502 content1_content2_missing-untracked
463 content1_missing_content1-tracked
503 content1_missing_content1-tracked
464 content1_missing_content1-untracked
504 content1_missing_content1-untracked
465 content1_missing_content3-tracked
505 content1_missing_content3-tracked
466 content1_missing_content3-untracked
506 content1_missing_content3-untracked
467 content1_missing_missing-tracked
507 content1_missing_missing-tracked
468 content1_missing_missing-untracked
508 content1_missing_missing-untracked
469 missing_content2_content2-tracked
509 missing_content2_content2-tracked
470 missing_content2_content2-untracked
510 missing_content2_content2-untracked
471 missing_content2_content3-tracked
511 missing_content2_content3-tracked
472 missing_content2_content3-untracked
512 missing_content2_content3-untracked
473 missing_content2_missing-tracked
513 missing_content2_missing-tracked
474 missing_content2_missing-untracked
514 missing_content2_missing-untracked
475 missing_missing_content3-tracked
515 missing_missing_content3-tracked
476 missing_missing_content3-untracked
516 missing_missing_content3-untracked
477 missing_missing_missing-tracked
517 missing_missing_missing-tracked
478 missing_missing_missing-untracked
518 missing_missing_missing-untracked
479
519
480 Script to make a simple text version of the content
520 Script to make a simple text version of the content
481 ---------------------------------------------------
521 ---------------------------------------------------
482
522
483 $ cat << EOF >> dircontent.py
523 $ cat << EOF >> dircontent.py
484 > # generate a simple text view of the directory for easy comparison
524 > # generate a simple text view of the directory for easy comparison
485 > import os
525 > import os
486 > files = os.listdir('.')
526 > files = os.listdir('.')
487 > files.sort()
527 > files.sort()
488 > for filename in files:
528 > for filename in files:
489 > if os.path.isdir(filename):
529 > if os.path.isdir(filename):
490 > continue
530 > continue
491 > content = open(filename).read()
531 > content = open(filename).read()
492 > print '%-6s %s' % (content.strip(), filename)
532 > print '%-6s %s' % (content.strip(), filename)
493 > EOF
533 > EOF
494
534
495 Generate appropriate repo state
535 Generate appropriate repo state
496 -------------------------------
536 -------------------------------
497
537
498 $ hg init revert-ref
538 $ hg init revert-ref
499 $ cd revert-ref
539 $ cd revert-ref
500
540
501 Generate base changeset
541 Generate base changeset
502
542
503 $ python $TESTDIR/generate-working-copy-states.py state 2 1
543 $ python $TESTDIR/generate-working-copy-states.py state 2 1
504 $ hg addremove --similarity 0
544 $ hg addremove --similarity 0
505 adding content1_content1_content1-tracked
545 adding content1_content1_content1-tracked
506 adding content1_content1_content1-untracked
546 adding content1_content1_content1-untracked
507 adding content1_content1_content3-tracked
547 adding content1_content1_content3-tracked
508 adding content1_content1_content3-untracked
548 adding content1_content1_content3-untracked
509 adding content1_content1_missing-tracked
549 adding content1_content1_missing-tracked
510 adding content1_content1_missing-untracked
550 adding content1_content1_missing-untracked
511 adding content1_content2_content1-tracked
551 adding content1_content2_content1-tracked
512 adding content1_content2_content1-untracked
552 adding content1_content2_content1-untracked
513 adding content1_content2_content2-tracked
553 adding content1_content2_content2-tracked
514 adding content1_content2_content2-untracked
554 adding content1_content2_content2-untracked
515 adding content1_content2_content3-tracked
555 adding content1_content2_content3-tracked
516 adding content1_content2_content3-untracked
556 adding content1_content2_content3-untracked
517 adding content1_content2_missing-tracked
557 adding content1_content2_missing-tracked
518 adding content1_content2_missing-untracked
558 adding content1_content2_missing-untracked
519 adding content1_missing_content1-tracked
559 adding content1_missing_content1-tracked
520 adding content1_missing_content1-untracked
560 adding content1_missing_content1-untracked
521 adding content1_missing_content3-tracked
561 adding content1_missing_content3-tracked
522 adding content1_missing_content3-untracked
562 adding content1_missing_content3-untracked
523 adding content1_missing_missing-tracked
563 adding content1_missing_missing-tracked
524 adding content1_missing_missing-untracked
564 adding content1_missing_missing-untracked
525 $ hg status
565 $ hg status
526 A content1_content1_content1-tracked
566 A content1_content1_content1-tracked
527 A content1_content1_content1-untracked
567 A content1_content1_content1-untracked
528 A content1_content1_content3-tracked
568 A content1_content1_content3-tracked
529 A content1_content1_content3-untracked
569 A content1_content1_content3-untracked
530 A content1_content1_missing-tracked
570 A content1_content1_missing-tracked
531 A content1_content1_missing-untracked
571 A content1_content1_missing-untracked
532 A content1_content2_content1-tracked
572 A content1_content2_content1-tracked
533 A content1_content2_content1-untracked
573 A content1_content2_content1-untracked
534 A content1_content2_content2-tracked
574 A content1_content2_content2-tracked
535 A content1_content2_content2-untracked
575 A content1_content2_content2-untracked
536 A content1_content2_content3-tracked
576 A content1_content2_content3-tracked
537 A content1_content2_content3-untracked
577 A content1_content2_content3-untracked
538 A content1_content2_missing-tracked
578 A content1_content2_missing-tracked
539 A content1_content2_missing-untracked
579 A content1_content2_missing-untracked
540 A content1_missing_content1-tracked
580 A content1_missing_content1-tracked
541 A content1_missing_content1-untracked
581 A content1_missing_content1-untracked
542 A content1_missing_content3-tracked
582 A content1_missing_content3-tracked
543 A content1_missing_content3-untracked
583 A content1_missing_content3-untracked
544 A content1_missing_missing-tracked
584 A content1_missing_missing-tracked
545 A content1_missing_missing-untracked
585 A content1_missing_missing-untracked
546 $ hg commit -m 'base'
586 $ hg commit -m 'base'
547
587
548 (create a simple text version of the content)
588 (create a simple text version of the content)
549
589
550 $ python ../dircontent.py > ../content-base.txt
590 $ python ../dircontent.py > ../content-base.txt
551 $ cat ../content-base.txt
591 $ cat ../content-base.txt
552 content1 content1_content1_content1-tracked
592 content1 content1_content1_content1-tracked
553 content1 content1_content1_content1-untracked
593 content1 content1_content1_content1-untracked
554 content1 content1_content1_content3-tracked
594 content1 content1_content1_content3-tracked
555 content1 content1_content1_content3-untracked
595 content1 content1_content1_content3-untracked
556 content1 content1_content1_missing-tracked
596 content1 content1_content1_missing-tracked
557 content1 content1_content1_missing-untracked
597 content1 content1_content1_missing-untracked
558 content1 content1_content2_content1-tracked
598 content1 content1_content2_content1-tracked
559 content1 content1_content2_content1-untracked
599 content1 content1_content2_content1-untracked
560 content1 content1_content2_content2-tracked
600 content1 content1_content2_content2-tracked
561 content1 content1_content2_content2-untracked
601 content1 content1_content2_content2-untracked
562 content1 content1_content2_content3-tracked
602 content1 content1_content2_content3-tracked
563 content1 content1_content2_content3-untracked
603 content1 content1_content2_content3-untracked
564 content1 content1_content2_missing-tracked
604 content1 content1_content2_missing-tracked
565 content1 content1_content2_missing-untracked
605 content1 content1_content2_missing-untracked
566 content1 content1_missing_content1-tracked
606 content1 content1_missing_content1-tracked
567 content1 content1_missing_content1-untracked
607 content1 content1_missing_content1-untracked
568 content1 content1_missing_content3-tracked
608 content1 content1_missing_content3-tracked
569 content1 content1_missing_content3-untracked
609 content1 content1_missing_content3-untracked
570 content1 content1_missing_missing-tracked
610 content1 content1_missing_missing-tracked
571 content1 content1_missing_missing-untracked
611 content1 content1_missing_missing-untracked
572
612
573 Create parent changeset
613 Create parent changeset
574
614
575 $ python $TESTDIR/generate-working-copy-states.py state 2 2
615 $ python $TESTDIR/generate-working-copy-states.py state 2 2
576 $ hg addremove --similarity 0
616 $ hg addremove --similarity 0
577 removing content1_missing_content1-tracked
617 removing content1_missing_content1-tracked
578 removing content1_missing_content1-untracked
618 removing content1_missing_content1-untracked
579 removing content1_missing_content3-tracked
619 removing content1_missing_content3-tracked
580 removing content1_missing_content3-untracked
620 removing content1_missing_content3-untracked
581 removing content1_missing_missing-tracked
621 removing content1_missing_missing-tracked
582 removing content1_missing_missing-untracked
622 removing content1_missing_missing-untracked
583 adding missing_content2_content2-tracked
623 adding missing_content2_content2-tracked
584 adding missing_content2_content2-untracked
624 adding missing_content2_content2-untracked
585 adding missing_content2_content3-tracked
625 adding missing_content2_content3-tracked
586 adding missing_content2_content3-untracked
626 adding missing_content2_content3-untracked
587 adding missing_content2_missing-tracked
627 adding missing_content2_missing-tracked
588 adding missing_content2_missing-untracked
628 adding missing_content2_missing-untracked
589 $ hg status
629 $ hg status
590 M content1_content2_content1-tracked
630 M content1_content2_content1-tracked
591 M content1_content2_content1-untracked
631 M content1_content2_content1-untracked
592 M content1_content2_content2-tracked
632 M content1_content2_content2-tracked
593 M content1_content2_content2-untracked
633 M content1_content2_content2-untracked
594 M content1_content2_content3-tracked
634 M content1_content2_content3-tracked
595 M content1_content2_content3-untracked
635 M content1_content2_content3-untracked
596 M content1_content2_missing-tracked
636 M content1_content2_missing-tracked
597 M content1_content2_missing-untracked
637 M content1_content2_missing-untracked
598 A missing_content2_content2-tracked
638 A missing_content2_content2-tracked
599 A missing_content2_content2-untracked
639 A missing_content2_content2-untracked
600 A missing_content2_content3-tracked
640 A missing_content2_content3-tracked
601 A missing_content2_content3-untracked
641 A missing_content2_content3-untracked
602 A missing_content2_missing-tracked
642 A missing_content2_missing-tracked
603 A missing_content2_missing-untracked
643 A missing_content2_missing-untracked
604 R content1_missing_content1-tracked
644 R content1_missing_content1-tracked
605 R content1_missing_content1-untracked
645 R content1_missing_content1-untracked
606 R content1_missing_content3-tracked
646 R content1_missing_content3-tracked
607 R content1_missing_content3-untracked
647 R content1_missing_content3-untracked
608 R content1_missing_missing-tracked
648 R content1_missing_missing-tracked
609 R content1_missing_missing-untracked
649 R content1_missing_missing-untracked
610 $ hg commit -m 'parent'
650 $ hg commit -m 'parent'
611
651
612 (create a simple text version of the content)
652 (create a simple text version of the content)
613
653
614 $ python ../dircontent.py > ../content-parent.txt
654 $ python ../dircontent.py > ../content-parent.txt
615 $ cat ../content-parent.txt
655 $ cat ../content-parent.txt
616 content1 content1_content1_content1-tracked
656 content1 content1_content1_content1-tracked
617 content1 content1_content1_content1-untracked
657 content1 content1_content1_content1-untracked
618 content1 content1_content1_content3-tracked
658 content1 content1_content1_content3-tracked
619 content1 content1_content1_content3-untracked
659 content1 content1_content1_content3-untracked
620 content1 content1_content1_missing-tracked
660 content1 content1_content1_missing-tracked
621 content1 content1_content1_missing-untracked
661 content1 content1_content1_missing-untracked
622 content2 content1_content2_content1-tracked
662 content2 content1_content2_content1-tracked
623 content2 content1_content2_content1-untracked
663 content2 content1_content2_content1-untracked
624 content2 content1_content2_content2-tracked
664 content2 content1_content2_content2-tracked
625 content2 content1_content2_content2-untracked
665 content2 content1_content2_content2-untracked
626 content2 content1_content2_content3-tracked
666 content2 content1_content2_content3-tracked
627 content2 content1_content2_content3-untracked
667 content2 content1_content2_content3-untracked
628 content2 content1_content2_missing-tracked
668 content2 content1_content2_missing-tracked
629 content2 content1_content2_missing-untracked
669 content2 content1_content2_missing-untracked
630 content2 missing_content2_content2-tracked
670 content2 missing_content2_content2-tracked
631 content2 missing_content2_content2-untracked
671 content2 missing_content2_content2-untracked
632 content2 missing_content2_content3-tracked
672 content2 missing_content2_content3-tracked
633 content2 missing_content2_content3-untracked
673 content2 missing_content2_content3-untracked
634 content2 missing_content2_missing-tracked
674 content2 missing_content2_missing-tracked
635 content2 missing_content2_missing-untracked
675 content2 missing_content2_missing-untracked
636
676
637 Setup working directory
677 Setup working directory
638
678
639 $ python $TESTDIR/generate-working-copy-states.py state 2 wc
679 $ python $TESTDIR/generate-working-copy-states.py state 2 wc
640 $ hg addremove --similarity 0
680 $ hg addremove --similarity 0
641 adding content1_missing_content1-tracked
681 adding content1_missing_content1-tracked
642 adding content1_missing_content1-untracked
682 adding content1_missing_content1-untracked
643 adding content1_missing_content3-tracked
683 adding content1_missing_content3-tracked
644 adding content1_missing_content3-untracked
684 adding content1_missing_content3-untracked
645 adding content1_missing_missing-tracked
685 adding content1_missing_missing-tracked
646 adding content1_missing_missing-untracked
686 adding content1_missing_missing-untracked
647 adding missing_missing_content3-tracked
687 adding missing_missing_content3-tracked
648 adding missing_missing_content3-untracked
688 adding missing_missing_content3-untracked
649 adding missing_missing_missing-tracked
689 adding missing_missing_missing-tracked
650 adding missing_missing_missing-untracked
690 adding missing_missing_missing-untracked
651 $ hg forget *_*_*-untracked
691 $ hg forget *_*_*-untracked
652 $ rm *_*_missing-*
692 $ rm *_*_missing-*
653 $ hg status
693 $ hg status
654 M content1_content1_content3-tracked
694 M content1_content1_content3-tracked
655 M content1_content2_content1-tracked
695 M content1_content2_content1-tracked
656 M content1_content2_content3-tracked
696 M content1_content2_content3-tracked
657 M missing_content2_content3-tracked
697 M missing_content2_content3-tracked
658 A content1_missing_content1-tracked
698 A content1_missing_content1-tracked
659 A content1_missing_content3-tracked
699 A content1_missing_content3-tracked
660 A missing_missing_content3-tracked
700 A missing_missing_content3-tracked
661 R content1_content1_content1-untracked
701 R content1_content1_content1-untracked
662 R content1_content1_content3-untracked
702 R content1_content1_content3-untracked
663 R content1_content1_missing-untracked
703 R content1_content1_missing-untracked
664 R content1_content2_content1-untracked
704 R content1_content2_content1-untracked
665 R content1_content2_content2-untracked
705 R content1_content2_content2-untracked
666 R content1_content2_content3-untracked
706 R content1_content2_content3-untracked
667 R content1_content2_missing-untracked
707 R content1_content2_missing-untracked
668 R missing_content2_content2-untracked
708 R missing_content2_content2-untracked
669 R missing_content2_content3-untracked
709 R missing_content2_content3-untracked
670 R missing_content2_missing-untracked
710 R missing_content2_missing-untracked
671 ! content1_content1_missing-tracked
711 ! content1_content1_missing-tracked
672 ! content1_content2_missing-tracked
712 ! content1_content2_missing-tracked
673 ! content1_missing_missing-tracked
713 ! content1_missing_missing-tracked
674 ! missing_content2_missing-tracked
714 ! missing_content2_missing-tracked
675 ! missing_missing_missing-tracked
715 ! missing_missing_missing-tracked
676 ? content1_missing_content1-untracked
716 ? content1_missing_content1-untracked
677 ? content1_missing_content3-untracked
717 ? content1_missing_content3-untracked
678 ? missing_missing_content3-untracked
718 ? missing_missing_content3-untracked
679
719
680 $ hg status --rev 'desc("base")'
720 $ hg status --rev 'desc("base")'
681 M content1_content1_content3-tracked
721 M content1_content1_content3-tracked
682 M content1_content2_content2-tracked
722 M content1_content2_content2-tracked
683 M content1_content2_content3-tracked
723 M content1_content2_content3-tracked
684 M content1_missing_content3-tracked
724 M content1_missing_content3-tracked
685 A missing_content2_content2-tracked
725 A missing_content2_content2-tracked
686 A missing_content2_content3-tracked
726 A missing_content2_content3-tracked
687 A missing_missing_content3-tracked
727 A missing_missing_content3-tracked
688 R content1_content1_content1-untracked
728 R content1_content1_content1-untracked
689 R content1_content1_content3-untracked
729 R content1_content1_content3-untracked
690 R content1_content1_missing-untracked
730 R content1_content1_missing-untracked
691 R content1_content2_content1-untracked
731 R content1_content2_content1-untracked
692 R content1_content2_content2-untracked
732 R content1_content2_content2-untracked
693 R content1_content2_content3-untracked
733 R content1_content2_content3-untracked
694 R content1_content2_missing-untracked
734 R content1_content2_missing-untracked
695 R content1_missing_content1-untracked
735 R content1_missing_content1-untracked
696 R content1_missing_content3-untracked
736 R content1_missing_content3-untracked
697 R content1_missing_missing-untracked
737 R content1_missing_missing-untracked
698 ! content1_content1_missing-tracked
738 ! content1_content1_missing-tracked
699 ! content1_content2_missing-tracked
739 ! content1_content2_missing-tracked
700 ! content1_missing_missing-tracked
740 ! content1_missing_missing-tracked
701 ! missing_content2_missing-tracked
741 ! missing_content2_missing-tracked
702 ! missing_missing_missing-tracked
742 ! missing_missing_missing-tracked
703 ? missing_missing_content3-untracked
743 ? missing_missing_content3-untracked
704
744
705 (create a simple text version of the content)
745 (create a simple text version of the content)
706
746
707 $ python ../dircontent.py > ../content-wc.txt
747 $ python ../dircontent.py > ../content-wc.txt
708 $ cat ../content-wc.txt
748 $ cat ../content-wc.txt
709 content1 content1_content1_content1-tracked
749 content1 content1_content1_content1-tracked
710 content1 content1_content1_content1-untracked
750 content1 content1_content1_content1-untracked
711 content3 content1_content1_content3-tracked
751 content3 content1_content1_content3-tracked
712 content3 content1_content1_content3-untracked
752 content3 content1_content1_content3-untracked
713 content1 content1_content2_content1-tracked
753 content1 content1_content2_content1-tracked
714 content1 content1_content2_content1-untracked
754 content1 content1_content2_content1-untracked
715 content2 content1_content2_content2-tracked
755 content2 content1_content2_content2-tracked
716 content2 content1_content2_content2-untracked
756 content2 content1_content2_content2-untracked
717 content3 content1_content2_content3-tracked
757 content3 content1_content2_content3-tracked
718 content3 content1_content2_content3-untracked
758 content3 content1_content2_content3-untracked
719 content1 content1_missing_content1-tracked
759 content1 content1_missing_content1-tracked
720 content1 content1_missing_content1-untracked
760 content1 content1_missing_content1-untracked
721 content3 content1_missing_content3-tracked
761 content3 content1_missing_content3-tracked
722 content3 content1_missing_content3-untracked
762 content3 content1_missing_content3-untracked
723 content2 missing_content2_content2-tracked
763 content2 missing_content2_content2-tracked
724 content2 missing_content2_content2-untracked
764 content2 missing_content2_content2-untracked
725 content3 missing_content2_content3-tracked
765 content3 missing_content2_content3-tracked
726 content3 missing_content2_content3-untracked
766 content3 missing_content2_content3-untracked
727 content3 missing_missing_content3-tracked
767 content3 missing_missing_content3-tracked
728 content3 missing_missing_content3-untracked
768 content3 missing_missing_content3-untracked
729
769
730 $ cd ..
770 $ cd ..
731
771
732 Test revert --all to parent content
772 Test revert --all to parent content
733 -----------------------------------
773 -----------------------------------
734
774
735 (setup from reference repo)
775 (setup from reference repo)
736
776
737 $ cp -r revert-ref revert-parent-all
777 $ cp -r revert-ref revert-parent-all
738 $ cd revert-parent-all
778 $ cd revert-parent-all
739
779
740 check revert output
780 check revert output
741
781
742 $ hg revert --all
782 $ hg revert --all
743 undeleting content1_content1_content1-untracked
783 undeleting content1_content1_content1-untracked
744 reverting content1_content1_content3-tracked
784 reverting content1_content1_content3-tracked
745 undeleting content1_content1_content3-untracked
785 undeleting content1_content1_content3-untracked
746 reverting content1_content1_missing-tracked
786 reverting content1_content1_missing-tracked
747 undeleting content1_content1_missing-untracked
787 undeleting content1_content1_missing-untracked
748 reverting content1_content2_content1-tracked
788 reverting content1_content2_content1-tracked
749 undeleting content1_content2_content1-untracked
789 undeleting content1_content2_content1-untracked
750 undeleting content1_content2_content2-untracked
790 undeleting content1_content2_content2-untracked
751 reverting content1_content2_content3-tracked
791 reverting content1_content2_content3-tracked
752 undeleting content1_content2_content3-untracked
792 undeleting content1_content2_content3-untracked
753 reverting content1_content2_missing-tracked
793 reverting content1_content2_missing-tracked
754 undeleting content1_content2_missing-untracked
794 undeleting content1_content2_missing-untracked
755 forgetting content1_missing_content1-tracked
795 forgetting content1_missing_content1-tracked
756 forgetting content1_missing_content3-tracked
796 forgetting content1_missing_content3-tracked
757 forgetting content1_missing_missing-tracked
797 forgetting content1_missing_missing-tracked
758 undeleting missing_content2_content2-untracked
798 undeleting missing_content2_content2-untracked
759 reverting missing_content2_content3-tracked
799 reverting missing_content2_content3-tracked
760 undeleting missing_content2_content3-untracked
800 undeleting missing_content2_content3-untracked
761 reverting missing_content2_missing-tracked
801 reverting missing_content2_missing-tracked
762 undeleting missing_content2_missing-untracked
802 undeleting missing_content2_missing-untracked
763 forgetting missing_missing_content3-tracked
803 forgetting missing_missing_content3-tracked
764 forgetting missing_missing_missing-tracked
804 forgetting missing_missing_missing-tracked
765
805
766 Compare resulting directory with revert target.
806 Compare resulting directory with revert target.
767
807
768 The diff is filtered to include change only. The only difference should be
808 The diff is filtered to include change only. The only difference should be
769 additional `.orig` backup file when applicable.
809 additional `.orig` backup file when applicable.
770
810
771 $ python ../dircontent.py > ../content-parent-all.txt
811 $ python ../dircontent.py > ../content-parent-all.txt
772 $ cd ..
812 $ cd ..
773 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
813 $ diff -U 0 -- content-parent.txt content-parent-all.txt | grep _
774 +content3 content1_content1_content3-tracked.orig
814 +content3 content1_content1_content3-tracked.orig
775 +content3 content1_content1_content3-untracked.orig
815 +content3 content1_content1_content3-untracked.orig
776 +content1 content1_content2_content1-tracked.orig
816 +content1 content1_content2_content1-tracked.orig
777 +content1 content1_content2_content1-untracked.orig
817 +content1 content1_content2_content1-untracked.orig
778 +content3 content1_content2_content3-tracked.orig
818 +content3 content1_content2_content3-tracked.orig
779 +content3 content1_content2_content3-untracked.orig
819 +content3 content1_content2_content3-untracked.orig
780 +content1 content1_missing_content1-tracked
820 +content1 content1_missing_content1-tracked
781 +content1 content1_missing_content1-untracked
821 +content1 content1_missing_content1-untracked
782 +content3 content1_missing_content3-tracked
822 +content3 content1_missing_content3-tracked
783 +content3 content1_missing_content3-untracked
823 +content3 content1_missing_content3-untracked
784 +content3 missing_content2_content3-tracked.orig
824 +content3 missing_content2_content3-tracked.orig
785 +content3 missing_content2_content3-untracked.orig
825 +content3 missing_content2_content3-untracked.orig
786 +content3 missing_missing_content3-tracked
826 +content3 missing_missing_content3-tracked
787 +content3 missing_missing_content3-untracked
827 +content3 missing_missing_content3-untracked
788
828
789 Test revert --all to "base" content
829 Test revert --all to "base" content
790 -----------------------------------
830 -----------------------------------
791
831
792 (setup from reference repo)
832 (setup from reference repo)
793
833
794 $ cp -r revert-ref revert-base-all
834 $ cp -r revert-ref revert-base-all
795 $ cd revert-base-all
835 $ cd revert-base-all
796
836
797 check revert output
837 check revert output
798
838
799 $ hg revert --all --rev 'desc(base)'
839 $ hg revert --all --rev 'desc(base)'
800 undeleting content1_content1_content1-untracked
840 undeleting content1_content1_content1-untracked
801 reverting content1_content1_content3-tracked
841 reverting content1_content1_content3-tracked
802 undeleting content1_content1_content3-untracked
842 undeleting content1_content1_content3-untracked
803 reverting content1_content1_missing-tracked
843 reverting content1_content1_missing-tracked
804 undeleting content1_content1_missing-untracked
844 undeleting content1_content1_missing-untracked
805 undeleting content1_content2_content1-untracked
845 undeleting content1_content2_content1-untracked
806 reverting content1_content2_content2-tracked
846 reverting content1_content2_content2-tracked
807 undeleting content1_content2_content2-untracked
847 undeleting content1_content2_content2-untracked
808 reverting content1_content2_content3-tracked
848 reverting content1_content2_content3-tracked
809 undeleting content1_content2_content3-untracked
849 undeleting content1_content2_content3-untracked
810 reverting content1_content2_missing-tracked
850 reverting content1_content2_missing-tracked
811 undeleting content1_content2_missing-untracked
851 undeleting content1_content2_missing-untracked
812 adding content1_missing_content1-untracked
852 adding content1_missing_content1-untracked
813 reverting content1_missing_content3-tracked
853 reverting content1_missing_content3-tracked
814 adding content1_missing_content3-untracked
854 adding content1_missing_content3-untracked
815 reverting content1_missing_missing-tracked
855 reverting content1_missing_missing-tracked
816 adding content1_missing_missing-untracked
856 adding content1_missing_missing-untracked
817 removing missing_content2_content2-tracked
857 removing missing_content2_content2-tracked
818 removing missing_content2_content3-tracked
858 removing missing_content2_content3-tracked
819 removing missing_content2_missing-tracked
859 removing missing_content2_missing-tracked
820 forgetting missing_missing_content3-tracked
860 forgetting missing_missing_content3-tracked
821 forgetting missing_missing_missing-tracked
861 forgetting missing_missing_missing-tracked
822
862
823 Compare resulting directory with revert target.
863 Compare resulting directory with revert target.
824
864
825 The diff is filtered to include change only. The only difference should be
865 The diff is filtered to include change only. The only difference should be
826 additional `.orig` backup file when applicable.
866 additional `.orig` backup file when applicable.
827
867
828 $ python ../dircontent.py > ../content-base-all.txt
868 $ python ../dircontent.py > ../content-base-all.txt
829 $ cd ..
869 $ cd ..
830 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
870 $ diff -U 0 -- content-base.txt content-base-all.txt | grep _
831 +content3 content1_content1_content3-tracked.orig
871 +content3 content1_content1_content3-tracked.orig
832 +content3 content1_content1_content3-untracked.orig
872 +content3 content1_content1_content3-untracked.orig
833 +content2 content1_content2_content2-untracked.orig
873 +content2 content1_content2_content2-untracked.orig
834 +content3 content1_content2_content3-tracked.orig
874 +content3 content1_content2_content3-tracked.orig
835 +content3 content1_content2_content3-untracked.orig
875 +content3 content1_content2_content3-untracked.orig
836 +content3 content1_missing_content3-tracked.orig
876 +content3 content1_missing_content3-tracked.orig
837 +content3 content1_missing_content3-untracked.orig
877 +content3 content1_missing_content3-untracked.orig
838 +content2 missing_content2_content2-untracked
878 +content2 missing_content2_content2-untracked
839 +content3 missing_content2_content3-tracked.orig
879 +content3 missing_content2_content3-tracked.orig
840 +content3 missing_content2_content3-untracked
880 +content3 missing_content2_content3-untracked
841 +content3 missing_missing_content3-tracked
881 +content3 missing_missing_content3-tracked
842 +content3 missing_missing_content3-untracked
882 +content3 missing_missing_content3-untracked
843
883
844 Test revert to parent content with explicit file name
884 Test revert to parent content with explicit file name
845 -----------------------------------------------------
885 -----------------------------------------------------
846
886
847 (setup from reference repo)
887 (setup from reference repo)
848
888
849 $ cp -r revert-ref revert-parent-explicit
889 $ cp -r revert-ref revert-parent-explicit
850 $ cd revert-parent-explicit
890 $ cd revert-parent-explicit
851
891
852 revert all files individually and check the output
892 revert all files individually and check the output
853 (output is expected to be different than in the --all case)
893 (output is expected to be different than in the --all case)
854
894
855 $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do
895 $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do
856 > echo '### revert for:' $file;
896 > echo '### revert for:' $file;
857 > hg revert $file;
897 > hg revert $file;
858 > echo
898 > echo
859 > done
899 > done
860 ### revert for: content1_content1_content1-tracked
900 ### revert for: content1_content1_content1-tracked
861 no changes needed to content1_content1_content1-tracked
901 no changes needed to content1_content1_content1-tracked
862
902
863 ### revert for: content1_content1_content1-untracked
903 ### revert for: content1_content1_content1-untracked
864
904
865 ### revert for: content1_content1_content3-tracked
905 ### revert for: content1_content1_content3-tracked
866
906
867 ### revert for: content1_content1_content3-untracked
907 ### revert for: content1_content1_content3-untracked
868
908
869 ### revert for: content1_content1_missing-tracked
909 ### revert for: content1_content1_missing-tracked
870
910
871 ### revert for: content1_content1_missing-untracked
911 ### revert for: content1_content1_missing-untracked
872
912
873 ### revert for: content1_content2_content1-tracked
913 ### revert for: content1_content2_content1-tracked
874
914
875 ### revert for: content1_content2_content1-untracked
915 ### revert for: content1_content2_content1-untracked
876
916
877 ### revert for: content1_content2_content2-tracked
917 ### revert for: content1_content2_content2-tracked
878 no changes needed to content1_content2_content2-tracked
918 no changes needed to content1_content2_content2-tracked
879
919
880 ### revert for: content1_content2_content2-untracked
920 ### revert for: content1_content2_content2-untracked
881
921
882 ### revert for: content1_content2_content3-tracked
922 ### revert for: content1_content2_content3-tracked
883
923
884 ### revert for: content1_content2_content3-untracked
924 ### revert for: content1_content2_content3-untracked
885
925
886 ### revert for: content1_content2_missing-tracked
926 ### revert for: content1_content2_missing-tracked
887
927
888 ### revert for: content1_content2_missing-untracked
928 ### revert for: content1_content2_missing-untracked
889
929
890 ### revert for: content1_missing_content1-tracked
930 ### revert for: content1_missing_content1-tracked
891
931
892 ### revert for: content1_missing_content1-untracked
932 ### revert for: content1_missing_content1-untracked
893 file not managed: content1_missing_content1-untracked
933 file not managed: content1_missing_content1-untracked
894
934
895 ### revert for: content1_missing_content3-tracked
935 ### revert for: content1_missing_content3-tracked
896
936
897 ### revert for: content1_missing_content3-untracked
937 ### revert for: content1_missing_content3-untracked
898 file not managed: content1_missing_content3-untracked
938 file not managed: content1_missing_content3-untracked
899
939
900 ### revert for: content1_missing_missing-tracked
940 ### revert for: content1_missing_missing-tracked
901
941
902 ### revert for: content1_missing_missing-untracked
942 ### revert for: content1_missing_missing-untracked
903 content1_missing_missing-untracked: no such file in rev * (glob)
943 content1_missing_missing-untracked: no such file in rev * (glob)
904
944
905 ### revert for: missing_content2_content2-tracked
945 ### revert for: missing_content2_content2-tracked
906 no changes needed to missing_content2_content2-tracked
946 no changes needed to missing_content2_content2-tracked
907
947
908 ### revert for: missing_content2_content2-untracked
948 ### revert for: missing_content2_content2-untracked
909
949
910 ### revert for: missing_content2_content3-tracked
950 ### revert for: missing_content2_content3-tracked
911
951
912 ### revert for: missing_content2_content3-untracked
952 ### revert for: missing_content2_content3-untracked
913
953
914 ### revert for: missing_content2_missing-tracked
954 ### revert for: missing_content2_missing-tracked
915
955
916 ### revert for: missing_content2_missing-untracked
956 ### revert for: missing_content2_missing-untracked
917
957
918 ### revert for: missing_missing_content3-tracked
958 ### revert for: missing_missing_content3-tracked
919
959
920 ### revert for: missing_missing_content3-untracked
960 ### revert for: missing_missing_content3-untracked
921 file not managed: missing_missing_content3-untracked
961 file not managed: missing_missing_content3-untracked
922
962
923 ### revert for: missing_missing_missing-tracked
963 ### revert for: missing_missing_missing-tracked
924
964
925 ### revert for: missing_missing_missing-untracked
965 ### revert for: missing_missing_missing-untracked
926 missing_missing_missing-untracked: no such file in rev * (glob)
966 missing_missing_missing-untracked: no such file in rev * (glob)
927
967
928
968
929 check resulting directory against the --all run
969 check resulting directory against the --all run
930 (There should be no difference)
970 (There should be no difference)
931
971
932 $ python ../dircontent.py > ../content-parent-explicit.txt
972 $ python ../dircontent.py > ../content-parent-explicit.txt
933 $ cd ..
973 $ cd ..
934 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
974 $ diff -U 0 -- content-parent-all.txt content-parent-explicit.txt | grep _
935 [1]
975 [1]
936
976
937 Test revert to "base" content with explicit file name
977 Test revert to "base" content with explicit file name
938 -----------------------------------------------------
978 -----------------------------------------------------
939
979
940 (setup from reference repo)
980 (setup from reference repo)
941
981
942 $ cp -r revert-ref revert-base-explicit
982 $ cp -r revert-ref revert-base-explicit
943 $ cd revert-base-explicit
983 $ cd revert-base-explicit
944
984
945 revert all files individually and check the output
985 revert all files individually and check the output
946 (output is expected to be different than in the --all case)
986 (output is expected to be different than in the --all case)
947
987
948 $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do
988 $ for file in `python $TESTDIR/generate-working-copy-states.py filelist 2`; do
949 > echo '### revert for:' $file;
989 > echo '### revert for:' $file;
950 > hg revert $file --rev 'desc(base)';
990 > hg revert $file --rev 'desc(base)';
951 > echo
991 > echo
952 > done
992 > done
953 ### revert for: content1_content1_content1-tracked
993 ### revert for: content1_content1_content1-tracked
954 no changes needed to content1_content1_content1-tracked
994 no changes needed to content1_content1_content1-tracked
955
995
956 ### revert for: content1_content1_content1-untracked
996 ### revert for: content1_content1_content1-untracked
957
997
958 ### revert for: content1_content1_content3-tracked
998 ### revert for: content1_content1_content3-tracked
959
999
960 ### revert for: content1_content1_content3-untracked
1000 ### revert for: content1_content1_content3-untracked
961
1001
962 ### revert for: content1_content1_missing-tracked
1002 ### revert for: content1_content1_missing-tracked
963
1003
964 ### revert for: content1_content1_missing-untracked
1004 ### revert for: content1_content1_missing-untracked
965
1005
966 ### revert for: content1_content2_content1-tracked
1006 ### revert for: content1_content2_content1-tracked
967 no changes needed to content1_content2_content1-tracked
1007 no changes needed to content1_content2_content1-tracked
968
1008
969 ### revert for: content1_content2_content1-untracked
1009 ### revert for: content1_content2_content1-untracked
970
1010
971 ### revert for: content1_content2_content2-tracked
1011 ### revert for: content1_content2_content2-tracked
972
1012
973 ### revert for: content1_content2_content2-untracked
1013 ### revert for: content1_content2_content2-untracked
974
1014
975 ### revert for: content1_content2_content3-tracked
1015 ### revert for: content1_content2_content3-tracked
976
1016
977 ### revert for: content1_content2_content3-untracked
1017 ### revert for: content1_content2_content3-untracked
978
1018
979 ### revert for: content1_content2_missing-tracked
1019 ### revert for: content1_content2_missing-tracked
980
1020
981 ### revert for: content1_content2_missing-untracked
1021 ### revert for: content1_content2_missing-untracked
982
1022
983 ### revert for: content1_missing_content1-tracked
1023 ### revert for: content1_missing_content1-tracked
984 no changes needed to content1_missing_content1-tracked
1024 no changes needed to content1_missing_content1-tracked
985
1025
986 ### revert for: content1_missing_content1-untracked
1026 ### revert for: content1_missing_content1-untracked
987
1027
988 ### revert for: content1_missing_content3-tracked
1028 ### revert for: content1_missing_content3-tracked
989
1029
990 ### revert for: content1_missing_content3-untracked
1030 ### revert for: content1_missing_content3-untracked
991
1031
992 ### revert for: content1_missing_missing-tracked
1032 ### revert for: content1_missing_missing-tracked
993
1033
994 ### revert for: content1_missing_missing-untracked
1034 ### revert for: content1_missing_missing-untracked
995
1035
996 ### revert for: missing_content2_content2-tracked
1036 ### revert for: missing_content2_content2-tracked
997
1037
998 ### revert for: missing_content2_content2-untracked
1038 ### revert for: missing_content2_content2-untracked
999 no changes needed to missing_content2_content2-untracked
1039 no changes needed to missing_content2_content2-untracked
1000
1040
1001 ### revert for: missing_content2_content3-tracked
1041 ### revert for: missing_content2_content3-tracked
1002
1042
1003 ### revert for: missing_content2_content3-untracked
1043 ### revert for: missing_content2_content3-untracked
1004 no changes needed to missing_content2_content3-untracked
1044 no changes needed to missing_content2_content3-untracked
1005
1045
1006 ### revert for: missing_content2_missing-tracked
1046 ### revert for: missing_content2_missing-tracked
1007
1047
1008 ### revert for: missing_content2_missing-untracked
1048 ### revert for: missing_content2_missing-untracked
1009 no changes needed to missing_content2_missing-untracked
1049 no changes needed to missing_content2_missing-untracked
1010
1050
1011 ### revert for: missing_missing_content3-tracked
1051 ### revert for: missing_missing_content3-tracked
1012
1052
1013 ### revert for: missing_missing_content3-untracked
1053 ### revert for: missing_missing_content3-untracked
1014 file not managed: missing_missing_content3-untracked
1054 file not managed: missing_missing_content3-untracked
1015
1055
1016 ### revert for: missing_missing_missing-tracked
1056 ### revert for: missing_missing_missing-tracked
1017
1057
1018 ### revert for: missing_missing_missing-untracked
1058 ### revert for: missing_missing_missing-untracked
1019 missing_missing_missing-untracked: no such file in rev * (glob)
1059 missing_missing_missing-untracked: no such file in rev * (glob)
1020
1060
1021
1061
1022 check resulting directory against the --all run
1062 check resulting directory against the --all run
1023 (There should be no difference)
1063 (There should be no difference)
1024
1064
1025 $ python ../dircontent.py > ../content-base-explicit.txt
1065 $ python ../dircontent.py > ../content-base-explicit.txt
1026 $ cd ..
1066 $ cd ..
1027 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1067 $ diff -U 0 -- content-base-all.txt content-base-explicit.txt | grep _
1028 [1]
1068 [1]
@@ -1,1739 +1,1757 b''
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 add s/a
28 $ hg -R s add s/a
29 $ hg files -S
29 $ hg files -S
30 .hgsub
30 .hgsub
31 a
31 a
32 s/a (glob)
32 s/a (glob)
33
33
34 $ hg -R s ci -Ams0
34 $ hg -R s ci -Ams0
35 $ hg sum
35 $ hg sum
36 parent: 0:f7b1eb17ad24 tip
36 parent: 0:f7b1eb17ad24 tip
37 0
37 0
38 branch: default
38 branch: default
39 commit: 1 added, 1 subrepos
39 commit: 1 added, 1 subrepos
40 update: (current)
40 update: (current)
41 phases: 1 draft
41 phases: 1 draft
42 $ hg ci -m1
42 $ hg ci -m1
43
43
44 test handling .hgsubstate "added" explicitly.
44 test handling .hgsubstate "added" explicitly.
45
45
46 $ hg parents --template '{node}\n{files}\n'
46 $ hg parents --template '{node}\n{files}\n'
47 7cf8cfea66e410e8e3336508dfeec07b3192de51
47 7cf8cfea66e410e8e3336508dfeec07b3192de51
48 .hgsub .hgsubstate
48 .hgsub .hgsubstate
49 $ hg rollback -q
49 $ hg rollback -q
50 $ hg add .hgsubstate
50 $ hg add .hgsubstate
51 $ hg ci -m1
51 $ hg ci -m1
52 $ hg parents --template '{node}\n{files}\n'
52 $ hg parents --template '{node}\n{files}\n'
53 7cf8cfea66e410e8e3336508dfeec07b3192de51
53 7cf8cfea66e410e8e3336508dfeec07b3192de51
54 .hgsub .hgsubstate
54 .hgsub .hgsubstate
55
55
56 Revert subrepo and test subrepo fileset keyword:
56 Revert subrepo and test subrepo fileset keyword:
57
57
58 $ echo b > s/a
58 $ echo b > s/a
59 $ hg revert --dry-run "set:subrepo('glob:s*')"
59 $ hg revert --dry-run "set:subrepo('glob:s*')"
60 reverting subrepo s
60 reverting subrepo s
61 reverting s/a (glob)
61 reverting s/a (glob)
62 $ cat s/a
62 $ cat s/a
63 b
63 b
64 $ hg revert "set:subrepo('glob:s*')"
64 $ hg revert "set:subrepo('glob:s*')"
65 reverting subrepo s
65 reverting subrepo s
66 reverting s/a (glob)
66 reverting s/a (glob)
67 $ cat s/a
67 $ cat s/a
68 a
68 a
69 $ rm s/a.orig
69 $ rm s/a.orig
70
70
71 Revert subrepo with no backup. The "reverting s/a" line is gone since
71 Revert subrepo with no backup. The "reverting s/a" line is gone since
72 we're really running 'hg update' in the subrepo:
72 we're really running 'hg update' in the subrepo:
73
73
74 $ echo b > s/a
74 $ echo b > s/a
75 $ hg revert --no-backup s
75 $ hg revert --no-backup s
76 reverting subrepo s
76 reverting subrepo s
77
77
78 Issue2022: update -C
78 Issue2022: update -C
79
79
80 $ echo b > s/a
80 $ echo b > s/a
81 $ hg sum
81 $ hg sum
82 parent: 1:7cf8cfea66e4 tip
82 parent: 1:7cf8cfea66e4 tip
83 1
83 1
84 branch: default
84 branch: default
85 commit: 1 subrepos
85 commit: 1 subrepos
86 update: (current)
86 update: (current)
87 phases: 2 draft
87 phases: 2 draft
88 $ hg co -C 1
88 $ hg co -C 1
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 $ hg sum
90 $ hg sum
91 parent: 1:7cf8cfea66e4 tip
91 parent: 1:7cf8cfea66e4 tip
92 1
92 1
93 branch: default
93 branch: default
94 commit: (clean)
94 commit: (clean)
95 update: (current)
95 update: (current)
96 phases: 2 draft
96 phases: 2 draft
97
97
98 commands that require a clean repo should respect subrepos
98 commands that require a clean repo should respect subrepos
99
99
100 $ echo b >> s/a
100 $ echo b >> s/a
101 $ hg backout tip
101 $ hg backout tip
102 abort: uncommitted changes in subrepository 's'
102 abort: uncommitted changes in subrepository 's'
103 [255]
103 [255]
104 $ hg revert -C -R s s/a
104 $ hg revert -C -R s s/a
105
105
106 add sub sub
106 add sub sub
107
107
108 $ echo ss = ss > s/.hgsub
108 $ echo ss = ss > s/.hgsub
109 $ hg init s/ss
109 $ hg init s/ss
110 $ echo a > s/ss/a
110 $ echo a > s/ss/a
111 $ hg -R s add s/.hgsub
111 $ hg -R s add s/.hgsub
112 $ hg -R s/ss add s/ss/a
112 $ hg -R s/ss add s/ss/a
113 $ hg sum
113 $ hg sum
114 parent: 1:7cf8cfea66e4 tip
114 parent: 1:7cf8cfea66e4 tip
115 1
115 1
116 branch: default
116 branch: default
117 commit: 1 subrepos
117 commit: 1 subrepos
118 update: (current)
118 update: (current)
119 phases: 2 draft
119 phases: 2 draft
120 $ hg ci -m2
120 $ hg ci -m2
121 committing subrepository s
121 committing subrepository s
122 committing subrepository s/ss (glob)
122 committing subrepository s/ss (glob)
123 $ hg sum
123 $ hg sum
124 parent: 2:df30734270ae tip
124 parent: 2:df30734270ae tip
125 2
125 2
126 branch: default
126 branch: default
127 commit: (clean)
127 commit: (clean)
128 update: (current)
128 update: (current)
129 phases: 3 draft
129 phases: 3 draft
130
130
131 test handling .hgsubstate "modified" explicitly.
131 test handling .hgsubstate "modified" explicitly.
132
132
133 $ hg parents --template '{node}\n{files}\n'
133 $ hg parents --template '{node}\n{files}\n'
134 df30734270ae757feb35e643b7018e818e78a9aa
134 df30734270ae757feb35e643b7018e818e78a9aa
135 .hgsubstate
135 .hgsubstate
136 $ hg rollback -q
136 $ hg rollback -q
137 $ hg status -A .hgsubstate
137 $ hg status -A .hgsubstate
138 M .hgsubstate
138 M .hgsubstate
139 $ hg ci -m2
139 $ hg ci -m2
140 $ hg parents --template '{node}\n{files}\n'
140 $ hg parents --template '{node}\n{files}\n'
141 df30734270ae757feb35e643b7018e818e78a9aa
141 df30734270ae757feb35e643b7018e818e78a9aa
142 .hgsubstate
142 .hgsubstate
143
143
144 bump sub rev (and check it is ignored by ui.commitsubrepos)
144 bump sub rev (and check it is ignored by ui.commitsubrepos)
145
145
146 $ echo b > s/a
146 $ echo b > s/a
147 $ hg -R s ci -ms1
147 $ hg -R s ci -ms1
148 $ hg --config ui.commitsubrepos=no ci -m3
148 $ hg --config ui.commitsubrepos=no ci -m3
149
149
150 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
150 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
151
151
152 $ echo c > s/a
152 $ echo c > s/a
153 $ hg --config ui.commitsubrepos=no ci -m4
153 $ hg --config ui.commitsubrepos=no ci -m4
154 abort: uncommitted changes in subrepository 's'
154 abort: uncommitted changes in subrepository 's'
155 (use --subrepos for recursive commit)
155 (use --subrepos for recursive commit)
156 [255]
156 [255]
157 $ hg id
157 $ hg id
158 f6affe3fbfaa+ tip
158 f6affe3fbfaa+ tip
159 $ hg -R s ci -mc
159 $ hg -R s ci -mc
160 $ hg id
160 $ hg id
161 f6affe3fbfaa+ tip
161 f6affe3fbfaa+ tip
162 $ echo d > s/a
162 $ echo d > s/a
163 $ hg ci -m4
163 $ hg ci -m4
164 committing subrepository s
164 committing subrepository s
165 $ hg tip -R s
165 $ hg tip -R s
166 changeset: 4:02dcf1d70411
166 changeset: 4:02dcf1d70411
167 tag: tip
167 tag: tip
168 user: test
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: 4
170 summary: 4
171
171
172
172
173 check caching
173 check caching
174
174
175 $ hg co 0
175 $ hg co 0
176 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
176 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
177 $ hg debugsub
177 $ hg debugsub
178
178
179 restore
179 restore
180
180
181 $ hg co
181 $ hg co
182 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
182 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 $ hg debugsub
183 $ hg debugsub
184 path s
184 path s
185 source s
185 source s
186 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
186 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
187
187
188 new branch for merge tests
188 new branch for merge tests
189
189
190 $ hg co 1
190 $ hg co 1
191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 $ echo t = t >> .hgsub
192 $ echo t = t >> .hgsub
193 $ hg init t
193 $ hg init t
194 $ echo t > t/t
194 $ echo t > t/t
195 $ hg -R t add t
195 $ hg -R t add t
196 adding t/t (glob)
196 adding t/t (glob)
197
197
198 5
198 5
199
199
200 $ hg ci -m5 # add sub
200 $ hg ci -m5 # add sub
201 committing subrepository t
201 committing subrepository t
202 created new head
202 created new head
203 $ echo t2 > t/t
203 $ echo t2 > t/t
204
204
205 6
205 6
206
206
207 $ hg st -R s
207 $ hg st -R s
208 $ hg ci -m6 # change sub
208 $ hg ci -m6 # change sub
209 committing subrepository t
209 committing subrepository t
210 $ hg debugsub
210 $ hg debugsub
211 path s
211 path s
212 source s
212 source s
213 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
213 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
214 path t
214 path t
215 source t
215 source t
216 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
216 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
217 $ echo t3 > t/t
217 $ echo t3 > t/t
218
218
219 7
219 7
220
220
221 $ hg ci -m7 # change sub again for conflict test
221 $ hg ci -m7 # change sub again for conflict test
222 committing subrepository t
222 committing subrepository t
223 $ hg rm .hgsub
223 $ hg rm .hgsub
224
224
225 8
225 8
226
226
227 $ hg ci -m8 # remove sub
227 $ hg ci -m8 # remove sub
228
228
229 test handling .hgsubstate "removed" explicitly.
229 test handling .hgsubstate "removed" explicitly.
230
230
231 $ hg parents --template '{node}\n{files}\n'
231 $ hg parents --template '{node}\n{files}\n'
232 96615c1dad2dc8e3796d7332c77ce69156f7b78e
232 96615c1dad2dc8e3796d7332c77ce69156f7b78e
233 .hgsub .hgsubstate
233 .hgsub .hgsubstate
234 $ hg rollback -q
234 $ hg rollback -q
235 $ hg remove .hgsubstate
235 $ hg remove .hgsubstate
236 $ hg ci -m8
236 $ hg ci -m8
237 $ hg parents --template '{node}\n{files}\n'
237 $ hg parents --template '{node}\n{files}\n'
238 96615c1dad2dc8e3796d7332c77ce69156f7b78e
238 96615c1dad2dc8e3796d7332c77ce69156f7b78e
239 .hgsub .hgsubstate
239 .hgsub .hgsubstate
240
240
241 merge tests
241 merge tests
242
242
243 $ hg co -C 3
243 $ hg co -C 3
244 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
244 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 $ hg merge 5 # test adding
245 $ hg merge 5 # test adding
246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 (branch merge, don't forget to commit)
247 (branch merge, don't forget to commit)
248 $ hg debugsub
248 $ hg debugsub
249 path s
249 path s
250 source s
250 source s
251 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
251 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
252 path t
252 path t
253 source t
253 source t
254 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
254 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
255 $ hg ci -m9
255 $ hg ci -m9
256 created new head
256 created new head
257 $ hg merge 6 --debug # test change
257 $ hg merge 6 --debug # test change
258 searching for copies back to rev 2
258 searching for copies back to rev 2
259 resolving manifests
259 resolving manifests
260 branchmerge: True, force: False, partial: False
260 branchmerge: True, force: False, partial: False
261 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
261 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
262 .hgsubstate: versions differ -> m
262 .hgsubstate: versions differ -> m
263 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
263 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
264 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
264 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
265 getting subrepo t
265 getting subrepo t
266 resolving manifests
266 resolving manifests
267 branchmerge: False, force: False, partial: False
267 branchmerge: False, force: False, partial: False
268 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
268 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
269 t: remote is newer -> g
269 t: remote is newer -> g
270 getting t
270 getting t
271 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 (branch merge, don't forget to commit)
272 (branch merge, don't forget to commit)
273 $ hg debugsub
273 $ hg debugsub
274 path s
274 path s
275 source s
275 source s
276 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
276 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
277 path t
277 path t
278 source t
278 source t
279 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
279 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
280 $ echo conflict > t/t
280 $ echo conflict > t/t
281 $ hg ci -m10
281 $ hg ci -m10
282 committing subrepository t
282 committing subrepository t
283 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
283 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
284 searching for copies back to rev 2
284 searching for copies back to rev 2
285 resolving manifests
285 resolving manifests
286 branchmerge: True, force: False, partial: False
286 branchmerge: True, force: False, partial: False
287 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
287 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
288 .hgsubstate: versions differ -> m
288 .hgsubstate: versions differ -> m
289 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
289 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
290 subrepo t: both sides changed
290 subrepo t: both sides changed
291 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
291 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
292 (M)erge, keep (l)ocal or keep (r)emote? m
292 (M)erge, keep (l)ocal or keep (r)emote? m
293 merging subrepo t
293 merging subrepo t
294 searching for copies back to rev 2
294 searching for copies back to rev 2
295 resolving manifests
295 resolving manifests
296 branchmerge: True, force: False, partial: False
296 branchmerge: True, force: False, partial: False
297 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
297 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
298 preserving t for resolve of t
298 preserving t for resolve of t
299 t: versions differ -> m
299 t: versions differ -> m
300 picked tool 'internal:merge' for t (binary False symlink False)
300 picked tool 'internal:merge' for t (binary False symlink False)
301 merging t
301 merging t
302 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
302 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
303 warning: conflicts during merge.
303 warning: conflicts during merge.
304 merging t incomplete! (edit conflicts, then use 'hg resolve --mark')
304 merging t incomplete! (edit conflicts, then use 'hg resolve --mark')
305 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
305 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
306 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
306 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
307 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
307 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
308 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
308 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 (branch merge, don't forget to commit)
309 (branch merge, don't forget to commit)
310
310
311 should conflict
311 should conflict
312
312
313 $ cat t/t
313 $ cat t/t
314 <<<<<<< local: 20a0db6fbf6c - test: 10
314 <<<<<<< local: 20a0db6fbf6c - test: 10
315 conflict
315 conflict
316 =======
316 =======
317 t3
317 t3
318 >>>>>>> other: 7af322bc1198 - test: 7
318 >>>>>>> other: 7af322bc1198 - test: 7
319
319
320 11: remove subrepo t
320 11: remove subrepo t
321
321
322 $ hg co -C 5
322 $ hg co -C 5
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 $ hg revert -r 4 .hgsub # remove t
324 $ hg revert -r 4 .hgsub # remove t
325 $ hg ci -m11
325 $ hg ci -m11
326 created new head
326 created new head
327 $ hg debugsub
327 $ hg debugsub
328 path s
328 path s
329 source s
329 source s
330 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
330 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
331
331
332 local removed, remote changed, keep changed
332 local removed, remote changed, keep changed
333
333
334 $ hg merge 6
334 $ hg merge 6
335 remote changed subrepository t which local removed
335 remote changed subrepository t which local removed
336 use (c)hanged version or (d)elete? c
336 use (c)hanged version or (d)elete? c
337 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
337 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 (branch merge, don't forget to commit)
338 (branch merge, don't forget to commit)
339 BROKEN: should include subrepo t
339 BROKEN: should include subrepo t
340 $ hg debugsub
340 $ hg debugsub
341 path s
341 path s
342 source s
342 source s
343 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
343 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
344 $ cat .hgsubstate
344 $ cat .hgsubstate
345 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
345 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
346 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
346 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
347 $ hg ci -m 'local removed, remote changed, keep changed'
347 $ hg ci -m 'local removed, remote changed, keep changed'
348 BROKEN: should include subrepo t
348 BROKEN: should include subrepo t
349 $ hg debugsub
349 $ hg debugsub
350 path s
350 path s
351 source s
351 source s
352 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
352 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
353 BROKEN: should include subrepo t
353 BROKEN: should include subrepo t
354 $ cat .hgsubstate
354 $ cat .hgsubstate
355 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
355 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
356 $ cat t/t
356 $ cat t/t
357 t2
357 t2
358
358
359 local removed, remote changed, keep removed
359 local removed, remote changed, keep removed
360
360
361 $ hg co -C 11
361 $ hg co -C 11
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 $ hg merge --config ui.interactive=true 6 <<EOF
363 $ hg merge --config ui.interactive=true 6 <<EOF
364 > d
364 > d
365 > EOF
365 > EOF
366 remote changed subrepository t which local removed
366 remote changed subrepository t which local removed
367 use (c)hanged version or (d)elete? d
367 use (c)hanged version or (d)elete? d
368 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
368 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
369 (branch merge, don't forget to commit)
369 (branch merge, don't forget to commit)
370 $ hg debugsub
370 $ hg debugsub
371 path s
371 path s
372 source s
372 source s
373 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
373 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
374 $ cat .hgsubstate
374 $ cat .hgsubstate
375 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
375 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
376 $ hg ci -m 'local removed, remote changed, keep removed'
376 $ hg ci -m 'local removed, remote changed, keep removed'
377 created new head
377 created new head
378 $ hg debugsub
378 $ hg debugsub
379 path s
379 path s
380 source s
380 source s
381 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
381 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
382 $ cat .hgsubstate
382 $ cat .hgsubstate
383 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
383 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
384
384
385 local changed, remote removed, keep changed
385 local changed, remote removed, keep changed
386
386
387 $ hg co -C 6
387 $ hg co -C 6
388 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
388 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 $ hg merge 11
389 $ hg merge 11
390 local changed subrepository t which remote removed
390 local changed subrepository t which remote removed
391 use (c)hanged version or (d)elete? c
391 use (c)hanged version or (d)elete? c
392 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
392 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
393 (branch merge, don't forget to commit)
393 (branch merge, don't forget to commit)
394 BROKEN: should include subrepo t
394 BROKEN: should include subrepo t
395 $ hg debugsub
395 $ hg debugsub
396 path s
396 path s
397 source s
397 source s
398 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
398 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
399 BROKEN: should include subrepo t
399 BROKEN: should include subrepo t
400 $ cat .hgsubstate
400 $ cat .hgsubstate
401 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
401 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
402 $ hg ci -m 'local changed, remote removed, keep changed'
402 $ hg ci -m 'local changed, remote removed, keep changed'
403 created new head
403 created new head
404 BROKEN: should include subrepo t
404 BROKEN: should include subrepo t
405 $ hg debugsub
405 $ hg debugsub
406 path s
406 path s
407 source s
407 source s
408 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
408 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
409 BROKEN: should include subrepo t
409 BROKEN: should include subrepo t
410 $ cat .hgsubstate
410 $ cat .hgsubstate
411 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
411 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
412 $ cat t/t
412 $ cat t/t
413 t2
413 t2
414
414
415 local changed, remote removed, keep removed
415 local changed, remote removed, keep removed
416
416
417 $ hg co -C 6
417 $ hg co -C 6
418 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
418 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
419 $ hg merge --config ui.interactive=true 11 <<EOF
419 $ hg merge --config ui.interactive=true 11 <<EOF
420 > d
420 > d
421 > EOF
421 > EOF
422 local changed subrepository t which remote removed
422 local changed subrepository t which remote removed
423 use (c)hanged version or (d)elete? d
423 use (c)hanged version or (d)elete? d
424 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
424 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 (branch merge, don't forget to commit)
425 (branch merge, don't forget to commit)
426 $ hg debugsub
426 $ hg debugsub
427 path s
427 path s
428 source s
428 source s
429 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
429 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
430 $ cat .hgsubstate
430 $ cat .hgsubstate
431 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
431 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
432 $ hg ci -m 'local changed, remote removed, keep removed'
432 $ hg ci -m 'local changed, remote removed, keep removed'
433 created new head
433 created new head
434 $ hg debugsub
434 $ hg debugsub
435 path s
435 path s
436 source s
436 source s
437 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
437 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
438 $ cat .hgsubstate
438 $ cat .hgsubstate
439 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
439 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
440
440
441 clean up to avoid having to fix up the tests below
441 clean up to avoid having to fix up the tests below
442
442
443 $ hg co -C 10
443 $ hg co -C 10
444 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
444 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 $ cat >> $HGRCPATH <<EOF
445 $ cat >> $HGRCPATH <<EOF
446 > [extensions]
446 > [extensions]
447 > strip=
447 > strip=
448 > EOF
448 > EOF
449 $ hg strip -r 11:15
449 $ hg strip -r 11:15
450 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
450 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
451
451
452 clone
452 clone
453
453
454 $ cd ..
454 $ cd ..
455 $ hg clone t tc
455 $ hg clone t tc
456 updating to branch default
456 updating to branch default
457 cloning subrepo s from $TESTTMP/t/s
457 cloning subrepo s from $TESTTMP/t/s
458 cloning subrepo s/ss from $TESTTMP/t/s/ss (glob)
458 cloning subrepo s/ss from $TESTTMP/t/s/ss (glob)
459 cloning subrepo t from $TESTTMP/t/t
459 cloning subrepo t from $TESTTMP/t/t
460 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
461 $ cd tc
461 $ cd tc
462 $ hg debugsub
462 $ hg debugsub
463 path s
463 path s
464 source s
464 source s
465 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
465 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
466 path t
466 path t
467 source t
467 source t
468 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
468 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
469
469
470 push
470 push
471
471
472 $ echo bah > t/t
472 $ echo bah > t/t
473 $ hg ci -m11
473 $ hg ci -m11
474 committing subrepository t
474 committing subrepository t
475 $ hg push
475 $ hg push
476 pushing to $TESTTMP/t (glob)
476 pushing to $TESTTMP/t (glob)
477 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
477 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
478 no changes made to subrepo s since last push to $TESTTMP/t/s
478 no changes made to subrepo s since last push to $TESTTMP/t/s
479 pushing subrepo t to $TESTTMP/t/t
479 pushing subrepo t to $TESTTMP/t/t
480 searching for changes
480 searching for changes
481 adding changesets
481 adding changesets
482 adding manifests
482 adding manifests
483 adding file changes
483 adding file changes
484 added 1 changesets with 1 changes to 1 files
484 added 1 changesets with 1 changes to 1 files
485 searching for changes
485 searching for changes
486 adding changesets
486 adding changesets
487 adding manifests
487 adding manifests
488 adding file changes
488 adding file changes
489 added 1 changesets with 1 changes to 1 files
489 added 1 changesets with 1 changes to 1 files
490
490
491 push -f
491 push -f
492
492
493 $ echo bah > s/a
493 $ echo bah > s/a
494 $ hg ci -m12
494 $ hg ci -m12
495 committing subrepository s
495 committing subrepository s
496 $ hg push
496 $ hg push
497 pushing to $TESTTMP/t (glob)
497 pushing to $TESTTMP/t (glob)
498 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
498 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
499 pushing subrepo s to $TESTTMP/t/s
499 pushing subrepo s to $TESTTMP/t/s
500 searching for changes
500 searching for changes
501 abort: push creates new remote head 12a213df6fa9! (in subrepo s)
501 abort: push creates new remote head 12a213df6fa9! (in subrepo s)
502 (merge or see "hg help push" for details about pushing new heads)
502 (merge or see "hg help push" for details about pushing new heads)
503 [255]
503 [255]
504 $ hg push -f
504 $ hg push -f
505 pushing to $TESTTMP/t (glob)
505 pushing to $TESTTMP/t (glob)
506 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
506 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
507 searching for changes
507 searching for changes
508 no changes found
508 no changes found
509 pushing subrepo s to $TESTTMP/t/s
509 pushing subrepo s to $TESTTMP/t/s
510 searching for changes
510 searching for changes
511 adding changesets
511 adding changesets
512 adding manifests
512 adding manifests
513 adding file changes
513 adding file changes
514 added 1 changesets with 1 changes to 1 files (+1 heads)
514 added 1 changesets with 1 changes to 1 files (+1 heads)
515 pushing subrepo t to $TESTTMP/t/t
515 pushing subrepo t to $TESTTMP/t/t
516 searching for changes
516 searching for changes
517 no changes found
517 no changes found
518 searching for changes
518 searching for changes
519 adding changesets
519 adding changesets
520 adding manifests
520 adding manifests
521 adding file changes
521 adding file changes
522 added 1 changesets with 1 changes to 1 files
522 added 1 changesets with 1 changes to 1 files
523
523
524 check that unmodified subrepos are not pushed
524 check that unmodified subrepos are not pushed
525
525
526 $ hg clone . ../tcc
526 $ hg clone . ../tcc
527 updating to branch default
527 updating to branch default
528 cloning subrepo s from $TESTTMP/tc/s
528 cloning subrepo s from $TESTTMP/tc/s
529 cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob)
529 cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob)
530 cloning subrepo t from $TESTTMP/tc/t
530 cloning subrepo t from $TESTTMP/tc/t
531 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
531 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
532
532
533 the subrepos on the new clone have nothing to push to its source
533 the subrepos on the new clone have nothing to push to its source
534
534
535 $ hg push -R ../tcc .
535 $ hg push -R ../tcc .
536 pushing to .
536 pushing to .
537 no changes made to subrepo s/ss since last push to s/ss (glob)
537 no changes made to subrepo s/ss since last push to s/ss (glob)
538 no changes made to subrepo s since last push to s
538 no changes made to subrepo s since last push to s
539 no changes made to subrepo t since last push to t
539 no changes made to subrepo t since last push to t
540 searching for changes
540 searching for changes
541 no changes found
541 no changes found
542 [1]
542 [1]
543
543
544 the subrepos on the source do not have a clean store versus the clone target
544 the subrepos on the source do not have a clean store versus the clone target
545 because they were never explicitly pushed to the source
545 because they were never explicitly pushed to the source
546
546
547 $ hg push ../tcc
547 $ hg push ../tcc
548 pushing to ../tcc
548 pushing to ../tcc
549 pushing subrepo s/ss to ../tcc/s/ss (glob)
549 pushing subrepo s/ss to ../tcc/s/ss (glob)
550 searching for changes
550 searching for changes
551 no changes found
551 no changes found
552 pushing subrepo s to ../tcc/s
552 pushing subrepo s to ../tcc/s
553 searching for changes
553 searching for changes
554 no changes found
554 no changes found
555 pushing subrepo t to ../tcc/t
555 pushing subrepo t to ../tcc/t
556 searching for changes
556 searching for changes
557 no changes found
557 no changes found
558 searching for changes
558 searching for changes
559 no changes found
559 no changes found
560 [1]
560 [1]
561
561
562 after push their stores become clean
562 after push their stores become clean
563
563
564 $ hg push ../tcc
564 $ hg push ../tcc
565 pushing to ../tcc
565 pushing to ../tcc
566 no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob)
566 no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob)
567 no changes made to subrepo s since last push to ../tcc/s
567 no changes made to subrepo s since last push to ../tcc/s
568 no changes made to subrepo t since last push to ../tcc/t
568 no changes made to subrepo t since last push to ../tcc/t
569 searching for changes
569 searching for changes
570 no changes found
570 no changes found
571 [1]
571 [1]
572
572
573 updating a subrepo to a different revision or changing
573 updating a subrepo to a different revision or changing
574 its working directory does not make its store dirty
574 its working directory does not make its store dirty
575
575
576 $ hg -R s update '.^'
576 $ hg -R s update '.^'
577 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
577 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
578 $ hg push
578 $ hg push
579 pushing to $TESTTMP/t (glob)
579 pushing to $TESTTMP/t (glob)
580 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
580 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
581 no changes made to subrepo s since last push to $TESTTMP/t/s
581 no changes made to subrepo s since last push to $TESTTMP/t/s
582 no changes made to subrepo t since last push to $TESTTMP/t/t
582 no changes made to subrepo t since last push to $TESTTMP/t/t
583 searching for changes
583 searching for changes
584 no changes found
584 no changes found
585 [1]
585 [1]
586 $ echo foo >> s/a
586 $ echo foo >> s/a
587 $ hg push
587 $ hg push
588 pushing to $TESTTMP/t (glob)
588 pushing to $TESTTMP/t (glob)
589 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
589 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
590 no changes made to subrepo s since last push to $TESTTMP/t/s
590 no changes made to subrepo s since last push to $TESTTMP/t/s
591 no changes made to subrepo t since last push to $TESTTMP/t/t
591 no changes made to subrepo t since last push to $TESTTMP/t/t
592 searching for changes
592 searching for changes
593 no changes found
593 no changes found
594 [1]
594 [1]
595 $ hg -R s update -C tip
595 $ hg -R s update -C tip
596 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
596 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
597
597
598 committing into a subrepo makes its store (but not its parent's store) dirty
598 committing into a subrepo makes its store (but not its parent's store) dirty
599
599
600 $ echo foo >> s/ss/a
600 $ echo foo >> s/ss/a
601 $ hg -R s/ss commit -m 'test dirty store detection'
601 $ hg -R s/ss commit -m 'test dirty store detection'
602
602
603 $ hg out -S -r `hg log -r tip -T "{node|short}"`
603 $ hg out -S -r `hg log -r tip -T "{node|short}"`
604 comparing with $TESTTMP/t (glob)
604 comparing with $TESTTMP/t (glob)
605 searching for changes
605 searching for changes
606 no changes found
606 no changes found
607 comparing with $TESTTMP/t/s
607 comparing with $TESTTMP/t/s
608 searching for changes
608 searching for changes
609 no changes found
609 no changes found
610 comparing with $TESTTMP/t/s/ss
610 comparing with $TESTTMP/t/s/ss
611 searching for changes
611 searching for changes
612 changeset: 1:79ea5566a333
612 changeset: 1:79ea5566a333
613 tag: tip
613 tag: tip
614 user: test
614 user: test
615 date: Thu Jan 01 00:00:00 1970 +0000
615 date: Thu Jan 01 00:00:00 1970 +0000
616 summary: test dirty store detection
616 summary: test dirty store detection
617
617
618 comparing with $TESTTMP/t/t
618 comparing with $TESTTMP/t/t
619 searching for changes
619 searching for changes
620 no changes found
620 no changes found
621
621
622 $ hg push
622 $ hg push
623 pushing to $TESTTMP/t (glob)
623 pushing to $TESTTMP/t (glob)
624 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
624 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
625 searching for changes
625 searching for changes
626 adding changesets
626 adding changesets
627 adding manifests
627 adding manifests
628 adding file changes
628 adding file changes
629 added 1 changesets with 1 changes to 1 files
629 added 1 changesets with 1 changes to 1 files
630 no changes made to subrepo s since last push to $TESTTMP/t/s
630 no changes made to subrepo s since last push to $TESTTMP/t/s
631 no changes made to subrepo t since last push to $TESTTMP/t/t
631 no changes made to subrepo t since last push to $TESTTMP/t/t
632 searching for changes
632 searching for changes
633 no changes found
633 no changes found
634 [1]
634 [1]
635
635
636 a subrepo store may be clean versus one repo but not versus another
636 a subrepo store may be clean versus one repo but not versus another
637
637
638 $ hg push
638 $ hg push
639 pushing to $TESTTMP/t (glob)
639 pushing to $TESTTMP/t (glob)
640 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
640 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
641 no changes made to subrepo s since last push to $TESTTMP/t/s
641 no changes made to subrepo s since last push to $TESTTMP/t/s
642 no changes made to subrepo t since last push to $TESTTMP/t/t
642 no changes made to subrepo t since last push to $TESTTMP/t/t
643 searching for changes
643 searching for changes
644 no changes found
644 no changes found
645 [1]
645 [1]
646 $ hg push ../tcc
646 $ hg push ../tcc
647 pushing to ../tcc
647 pushing to ../tcc
648 pushing subrepo s/ss to ../tcc/s/ss (glob)
648 pushing subrepo s/ss to ../tcc/s/ss (glob)
649 searching for changes
649 searching for changes
650 adding changesets
650 adding changesets
651 adding manifests
651 adding manifests
652 adding file changes
652 adding file changes
653 added 1 changesets with 1 changes to 1 files
653 added 1 changesets with 1 changes to 1 files
654 no changes made to subrepo s since last push to ../tcc/s
654 no changes made to subrepo s since last push to ../tcc/s
655 no changes made to subrepo t since last push to ../tcc/t
655 no changes made to subrepo t since last push to ../tcc/t
656 searching for changes
656 searching for changes
657 no changes found
657 no changes found
658 [1]
658 [1]
659
659
660 update
660 update
661
661
662 $ cd ../t
662 $ cd ../t
663 $ hg up -C # discard our earlier merge
663 $ hg up -C # discard our earlier merge
664 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
664 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 $ echo blah > t/t
665 $ echo blah > t/t
666 $ hg ci -m13
666 $ hg ci -m13
667 committing subrepository t
667 committing subrepository t
668
668
669 backout calls revert internally with minimal opts, which should not raise
669 backout calls revert internally with minimal opts, which should not raise
670 KeyError
670 KeyError
671
671
672 $ hg backout ".^"
672 $ hg backout ".^"
673 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
673 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
674 changeset c373c8102e68 backed out, don't forget to commit.
674 changeset c373c8102e68 backed out, don't forget to commit.
675
675
676 $ hg up -C # discard changes
676 $ hg up -C # discard changes
677 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
677 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
678
678
679 pull
679 pull
680
680
681 $ cd ../tc
681 $ cd ../tc
682 $ hg pull
682 $ hg pull
683 pulling from $TESTTMP/t (glob)
683 pulling from $TESTTMP/t (glob)
684 searching for changes
684 searching for changes
685 adding changesets
685 adding changesets
686 adding manifests
686 adding manifests
687 adding file changes
687 adding file changes
688 added 1 changesets with 1 changes to 1 files
688 added 1 changesets with 1 changes to 1 files
689 (run 'hg update' to get a working copy)
689 (run 'hg update' to get a working copy)
690
690
691 should pull t
691 should pull t
692
692
693 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
693 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
694 comparing with $TESTTMP/t (glob)
694 comparing with $TESTTMP/t (glob)
695 no changes found
695 no changes found
696 comparing with $TESTTMP/t/s
696 comparing with $TESTTMP/t/s
697 searching for changes
697 searching for changes
698 no changes found
698 no changes found
699 comparing with $TESTTMP/t/s/ss
699 comparing with $TESTTMP/t/s/ss
700 searching for changes
700 searching for changes
701 no changes found
701 no changes found
702 comparing with $TESTTMP/t/t
702 comparing with $TESTTMP/t/t
703 searching for changes
703 searching for changes
704 changeset: 5:52c0adc0515a
704 changeset: 5:52c0adc0515a
705 tag: tip
705 tag: tip
706 user: test
706 user: test
707 date: Thu Jan 01 00:00:00 1970 +0000
707 date: Thu Jan 01 00:00:00 1970 +0000
708 summary: 13
708 summary: 13
709
709
710
710
711 $ hg up
711 $ hg up
712 pulling subrepo t from $TESTTMP/t/t
712 pulling subrepo t from $TESTTMP/t/t
713 searching for changes
713 searching for changes
714 adding changesets
714 adding changesets
715 adding manifests
715 adding manifests
716 adding file changes
716 adding file changes
717 added 1 changesets with 1 changes to 1 files
717 added 1 changesets with 1 changes to 1 files
718 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
718 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
719 $ cat t/t
719 $ cat t/t
720 blah
720 blah
721
721
722 bogus subrepo path aborts
722 bogus subrepo path aborts
723
723
724 $ echo 'bogus=[boguspath' >> .hgsub
724 $ echo 'bogus=[boguspath' >> .hgsub
725 $ hg ci -m 'bogus subrepo path'
725 $ hg ci -m 'bogus subrepo path'
726 abort: missing ] in subrepo source
726 abort: missing ] in subrepo source
727 [255]
727 [255]
728
728
729 Issue1986: merge aborts when trying to merge a subrepo that
729 Issue1986: merge aborts when trying to merge a subrepo that
730 shouldn't need merging
730 shouldn't need merging
731
731
732 # subrepo layout
732 # subrepo layout
733 #
733 #
734 # o 5 br
734 # o 5 br
735 # /|
735 # /|
736 # o | 4 default
736 # o | 4 default
737 # | |
737 # | |
738 # | o 3 br
738 # | o 3 br
739 # |/|
739 # |/|
740 # o | 2 default
740 # o | 2 default
741 # | |
741 # | |
742 # | o 1 br
742 # | o 1 br
743 # |/
743 # |/
744 # o 0 default
744 # o 0 default
745
745
746 $ cd ..
746 $ cd ..
747 $ rm -rf sub
747 $ rm -rf sub
748 $ hg init main
748 $ hg init main
749 $ cd main
749 $ cd main
750 $ hg init s
750 $ hg init s
751 $ cd s
751 $ cd s
752 $ echo a > a
752 $ echo a > a
753 $ hg ci -Am1
753 $ hg ci -Am1
754 adding a
754 adding a
755 $ hg branch br
755 $ hg branch br
756 marked working directory as branch br
756 marked working directory as branch br
757 (branches are permanent and global, did you want a bookmark?)
757 (branches are permanent and global, did you want a bookmark?)
758 $ echo a >> a
758 $ echo a >> a
759 $ hg ci -m1
759 $ hg ci -m1
760 $ hg up default
760 $ hg up default
761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
762 $ echo b > b
762 $ echo b > b
763 $ hg ci -Am1
763 $ hg ci -Am1
764 adding b
764 adding b
765 $ hg up br
765 $ hg up br
766 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
766 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
767 $ hg merge tip
767 $ hg merge tip
768 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
768 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 (branch merge, don't forget to commit)
769 (branch merge, don't forget to commit)
770 $ hg ci -m1
770 $ hg ci -m1
771 $ hg up 2
771 $ hg up 2
772 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
772 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
773 $ echo c > c
773 $ echo c > c
774 $ hg ci -Am1
774 $ hg ci -Am1
775 adding c
775 adding c
776 $ hg up 3
776 $ hg up 3
777 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
777 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
778 $ hg merge 4
778 $ hg merge 4
779 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
780 (branch merge, don't forget to commit)
780 (branch merge, don't forget to commit)
781 $ hg ci -m1
781 $ hg ci -m1
782
782
783 # main repo layout:
783 # main repo layout:
784 #
784 #
785 # * <-- try to merge default into br again
785 # * <-- try to merge default into br again
786 # .`|
786 # .`|
787 # . o 5 br --> substate = 5
787 # . o 5 br --> substate = 5
788 # . |
788 # . |
789 # o | 4 default --> substate = 4
789 # o | 4 default --> substate = 4
790 # | |
790 # | |
791 # | o 3 br --> substate = 2
791 # | o 3 br --> substate = 2
792 # |/|
792 # |/|
793 # o | 2 default --> substate = 2
793 # o | 2 default --> substate = 2
794 # | |
794 # | |
795 # | o 1 br --> substate = 3
795 # | o 1 br --> substate = 3
796 # |/
796 # |/
797 # o 0 default --> substate = 2
797 # o 0 default --> substate = 2
798
798
799 $ cd ..
799 $ cd ..
800 $ echo 's = s' > .hgsub
800 $ echo 's = s' > .hgsub
801 $ hg -R s up 2
801 $ hg -R s up 2
802 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
802 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
803 $ hg ci -Am1
803 $ hg ci -Am1
804 adding .hgsub
804 adding .hgsub
805 $ hg branch br
805 $ hg branch br
806 marked working directory as branch br
806 marked working directory as branch br
807 (branches are permanent and global, did you want a bookmark?)
807 (branches are permanent and global, did you want a bookmark?)
808 $ echo b > b
808 $ echo b > b
809 $ hg -R s up 3
809 $ hg -R s up 3
810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 $ hg ci -Am1
811 $ hg ci -Am1
812 adding b
812 adding b
813 $ hg up default
813 $ hg up default
814 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
814 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
815 $ echo c > c
815 $ echo c > c
816 $ hg ci -Am1
816 $ hg ci -Am1
817 adding c
817 adding c
818 $ hg up 1
818 $ hg up 1
819 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
819 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
820 $ hg merge 2
820 $ hg merge 2
821 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
821 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
822 (branch merge, don't forget to commit)
822 (branch merge, don't forget to commit)
823 $ hg ci -m1
823 $ hg ci -m1
824 $ hg up 2
824 $ hg up 2
825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
826 $ hg -R s up 4
826 $ hg -R s up 4
827 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
827 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
828 $ echo d > d
828 $ echo d > d
829 $ hg ci -Am1
829 $ hg ci -Am1
830 adding d
830 adding d
831 $ hg up 3
831 $ hg up 3
832 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
832 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
833 $ hg -R s up 5
833 $ hg -R s up 5
834 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
834 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
835 $ echo e > e
835 $ echo e > e
836 $ hg ci -Am1
836 $ hg ci -Am1
837 adding e
837 adding e
838
838
839 $ hg up 5
839 $ hg up 5
840 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
840 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
841 $ hg merge 4 # try to merge default into br again
841 $ hg merge 4 # try to merge default into br again
842 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
842 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
843 (M)erge, keep (l)ocal or keep (r)emote? m
843 (M)erge, keep (l)ocal or keep (r)emote? m
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 (branch merge, don't forget to commit)
845 (branch merge, don't forget to commit)
846 $ cd ..
846 $ cd ..
847
847
848 test subrepo delete from .hgsubstate
848 test subrepo delete from .hgsubstate
849
849
850 $ hg init testdelete
850 $ hg init testdelete
851 $ mkdir testdelete/nested testdelete/nested2
851 $ mkdir testdelete/nested testdelete/nested2
852 $ hg init testdelete/nested
852 $ hg init testdelete/nested
853 $ hg init testdelete/nested2
853 $ hg init testdelete/nested2
854 $ echo test > testdelete/nested/foo
854 $ echo test > testdelete/nested/foo
855 $ echo test > testdelete/nested2/foo
855 $ echo test > testdelete/nested2/foo
856 $ hg -R testdelete/nested add
856 $ hg -R testdelete/nested add
857 adding testdelete/nested/foo (glob)
857 adding testdelete/nested/foo (glob)
858 $ hg -R testdelete/nested2 add
858 $ hg -R testdelete/nested2 add
859 adding testdelete/nested2/foo (glob)
859 adding testdelete/nested2/foo (glob)
860 $ hg -R testdelete/nested ci -m test
860 $ hg -R testdelete/nested ci -m test
861 $ hg -R testdelete/nested2 ci -m test
861 $ hg -R testdelete/nested2 ci -m test
862 $ echo nested = nested > testdelete/.hgsub
862 $ echo nested = nested > testdelete/.hgsub
863 $ echo nested2 = nested2 >> testdelete/.hgsub
863 $ echo nested2 = nested2 >> testdelete/.hgsub
864 $ hg -R testdelete add
864 $ hg -R testdelete add
865 adding testdelete/.hgsub (glob)
865 adding testdelete/.hgsub (glob)
866 $ hg -R testdelete ci -m "nested 1 & 2 added"
866 $ hg -R testdelete ci -m "nested 1 & 2 added"
867 $ echo nested = nested > testdelete/.hgsub
867 $ echo nested = nested > testdelete/.hgsub
868 $ hg -R testdelete ci -m "nested 2 deleted"
868 $ hg -R testdelete ci -m "nested 2 deleted"
869 $ cat testdelete/.hgsubstate
869 $ cat testdelete/.hgsubstate
870 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
870 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
871 $ hg -R testdelete remove testdelete/.hgsub
871 $ hg -R testdelete remove testdelete/.hgsub
872 $ hg -R testdelete ci -m ".hgsub deleted"
872 $ hg -R testdelete ci -m ".hgsub deleted"
873 $ cat testdelete/.hgsubstate
873 $ cat testdelete/.hgsubstate
874 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
874 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
875
875
876 test repository cloning
876 test repository cloning
877
877
878 $ mkdir mercurial mercurial2
878 $ mkdir mercurial mercurial2
879 $ hg init nested_absolute
879 $ hg init nested_absolute
880 $ echo test > nested_absolute/foo
880 $ echo test > nested_absolute/foo
881 $ hg -R nested_absolute add
881 $ hg -R nested_absolute add
882 adding nested_absolute/foo (glob)
882 adding nested_absolute/foo (glob)
883 $ hg -R nested_absolute ci -mtest
883 $ hg -R nested_absolute ci -mtest
884 $ cd mercurial
884 $ cd mercurial
885 $ hg init nested_relative
885 $ hg init nested_relative
886 $ echo test2 > nested_relative/foo2
886 $ echo test2 > nested_relative/foo2
887 $ hg -R nested_relative add
887 $ hg -R nested_relative add
888 adding nested_relative/foo2 (glob)
888 adding nested_relative/foo2 (glob)
889 $ hg -R nested_relative ci -mtest2
889 $ hg -R nested_relative ci -mtest2
890 $ hg init main
890 $ hg init main
891 $ echo "nested_relative = ../nested_relative" > main/.hgsub
891 $ echo "nested_relative = ../nested_relative" > main/.hgsub
892 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
892 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
893 $ hg -R main add
893 $ hg -R main add
894 adding main/.hgsub (glob)
894 adding main/.hgsub (glob)
895 $ hg -R main ci -m "add subrepos"
895 $ hg -R main ci -m "add subrepos"
896 $ cd ..
896 $ cd ..
897 $ hg clone mercurial/main mercurial2/main
897 $ hg clone mercurial/main mercurial2/main
898 updating to branch default
898 updating to branch default
899 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
899 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
900 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
900 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
901 > mercurial2/main/nested_relative/.hg/hgrc
901 > mercurial2/main/nested_relative/.hg/hgrc
902 [paths]
902 [paths]
903 default = $TESTTMP/mercurial/nested_absolute
903 default = $TESTTMP/mercurial/nested_absolute
904 [paths]
904 [paths]
905 default = $TESTTMP/mercurial/nested_relative
905 default = $TESTTMP/mercurial/nested_relative
906 $ rm -rf mercurial mercurial2
906 $ rm -rf mercurial mercurial2
907
907
908 Issue1977: multirepo push should fail if subrepo push fails
908 Issue1977: multirepo push should fail if subrepo push fails
909
909
910 $ hg init repo
910 $ hg init repo
911 $ hg init repo/s
911 $ hg init repo/s
912 $ echo a > repo/s/a
912 $ echo a > repo/s/a
913 $ hg -R repo/s ci -Am0
913 $ hg -R repo/s ci -Am0
914 adding a
914 adding a
915 $ echo s = s > repo/.hgsub
915 $ echo s = s > repo/.hgsub
916 $ hg -R repo ci -Am1
916 $ hg -R repo ci -Am1
917 adding .hgsub
917 adding .hgsub
918 $ hg clone repo repo2
918 $ hg clone repo repo2
919 updating to branch default
919 updating to branch default
920 cloning subrepo s from $TESTTMP/repo/s
920 cloning subrepo s from $TESTTMP/repo/s
921 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
921 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
922 $ hg -q -R repo2 pull -u
922 $ hg -q -R repo2 pull -u
923 $ echo 1 > repo2/s/a
923 $ echo 1 > repo2/s/a
924 $ hg -R repo2/s ci -m2
924 $ hg -R repo2/s ci -m2
925 $ hg -q -R repo2/s push
925 $ hg -q -R repo2/s push
926 $ hg -R repo2/s up -C 0
926 $ hg -R repo2/s up -C 0
927 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
927 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
928 $ echo 2 > repo2/s/b
928 $ echo 2 > repo2/s/b
929 $ hg -R repo2/s ci -m3 -A
929 $ hg -R repo2/s ci -m3 -A
930 adding b
930 adding b
931 created new head
931 created new head
932 $ hg -R repo2 ci -m3
932 $ hg -R repo2 ci -m3
933 $ hg -q -R repo2 push
933 $ hg -q -R repo2 push
934 abort: push creates new remote head cc505f09a8b2! (in subrepo s)
934 abort: push creates new remote head cc505f09a8b2! (in subrepo s)
935 (merge or see "hg help push" for details about pushing new heads)
935 (merge or see "hg help push" for details about pushing new heads)
936 [255]
936 [255]
937 $ hg -R repo update
937 $ hg -R repo update
938 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
938 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
939
939
940 test if untracked file is not overwritten
940 test if untracked file is not overwritten
941
941
942 (this also tests that updated .hgsubstate is treated as "modified",
943 when 'merge.update()' is aborted before 'merge.recordupdates()', even
944 if none of mode, size and timestamp of it isn't changed on the
945 filesystem (see also issue4583))
946
942 $ echo issue3276_ok > repo/s/b
947 $ echo issue3276_ok > repo/s/b
943 $ hg -R repo2 push -f -q
948 $ hg -R repo2 push -f -q
944 $ touch -t 200001010000 repo/.hgsubstate
949 $ touch -t 200001010000 repo/.hgsubstate
945 $ hg -R repo status --config debug.dirstate.delaywrite=2 repo/.hgsubstate
950
951 $ cat >> repo/.hg/hgrc <<EOF
952 > [fakedirstatewritetime]
953 > # emulate invoking dirstate.write() via repo.status()
954 > # at 2000-01-01 00:00
955 > fakenow = 200001010000
956 >
957 > [extensions]
958 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
959 > EOF
946 $ hg -R repo update
960 $ hg -R repo update
947 b: untracked file differs
961 b: untracked file differs
948 abort: untracked files in working directory differ from files in requested revision (in subrepo s)
962 abort: untracked files in working directory differ from files in requested revision (in subrepo s)
949 [255]
963 [255]
964 $ cat >> repo/.hg/hgrc <<EOF
965 > [extensions]
966 > fakedirstatewritetime = !
967 > EOF
950
968
951 $ cat repo/s/b
969 $ cat repo/s/b
952 issue3276_ok
970 issue3276_ok
953 $ rm repo/s/b
971 $ rm repo/s/b
954 $ touch -t 200001010000 repo/.hgsubstate
972 $ touch -t 200001010000 repo/.hgsubstate
955 $ hg -R repo revert --all
973 $ hg -R repo revert --all
956 reverting repo/.hgsubstate (glob)
974 reverting repo/.hgsubstate (glob)
957 reverting subrepo s
975 reverting subrepo s
958 $ hg -R repo update
976 $ hg -R repo update
959 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
977 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
960 $ cat repo/s/b
978 $ cat repo/s/b
961 2
979 2
962 $ rm -rf repo2 repo
980 $ rm -rf repo2 repo
963
981
964
982
965 Issue1852 subrepos with relative paths always push/pull relative to default
983 Issue1852 subrepos with relative paths always push/pull relative to default
966
984
967 Prepare a repo with subrepo
985 Prepare a repo with subrepo
968
986
969 $ hg init issue1852a
987 $ hg init issue1852a
970 $ cd issue1852a
988 $ cd issue1852a
971 $ hg init sub/repo
989 $ hg init sub/repo
972 $ echo test > sub/repo/foo
990 $ echo test > sub/repo/foo
973 $ hg -R sub/repo add sub/repo/foo
991 $ hg -R sub/repo add sub/repo/foo
974 $ echo sub/repo = sub/repo > .hgsub
992 $ echo sub/repo = sub/repo > .hgsub
975 $ hg add .hgsub
993 $ hg add .hgsub
976 $ hg ci -mtest
994 $ hg ci -mtest
977 committing subrepository sub/repo (glob)
995 committing subrepository sub/repo (glob)
978 $ echo test >> sub/repo/foo
996 $ echo test >> sub/repo/foo
979 $ hg ci -mtest
997 $ hg ci -mtest
980 committing subrepository sub/repo (glob)
998 committing subrepository sub/repo (glob)
981 $ hg cat sub/repo/foo
999 $ hg cat sub/repo/foo
982 test
1000 test
983 test
1001 test
984 $ mkdir -p tmp/sub/repo
1002 $ mkdir -p tmp/sub/repo
985 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
1003 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
986 $ cat tmp/sub/repo/foo_p
1004 $ cat tmp/sub/repo/foo_p
987 test
1005 test
988 $ mv sub/repo sub_
1006 $ mv sub/repo sub_
989 $ hg cat sub/repo/baz
1007 $ hg cat sub/repo/baz
990 skipping missing subrepository: sub/repo
1008 skipping missing subrepository: sub/repo
991 [1]
1009 [1]
992 $ rm -rf sub/repo
1010 $ rm -rf sub/repo
993 $ mv sub_ sub/repo
1011 $ mv sub_ sub/repo
994 $ cd ..
1012 $ cd ..
995
1013
996 Create repo without default path, pull top repo, and see what happens on update
1014 Create repo without default path, pull top repo, and see what happens on update
997
1015
998 $ hg init issue1852b
1016 $ hg init issue1852b
999 $ hg -R issue1852b pull issue1852a
1017 $ hg -R issue1852b pull issue1852a
1000 pulling from issue1852a
1018 pulling from issue1852a
1001 requesting all changes
1019 requesting all changes
1002 adding changesets
1020 adding changesets
1003 adding manifests
1021 adding manifests
1004 adding file changes
1022 adding file changes
1005 added 2 changesets with 3 changes to 2 files
1023 added 2 changesets with 3 changes to 2 files
1006 (run 'hg update' to get a working copy)
1024 (run 'hg update' to get a working copy)
1007 $ hg -R issue1852b update
1025 $ hg -R issue1852b update
1008 abort: default path for subrepository not found (in subrepo sub/repo) (glob)
1026 abort: default path for subrepository not found (in subrepo sub/repo) (glob)
1009 [255]
1027 [255]
1010
1028
1011 Ensure a full traceback, not just the SubrepoAbort part
1029 Ensure a full traceback, not just the SubrepoAbort part
1012
1030
1013 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise util\.Abort'
1031 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise util\.Abort'
1014 raise util.Abort(_("default path for subrepository not found"))
1032 raise util.Abort(_("default path for subrepository not found"))
1015
1033
1016 Pull -u now doesn't help
1034 Pull -u now doesn't help
1017
1035
1018 $ hg -R issue1852b pull -u issue1852a
1036 $ hg -R issue1852b pull -u issue1852a
1019 pulling from issue1852a
1037 pulling from issue1852a
1020 searching for changes
1038 searching for changes
1021 no changes found
1039 no changes found
1022
1040
1023 Try the same, but with pull -u
1041 Try the same, but with pull -u
1024
1042
1025 $ hg init issue1852c
1043 $ hg init issue1852c
1026 $ hg -R issue1852c pull -r0 -u issue1852a
1044 $ hg -R issue1852c pull -r0 -u issue1852a
1027 pulling from issue1852a
1045 pulling from issue1852a
1028 adding changesets
1046 adding changesets
1029 adding manifests
1047 adding manifests
1030 adding file changes
1048 adding file changes
1031 added 1 changesets with 2 changes to 2 files
1049 added 1 changesets with 2 changes to 2 files
1032 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
1050 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
1033 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1051 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1034
1052
1035 Try to push from the other side
1053 Try to push from the other side
1036
1054
1037 $ hg -R issue1852a push `pwd`/issue1852c
1055 $ hg -R issue1852a push `pwd`/issue1852c
1038 pushing to $TESTTMP/issue1852c (glob)
1056 pushing to $TESTTMP/issue1852c (glob)
1039 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob)
1057 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob)
1040 searching for changes
1058 searching for changes
1041 no changes found
1059 no changes found
1042 searching for changes
1060 searching for changes
1043 adding changesets
1061 adding changesets
1044 adding manifests
1062 adding manifests
1045 adding file changes
1063 adding file changes
1046 added 1 changesets with 1 changes to 1 files
1064 added 1 changesets with 1 changes to 1 files
1047
1065
1048 Incoming and outgoing should not use the default path:
1066 Incoming and outgoing should not use the default path:
1049
1067
1050 $ hg clone -q issue1852a issue1852d
1068 $ hg clone -q issue1852a issue1852d
1051 $ hg -R issue1852d outgoing --subrepos issue1852c
1069 $ hg -R issue1852d outgoing --subrepos issue1852c
1052 comparing with issue1852c
1070 comparing with issue1852c
1053 searching for changes
1071 searching for changes
1054 no changes found
1072 no changes found
1055 comparing with issue1852c/sub/repo
1073 comparing with issue1852c/sub/repo
1056 searching for changes
1074 searching for changes
1057 no changes found
1075 no changes found
1058 [1]
1076 [1]
1059 $ hg -R issue1852d incoming --subrepos issue1852c
1077 $ hg -R issue1852d incoming --subrepos issue1852c
1060 comparing with issue1852c
1078 comparing with issue1852c
1061 searching for changes
1079 searching for changes
1062 no changes found
1080 no changes found
1063 comparing with issue1852c/sub/repo
1081 comparing with issue1852c/sub/repo
1064 searching for changes
1082 searching for changes
1065 no changes found
1083 no changes found
1066 [1]
1084 [1]
1067
1085
1068 Check that merge of a new subrepo doesn't write the uncommitted state to
1086 Check that merge of a new subrepo doesn't write the uncommitted state to
1069 .hgsubstate (issue4622)
1087 .hgsubstate (issue4622)
1070
1088
1071 $ hg init issue1852a/addedsub
1089 $ hg init issue1852a/addedsub
1072 $ echo zzz > issue1852a/addedsub/zz.txt
1090 $ echo zzz > issue1852a/addedsub/zz.txt
1073 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1091 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1074
1092
1075 $ hg clone issue1852a/addedsub issue1852d/addedsub
1093 $ hg clone issue1852a/addedsub issue1852d/addedsub
1076 updating to branch default
1094 updating to branch default
1077 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1095 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1078
1096
1079 $ echo def > issue1852a/sub/repo/foo
1097 $ echo def > issue1852a/sub/repo/foo
1080 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1098 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1081 adding tmp/sub/repo/foo_p
1099 adding tmp/sub/repo/foo_p
1082 committing subrepository sub/repo (glob)
1100 committing subrepository sub/repo (glob)
1083
1101
1084 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1102 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1085 $ echo xyz > issue1852d/sub/repo/foo
1103 $ echo xyz > issue1852d/sub/repo/foo
1086 $ hg -R issue1852d pull -u
1104 $ hg -R issue1852d pull -u
1087 pulling from $TESTTMP/issue1852a (glob)
1105 pulling from $TESTTMP/issue1852a (glob)
1088 searching for changes
1106 searching for changes
1089 adding changesets
1107 adding changesets
1090 adding manifests
1108 adding manifests
1091 adding file changes
1109 adding file changes
1092 added 1 changesets with 2 changes to 2 files
1110 added 1 changesets with 2 changes to 2 files
1093 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1111 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1094 (M)erge, keep (l)ocal or keep (r)emote? m
1112 (M)erge, keep (l)ocal or keep (r)emote? m
1095 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob)
1113 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob)
1096 searching for changes
1114 searching for changes
1097 adding changesets
1115 adding changesets
1098 adding manifests
1116 adding manifests
1099 adding file changes
1117 adding file changes
1100 added 1 changesets with 1 changes to 1 files
1118 added 1 changesets with 1 changes to 1 files
1101 subrepository sources for sub/repo differ (glob)
1119 subrepository sources for sub/repo differ (glob)
1102 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1120 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1103 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1104 $ cat issue1852d/.hgsubstate
1122 $ cat issue1852d/.hgsubstate
1105 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1123 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1106
1124
1107 Check status of files when none of them belong to the first
1125 Check status of files when none of them belong to the first
1108 subrepository:
1126 subrepository:
1109
1127
1110 $ hg init subrepo-status
1128 $ hg init subrepo-status
1111 $ cd subrepo-status
1129 $ cd subrepo-status
1112 $ hg init subrepo-1
1130 $ hg init subrepo-1
1113 $ hg init subrepo-2
1131 $ hg init subrepo-2
1114 $ cd subrepo-2
1132 $ cd subrepo-2
1115 $ touch file
1133 $ touch file
1116 $ hg add file
1134 $ hg add file
1117 $ cd ..
1135 $ cd ..
1118 $ echo subrepo-1 = subrepo-1 > .hgsub
1136 $ echo subrepo-1 = subrepo-1 > .hgsub
1119 $ echo subrepo-2 = subrepo-2 >> .hgsub
1137 $ echo subrepo-2 = subrepo-2 >> .hgsub
1120 $ hg add .hgsub
1138 $ hg add .hgsub
1121 $ hg ci -m 'Added subrepos'
1139 $ hg ci -m 'Added subrepos'
1122 committing subrepository subrepo-2
1140 committing subrepository subrepo-2
1123 $ hg st subrepo-2/file
1141 $ hg st subrepo-2/file
1124
1142
1125 Check that share works with subrepo
1143 Check that share works with subrepo
1126 $ hg --config extensions.share= share . ../shared
1144 $ hg --config extensions.share= share . ../shared
1127 updating working directory
1145 updating working directory
1128 cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1146 cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1129 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1147 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1130 $ test -f ../shared/subrepo-1/.hg/sharedpath
1148 $ test -f ../shared/subrepo-1/.hg/sharedpath
1131 [1]
1149 [1]
1132 $ hg -R ../shared in
1150 $ hg -R ../shared in
1133 abort: repository default not found!
1151 abort: repository default not found!
1134 [255]
1152 [255]
1135 $ hg -R ../shared/subrepo-2 showconfig paths
1153 $ hg -R ../shared/subrepo-2 showconfig paths
1136 paths.default=$TESTTMP/subrepo-status/subrepo-2
1154 paths.default=$TESTTMP/subrepo-status/subrepo-2
1137 $ hg -R ../shared/subrepo-1 sum --remote
1155 $ hg -R ../shared/subrepo-1 sum --remote
1138 parent: -1:000000000000 tip (empty repository)
1156 parent: -1:000000000000 tip (empty repository)
1139 branch: default
1157 branch: default
1140 commit: (clean)
1158 commit: (clean)
1141 update: (current)
1159 update: (current)
1142 remote: (synced)
1160 remote: (synced)
1143
1161
1144 Check hg update --clean
1162 Check hg update --clean
1145 $ cd $TESTTMP/t
1163 $ cd $TESTTMP/t
1146 $ rm -r t/t.orig
1164 $ rm -r t/t.orig
1147 $ hg status -S --all
1165 $ hg status -S --all
1148 C .hgsub
1166 C .hgsub
1149 C .hgsubstate
1167 C .hgsubstate
1150 C a
1168 C a
1151 C s/.hgsub
1169 C s/.hgsub
1152 C s/.hgsubstate
1170 C s/.hgsubstate
1153 C s/a
1171 C s/a
1154 C s/ss/a
1172 C s/ss/a
1155 C t/t
1173 C t/t
1156 $ echo c1 > s/a
1174 $ echo c1 > s/a
1157 $ cd s
1175 $ cd s
1158 $ echo c1 > b
1176 $ echo c1 > b
1159 $ echo c1 > c
1177 $ echo c1 > c
1160 $ hg add b
1178 $ hg add b
1161 $ cd ..
1179 $ cd ..
1162 $ hg status -S
1180 $ hg status -S
1163 M s/a
1181 M s/a
1164 A s/b
1182 A s/b
1165 ? s/c
1183 ? s/c
1166 $ hg update -C
1184 $ hg update -C
1167 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1168 $ hg status -S
1186 $ hg status -S
1169 ? s/b
1187 ? s/b
1170 ? s/c
1188 ? s/c
1171
1189
1172 Sticky subrepositories, no changes
1190 Sticky subrepositories, no changes
1173 $ cd $TESTTMP/t
1191 $ cd $TESTTMP/t
1174 $ hg id
1192 $ hg id
1175 925c17564ef8 tip
1193 925c17564ef8 tip
1176 $ hg -R s id
1194 $ hg -R s id
1177 12a213df6fa9 tip
1195 12a213df6fa9 tip
1178 $ hg -R t id
1196 $ hg -R t id
1179 52c0adc0515a tip
1197 52c0adc0515a tip
1180 $ hg update 11
1198 $ hg update 11
1181 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1199 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1182 $ hg id
1200 $ hg id
1183 365661e5936a
1201 365661e5936a
1184 $ hg -R s id
1202 $ hg -R s id
1185 fc627a69481f
1203 fc627a69481f
1186 $ hg -R t id
1204 $ hg -R t id
1187 e95bcfa18a35
1205 e95bcfa18a35
1188
1206
1189 Sticky subrepositories, file changes
1207 Sticky subrepositories, file changes
1190 $ touch s/f1
1208 $ touch s/f1
1191 $ touch t/f1
1209 $ touch t/f1
1192 $ hg add -S s/f1
1210 $ hg add -S s/f1
1193 $ hg add -S t/f1
1211 $ hg add -S t/f1
1194 $ hg id
1212 $ hg id
1195 365661e5936a+
1213 365661e5936a+
1196 $ hg -R s id
1214 $ hg -R s id
1197 fc627a69481f+
1215 fc627a69481f+
1198 $ hg -R t id
1216 $ hg -R t id
1199 e95bcfa18a35+
1217 e95bcfa18a35+
1200 $ hg update tip
1218 $ hg update tip
1201 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1219 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1202 (M)erge, keep (l)ocal or keep (r)emote? m
1220 (M)erge, keep (l)ocal or keep (r)emote? m
1203 subrepository sources for s differ
1221 subrepository sources for s differ
1204 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1222 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1205 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1223 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1206 (M)erge, keep (l)ocal or keep (r)emote? m
1224 (M)erge, keep (l)ocal or keep (r)emote? m
1207 subrepository sources for t differ
1225 subrepository sources for t differ
1208 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1226 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1209 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1227 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1210 $ hg id
1228 $ hg id
1211 925c17564ef8+ tip
1229 925c17564ef8+ tip
1212 $ hg -R s id
1230 $ hg -R s id
1213 fc627a69481f+
1231 fc627a69481f+
1214 $ hg -R t id
1232 $ hg -R t id
1215 e95bcfa18a35+
1233 e95bcfa18a35+
1216 $ hg update --clean tip
1234 $ hg update --clean tip
1217 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1218
1236
1219 Sticky subrepository, revision updates
1237 Sticky subrepository, revision updates
1220 $ hg id
1238 $ hg id
1221 925c17564ef8 tip
1239 925c17564ef8 tip
1222 $ hg -R s id
1240 $ hg -R s id
1223 12a213df6fa9 tip
1241 12a213df6fa9 tip
1224 $ hg -R t id
1242 $ hg -R t id
1225 52c0adc0515a tip
1243 52c0adc0515a tip
1226 $ cd s
1244 $ cd s
1227 $ hg update -r -2
1245 $ hg update -r -2
1228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1229 $ cd ../t
1247 $ cd ../t
1230 $ hg update -r 2
1248 $ hg update -r 2
1231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1232 $ cd ..
1250 $ cd ..
1233 $ hg update 10
1251 $ hg update 10
1234 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1252 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1235 (M)erge, keep (l)ocal or keep (r)emote? m
1253 (M)erge, keep (l)ocal or keep (r)emote? m
1236 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1254 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1237 (M)erge, keep (l)ocal or keep (r)emote? m
1255 (M)erge, keep (l)ocal or keep (r)emote? m
1238 subrepository sources for t differ (in checked out version)
1256 subrepository sources for t differ (in checked out version)
1239 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1257 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1240 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1258 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1241 $ hg id
1259 $ hg id
1242 e45c8b14af55+
1260 e45c8b14af55+
1243 $ hg -R s id
1261 $ hg -R s id
1244 02dcf1d70411
1262 02dcf1d70411
1245 $ hg -R t id
1263 $ hg -R t id
1246 7af322bc1198
1264 7af322bc1198
1247
1265
1248 Sticky subrepository, file changes and revision updates
1266 Sticky subrepository, file changes and revision updates
1249 $ touch s/f1
1267 $ touch s/f1
1250 $ touch t/f1
1268 $ touch t/f1
1251 $ hg add -S s/f1
1269 $ hg add -S s/f1
1252 $ hg add -S t/f1
1270 $ hg add -S t/f1
1253 $ hg id
1271 $ hg id
1254 e45c8b14af55+
1272 e45c8b14af55+
1255 $ hg -R s id
1273 $ hg -R s id
1256 02dcf1d70411+
1274 02dcf1d70411+
1257 $ hg -R t id
1275 $ hg -R t id
1258 7af322bc1198+
1276 7af322bc1198+
1259 $ hg update tip
1277 $ hg update tip
1260 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1278 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1261 (M)erge, keep (l)ocal or keep (r)emote? m
1279 (M)erge, keep (l)ocal or keep (r)emote? m
1262 subrepository sources for s differ
1280 subrepository sources for s differ
1263 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1281 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1264 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1282 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1265 (M)erge, keep (l)ocal or keep (r)emote? m
1283 (M)erge, keep (l)ocal or keep (r)emote? m
1266 subrepository sources for t differ
1284 subrepository sources for t differ
1267 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1285 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1268 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1286 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1269 $ hg id
1287 $ hg id
1270 925c17564ef8+ tip
1288 925c17564ef8+ tip
1271 $ hg -R s id
1289 $ hg -R s id
1272 02dcf1d70411+
1290 02dcf1d70411+
1273 $ hg -R t id
1291 $ hg -R t id
1274 7af322bc1198+
1292 7af322bc1198+
1275
1293
1276 Sticky repository, update --clean
1294 Sticky repository, update --clean
1277 $ hg update --clean tip
1295 $ hg update --clean tip
1278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1296 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1279 $ hg id
1297 $ hg id
1280 925c17564ef8 tip
1298 925c17564ef8 tip
1281 $ hg -R s id
1299 $ hg -R s id
1282 12a213df6fa9 tip
1300 12a213df6fa9 tip
1283 $ hg -R t id
1301 $ hg -R t id
1284 52c0adc0515a tip
1302 52c0adc0515a tip
1285
1303
1286 Test subrepo already at intended revision:
1304 Test subrepo already at intended revision:
1287 $ cd s
1305 $ cd s
1288 $ hg update fc627a69481f
1306 $ hg update fc627a69481f
1289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1307 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1290 $ cd ..
1308 $ cd ..
1291 $ hg update 11
1309 $ hg update 11
1292 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1310 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1293 (M)erge, keep (l)ocal or keep (r)emote? m
1311 (M)erge, keep (l)ocal or keep (r)emote? m
1294 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1312 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1295 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1313 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1296 $ hg id -n
1314 $ hg id -n
1297 11+
1315 11+
1298 $ hg -R s id
1316 $ hg -R s id
1299 fc627a69481f
1317 fc627a69481f
1300 $ hg -R t id
1318 $ hg -R t id
1301 e95bcfa18a35
1319 e95bcfa18a35
1302
1320
1303 Test that removing .hgsubstate doesn't break anything:
1321 Test that removing .hgsubstate doesn't break anything:
1304
1322
1305 $ hg rm -f .hgsubstate
1323 $ hg rm -f .hgsubstate
1306 $ hg ci -mrm
1324 $ hg ci -mrm
1307 nothing changed
1325 nothing changed
1308 [1]
1326 [1]
1309 $ hg log -vr tip
1327 $ hg log -vr tip
1310 changeset: 13:925c17564ef8
1328 changeset: 13:925c17564ef8
1311 tag: tip
1329 tag: tip
1312 user: test
1330 user: test
1313 date: Thu Jan 01 00:00:00 1970 +0000
1331 date: Thu Jan 01 00:00:00 1970 +0000
1314 files: .hgsubstate
1332 files: .hgsubstate
1315 description:
1333 description:
1316 13
1334 13
1317
1335
1318
1336
1319
1337
1320 Test that removing .hgsub removes .hgsubstate:
1338 Test that removing .hgsub removes .hgsubstate:
1321
1339
1322 $ hg rm .hgsub
1340 $ hg rm .hgsub
1323 $ hg ci -mrm2
1341 $ hg ci -mrm2
1324 created new head
1342 created new head
1325 $ hg log -vr tip
1343 $ hg log -vr tip
1326 changeset: 14:2400bccd50af
1344 changeset: 14:2400bccd50af
1327 tag: tip
1345 tag: tip
1328 parent: 11:365661e5936a
1346 parent: 11:365661e5936a
1329 user: test
1347 user: test
1330 date: Thu Jan 01 00:00:00 1970 +0000
1348 date: Thu Jan 01 00:00:00 1970 +0000
1331 files: .hgsub .hgsubstate
1349 files: .hgsub .hgsubstate
1332 description:
1350 description:
1333 rm2
1351 rm2
1334
1352
1335
1353
1336 Test issue3153: diff -S with deleted subrepos
1354 Test issue3153: diff -S with deleted subrepos
1337
1355
1338 $ hg diff --nodates -S -c .
1356 $ hg diff --nodates -S -c .
1339 diff -r 365661e5936a -r 2400bccd50af .hgsub
1357 diff -r 365661e5936a -r 2400bccd50af .hgsub
1340 --- a/.hgsub
1358 --- a/.hgsub
1341 +++ /dev/null
1359 +++ /dev/null
1342 @@ -1,2 +0,0 @@
1360 @@ -1,2 +0,0 @@
1343 -s = s
1361 -s = s
1344 -t = t
1362 -t = t
1345 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1363 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1346 --- a/.hgsubstate
1364 --- a/.hgsubstate
1347 +++ /dev/null
1365 +++ /dev/null
1348 @@ -1,2 +0,0 @@
1366 @@ -1,2 +0,0 @@
1349 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1367 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1350 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1368 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1351
1369
1352 Test behavior of add for explicit path in subrepo:
1370 Test behavior of add for explicit path in subrepo:
1353 $ cd ..
1371 $ cd ..
1354 $ hg init explicit
1372 $ hg init explicit
1355 $ cd explicit
1373 $ cd explicit
1356 $ echo s = s > .hgsub
1374 $ echo s = s > .hgsub
1357 $ hg add .hgsub
1375 $ hg add .hgsub
1358 $ hg init s
1376 $ hg init s
1359 $ hg ci -m0
1377 $ hg ci -m0
1360 Adding with an explicit path in a subrepo adds the file
1378 Adding with an explicit path in a subrepo adds the file
1361 $ echo c1 > f1
1379 $ echo c1 > f1
1362 $ echo c2 > s/f2
1380 $ echo c2 > s/f2
1363 $ hg st -S
1381 $ hg st -S
1364 ? f1
1382 ? f1
1365 ? s/f2
1383 ? s/f2
1366 $ hg add s/f2
1384 $ hg add s/f2
1367 $ hg st -S
1385 $ hg st -S
1368 A s/f2
1386 A s/f2
1369 ? f1
1387 ? f1
1370 $ hg ci -R s -m0
1388 $ hg ci -R s -m0
1371 $ hg ci -Am1
1389 $ hg ci -Am1
1372 adding f1
1390 adding f1
1373 Adding with an explicit path in a subrepo with -S has the same behavior
1391 Adding with an explicit path in a subrepo with -S has the same behavior
1374 $ echo c3 > f3
1392 $ echo c3 > f3
1375 $ echo c4 > s/f4
1393 $ echo c4 > s/f4
1376 $ hg st -S
1394 $ hg st -S
1377 ? f3
1395 ? f3
1378 ? s/f4
1396 ? s/f4
1379 $ hg add -S s/f4
1397 $ hg add -S s/f4
1380 $ hg st -S
1398 $ hg st -S
1381 A s/f4
1399 A s/f4
1382 ? f3
1400 ? f3
1383 $ hg ci -R s -m1
1401 $ hg ci -R s -m1
1384 $ hg ci -Ama2
1402 $ hg ci -Ama2
1385 adding f3
1403 adding f3
1386 Adding without a path or pattern silently ignores subrepos
1404 Adding without a path or pattern silently ignores subrepos
1387 $ echo c5 > f5
1405 $ echo c5 > f5
1388 $ echo c6 > s/f6
1406 $ echo c6 > s/f6
1389 $ echo c7 > s/f7
1407 $ echo c7 > s/f7
1390 $ hg st -S
1408 $ hg st -S
1391 ? f5
1409 ? f5
1392 ? s/f6
1410 ? s/f6
1393 ? s/f7
1411 ? s/f7
1394 $ hg add
1412 $ hg add
1395 adding f5
1413 adding f5
1396 $ hg st -S
1414 $ hg st -S
1397 A f5
1415 A f5
1398 ? s/f6
1416 ? s/f6
1399 ? s/f7
1417 ? s/f7
1400 $ hg ci -R s -Am2
1418 $ hg ci -R s -Am2
1401 adding f6
1419 adding f6
1402 adding f7
1420 adding f7
1403 $ hg ci -m3
1421 $ hg ci -m3
1404 Adding without a path or pattern with -S also adds files in subrepos
1422 Adding without a path or pattern with -S also adds files in subrepos
1405 $ echo c8 > f8
1423 $ echo c8 > f8
1406 $ echo c9 > s/f9
1424 $ echo c9 > s/f9
1407 $ echo c10 > s/f10
1425 $ echo c10 > s/f10
1408 $ hg st -S
1426 $ hg st -S
1409 ? f8
1427 ? f8
1410 ? s/f10
1428 ? s/f10
1411 ? s/f9
1429 ? s/f9
1412 $ hg add -S
1430 $ hg add -S
1413 adding f8
1431 adding f8
1414 adding s/f10 (glob)
1432 adding s/f10 (glob)
1415 adding s/f9 (glob)
1433 adding s/f9 (glob)
1416 $ hg st -S
1434 $ hg st -S
1417 A f8
1435 A f8
1418 A s/f10
1436 A s/f10
1419 A s/f9
1437 A s/f9
1420 $ hg ci -R s -m3
1438 $ hg ci -R s -m3
1421 $ hg ci -m4
1439 $ hg ci -m4
1422 Adding with a pattern silently ignores subrepos
1440 Adding with a pattern silently ignores subrepos
1423 $ echo c11 > fm11
1441 $ echo c11 > fm11
1424 $ echo c12 > fn12
1442 $ echo c12 > fn12
1425 $ echo c13 > s/fm13
1443 $ echo c13 > s/fm13
1426 $ echo c14 > s/fn14
1444 $ echo c14 > s/fn14
1427 $ hg st -S
1445 $ hg st -S
1428 ? fm11
1446 ? fm11
1429 ? fn12
1447 ? fn12
1430 ? s/fm13
1448 ? s/fm13
1431 ? s/fn14
1449 ? s/fn14
1432 $ hg add 'glob:**fm*'
1450 $ hg add 'glob:**fm*'
1433 adding fm11
1451 adding fm11
1434 $ hg st -S
1452 $ hg st -S
1435 A fm11
1453 A fm11
1436 ? fn12
1454 ? fn12
1437 ? s/fm13
1455 ? s/fm13
1438 ? s/fn14
1456 ? s/fn14
1439 $ hg ci -R s -Am4
1457 $ hg ci -R s -Am4
1440 adding fm13
1458 adding fm13
1441 adding fn14
1459 adding fn14
1442 $ hg ci -Am5
1460 $ hg ci -Am5
1443 adding fn12
1461 adding fn12
1444 Adding with a pattern with -S also adds matches in subrepos
1462 Adding with a pattern with -S also adds matches in subrepos
1445 $ echo c15 > fm15
1463 $ echo c15 > fm15
1446 $ echo c16 > fn16
1464 $ echo c16 > fn16
1447 $ echo c17 > s/fm17
1465 $ echo c17 > s/fm17
1448 $ echo c18 > s/fn18
1466 $ echo c18 > s/fn18
1449 $ hg st -S
1467 $ hg st -S
1450 ? fm15
1468 ? fm15
1451 ? fn16
1469 ? fn16
1452 ? s/fm17
1470 ? s/fm17
1453 ? s/fn18
1471 ? s/fn18
1454 $ hg add -S 'glob:**fm*'
1472 $ hg add -S 'glob:**fm*'
1455 adding fm15
1473 adding fm15
1456 adding s/fm17 (glob)
1474 adding s/fm17 (glob)
1457 $ hg st -S
1475 $ hg st -S
1458 A fm15
1476 A fm15
1459 A s/fm17
1477 A s/fm17
1460 ? fn16
1478 ? fn16
1461 ? s/fn18
1479 ? s/fn18
1462 $ hg ci -R s -Am5
1480 $ hg ci -R s -Am5
1463 adding fn18
1481 adding fn18
1464 $ hg ci -Am6
1482 $ hg ci -Am6
1465 adding fn16
1483 adding fn16
1466
1484
1467 Test behavior of forget for explicit path in subrepo:
1485 Test behavior of forget for explicit path in subrepo:
1468 Forgetting an explicit path in a subrepo untracks the file
1486 Forgetting an explicit path in a subrepo untracks the file
1469 $ echo c19 > s/f19
1487 $ echo c19 > s/f19
1470 $ hg add s/f19
1488 $ hg add s/f19
1471 $ hg st -S
1489 $ hg st -S
1472 A s/f19
1490 A s/f19
1473 $ hg forget s/f19
1491 $ hg forget s/f19
1474 $ hg st -S
1492 $ hg st -S
1475 ? s/f19
1493 ? s/f19
1476 $ rm s/f19
1494 $ rm s/f19
1477 $ cd ..
1495 $ cd ..
1478
1496
1479 Courtesy phases synchronisation to publishing server does not block the push
1497 Courtesy phases synchronisation to publishing server does not block the push
1480 (issue3781)
1498 (issue3781)
1481
1499
1482 $ cp -r main issue3781
1500 $ cp -r main issue3781
1483 $ cp -r main issue3781-dest
1501 $ cp -r main issue3781-dest
1484 $ cd issue3781-dest/s
1502 $ cd issue3781-dest/s
1485 $ hg phase tip # show we have draft changeset
1503 $ hg phase tip # show we have draft changeset
1486 5: draft
1504 5: draft
1487 $ chmod a-w .hg/store/phaseroots # prevent phase push
1505 $ chmod a-w .hg/store/phaseroots # prevent phase push
1488 $ cd ../../issue3781
1506 $ cd ../../issue3781
1489 $ cat >> .hg/hgrc << EOF
1507 $ cat >> .hg/hgrc << EOF
1490 > [paths]
1508 > [paths]
1491 > default=../issue3781-dest/
1509 > default=../issue3781-dest/
1492 > EOF
1510 > EOF
1493 $ hg push --config experimental.bundle2-exp=False
1511 $ hg push --config experimental.bundle2-exp=False
1494 pushing to $TESTTMP/issue3781-dest (glob)
1512 pushing to $TESTTMP/issue3781-dest (glob)
1495 pushing subrepo s to $TESTTMP/issue3781-dest/s
1513 pushing subrepo s to $TESTTMP/issue3781-dest/s
1496 searching for changes
1514 searching for changes
1497 no changes found
1515 no changes found
1498 searching for changes
1516 searching for changes
1499 no changes found
1517 no changes found
1500 [1]
1518 [1]
1501 # clean the push cache
1519 # clean the push cache
1502 $ rm s/.hg/cache/storehash/*
1520 $ rm s/.hg/cache/storehash/*
1503 $ hg push --config experimental.bundle2-exp=True
1521 $ hg push --config experimental.bundle2-exp=True
1504 pushing to $TESTTMP/issue3781-dest (glob)
1522 pushing to $TESTTMP/issue3781-dest (glob)
1505 pushing subrepo s to $TESTTMP/issue3781-dest/s
1523 pushing subrepo s to $TESTTMP/issue3781-dest/s
1506 searching for changes
1524 searching for changes
1507 no changes found
1525 no changes found
1508 searching for changes
1526 searching for changes
1509 no changes found
1527 no changes found
1510 [1]
1528 [1]
1511 $ cd ..
1529 $ cd ..
1512
1530
1513 Test phase choice for newly created commit with "phases.subrepochecks"
1531 Test phase choice for newly created commit with "phases.subrepochecks"
1514 configuration
1532 configuration
1515
1533
1516 $ cd t
1534 $ cd t
1517 $ hg update -q -r 12
1535 $ hg update -q -r 12
1518
1536
1519 $ cat >> s/ss/.hg/hgrc <<EOF
1537 $ cat >> s/ss/.hg/hgrc <<EOF
1520 > [phases]
1538 > [phases]
1521 > new-commit = secret
1539 > new-commit = secret
1522 > EOF
1540 > EOF
1523 $ cat >> s/.hg/hgrc <<EOF
1541 $ cat >> s/.hg/hgrc <<EOF
1524 > [phases]
1542 > [phases]
1525 > new-commit = draft
1543 > new-commit = draft
1526 > EOF
1544 > EOF
1527 $ echo phasecheck1 >> s/ss/a
1545 $ echo phasecheck1 >> s/ss/a
1528 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1546 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1529 committing subrepository ss
1547 committing subrepository ss
1530 transaction abort!
1548 transaction abort!
1531 rollback completed
1549 rollback completed
1532 abort: can't commit in draft phase conflicting secret from subrepository ss
1550 abort: can't commit in draft phase conflicting secret from subrepository ss
1533 [255]
1551 [255]
1534 $ echo phasecheck2 >> s/ss/a
1552 $ echo phasecheck2 >> s/ss/a
1535 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1553 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1536 committing subrepository ss
1554 committing subrepository ss
1537 $ hg -R s/ss phase tip
1555 $ hg -R s/ss phase tip
1538 3: secret
1556 3: secret
1539 $ hg -R s phase tip
1557 $ hg -R s phase tip
1540 6: draft
1558 6: draft
1541 $ echo phasecheck3 >> s/ss/a
1559 $ echo phasecheck3 >> s/ss/a
1542 $ hg -R s commit -S -m phasecheck3
1560 $ hg -R s commit -S -m phasecheck3
1543 committing subrepository ss
1561 committing subrepository ss
1544 warning: changes are committed in secret phase from subrepository ss
1562 warning: changes are committed in secret phase from subrepository ss
1545 $ hg -R s/ss phase tip
1563 $ hg -R s/ss phase tip
1546 4: secret
1564 4: secret
1547 $ hg -R s phase tip
1565 $ hg -R s phase tip
1548 7: secret
1566 7: secret
1549
1567
1550 $ cat >> t/.hg/hgrc <<EOF
1568 $ cat >> t/.hg/hgrc <<EOF
1551 > [phases]
1569 > [phases]
1552 > new-commit = draft
1570 > new-commit = draft
1553 > EOF
1571 > EOF
1554 $ cat >> .hg/hgrc <<EOF
1572 $ cat >> .hg/hgrc <<EOF
1555 > [phases]
1573 > [phases]
1556 > new-commit = public
1574 > new-commit = public
1557 > EOF
1575 > EOF
1558 $ echo phasecheck4 >> s/ss/a
1576 $ echo phasecheck4 >> s/ss/a
1559 $ echo phasecheck4 >> t/t
1577 $ echo phasecheck4 >> t/t
1560 $ hg commit -S -m phasecheck4
1578 $ hg commit -S -m phasecheck4
1561 committing subrepository s
1579 committing subrepository s
1562 committing subrepository s/ss (glob)
1580 committing subrepository s/ss (glob)
1563 warning: changes are committed in secret phase from subrepository ss
1581 warning: changes are committed in secret phase from subrepository ss
1564 committing subrepository t
1582 committing subrepository t
1565 warning: changes are committed in secret phase from subrepository s
1583 warning: changes are committed in secret phase from subrepository s
1566 created new head
1584 created new head
1567 $ hg -R s/ss phase tip
1585 $ hg -R s/ss phase tip
1568 5: secret
1586 5: secret
1569 $ hg -R s phase tip
1587 $ hg -R s phase tip
1570 8: secret
1588 8: secret
1571 $ hg -R t phase tip
1589 $ hg -R t phase tip
1572 6: draft
1590 6: draft
1573 $ hg phase tip
1591 $ hg phase tip
1574 15: secret
1592 15: secret
1575
1593
1576 $ cd ..
1594 $ cd ..
1577
1595
1578
1596
1579 Test that commit --secret works on both repo and subrepo (issue4182)
1597 Test that commit --secret works on both repo and subrepo (issue4182)
1580
1598
1581 $ cd main
1599 $ cd main
1582 $ echo secret >> b
1600 $ echo secret >> b
1583 $ echo secret >> s/b
1601 $ echo secret >> s/b
1584 $ hg commit --secret --subrepo -m "secret"
1602 $ hg commit --secret --subrepo -m "secret"
1585 committing subrepository s
1603 committing subrepository s
1586 $ hg phase -r .
1604 $ hg phase -r .
1587 6: secret
1605 6: secret
1588 $ cd s
1606 $ cd s
1589 $ hg phase -r .
1607 $ hg phase -r .
1590 6: secret
1608 6: secret
1591 $ cd ../../
1609 $ cd ../../
1592
1610
1593 Test "subrepos" template keyword
1611 Test "subrepos" template keyword
1594
1612
1595 $ cd t
1613 $ cd t
1596 $ hg update -q 15
1614 $ hg update -q 15
1597 $ cat > .hgsub <<EOF
1615 $ cat > .hgsub <<EOF
1598 > s = s
1616 > s = s
1599 > EOF
1617 > EOF
1600 $ hg commit -m "16"
1618 $ hg commit -m "16"
1601 warning: changes are committed in secret phase from subrepository s
1619 warning: changes are committed in secret phase from subrepository s
1602
1620
1603 (addition of ".hgsub" itself)
1621 (addition of ".hgsub" itself)
1604
1622
1605 $ hg diff --nodates -c 1 .hgsubstate
1623 $ hg diff --nodates -c 1 .hgsubstate
1606 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1624 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1607 --- /dev/null
1625 --- /dev/null
1608 +++ b/.hgsubstate
1626 +++ b/.hgsubstate
1609 @@ -0,0 +1,1 @@
1627 @@ -0,0 +1,1 @@
1610 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1628 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1611 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1629 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1612 f7b1eb17ad24 000000000000
1630 f7b1eb17ad24 000000000000
1613 s
1631 s
1614
1632
1615 (modification of existing entry)
1633 (modification of existing entry)
1616
1634
1617 $ hg diff --nodates -c 2 .hgsubstate
1635 $ hg diff --nodates -c 2 .hgsubstate
1618 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1636 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1619 --- a/.hgsubstate
1637 --- a/.hgsubstate
1620 +++ b/.hgsubstate
1638 +++ b/.hgsubstate
1621 @@ -1,1 +1,1 @@
1639 @@ -1,1 +1,1 @@
1622 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1640 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1623 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1641 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1624 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1642 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1625 7cf8cfea66e4 000000000000
1643 7cf8cfea66e4 000000000000
1626 s
1644 s
1627
1645
1628 (addition of entry)
1646 (addition of entry)
1629
1647
1630 $ hg diff --nodates -c 5 .hgsubstate
1648 $ hg diff --nodates -c 5 .hgsubstate
1631 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1649 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1632 --- a/.hgsubstate
1650 --- a/.hgsubstate
1633 +++ b/.hgsubstate
1651 +++ b/.hgsubstate
1634 @@ -1,1 +1,2 @@
1652 @@ -1,1 +1,2 @@
1635 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1653 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1636 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1654 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1637 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1655 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1638 7cf8cfea66e4 000000000000
1656 7cf8cfea66e4 000000000000
1639 t
1657 t
1640
1658
1641 (removal of existing entry)
1659 (removal of existing entry)
1642
1660
1643 $ hg diff --nodates -c 16 .hgsubstate
1661 $ hg diff --nodates -c 16 .hgsubstate
1644 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1662 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1645 --- a/.hgsubstate
1663 --- a/.hgsubstate
1646 +++ b/.hgsubstate
1664 +++ b/.hgsubstate
1647 @@ -1,2 +1,1 @@
1665 @@ -1,2 +1,1 @@
1648 0731af8ca9423976d3743119d0865097c07bdc1b s
1666 0731af8ca9423976d3743119d0865097c07bdc1b s
1649 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1667 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1650 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1668 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1651 8bec38d2bd0b 000000000000
1669 8bec38d2bd0b 000000000000
1652 t
1670 t
1653
1671
1654 (merging)
1672 (merging)
1655
1673
1656 $ hg diff --nodates -c 9 .hgsubstate
1674 $ hg diff --nodates -c 9 .hgsubstate
1657 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1675 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1658 --- a/.hgsubstate
1676 --- a/.hgsubstate
1659 +++ b/.hgsubstate
1677 +++ b/.hgsubstate
1660 @@ -1,1 +1,2 @@
1678 @@ -1,1 +1,2 @@
1661 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1679 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1662 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1680 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1663 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1681 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1664 f6affe3fbfaa 1f14a2e2d3ec
1682 f6affe3fbfaa 1f14a2e2d3ec
1665 t
1683 t
1666
1684
1667 (removal of ".hgsub" itself)
1685 (removal of ".hgsub" itself)
1668
1686
1669 $ hg diff --nodates -c 8 .hgsubstate
1687 $ hg diff --nodates -c 8 .hgsubstate
1670 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1688 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1671 --- a/.hgsubstate
1689 --- a/.hgsubstate
1672 +++ /dev/null
1690 +++ /dev/null
1673 @@ -1,2 +0,0 @@
1691 @@ -1,2 +0,0 @@
1674 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1692 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1675 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1693 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1676 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1694 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1677 f94576341bcf 000000000000
1695 f94576341bcf 000000000000
1678
1696
1679 Test that '[paths]' is configured correctly at subrepo creation
1697 Test that '[paths]' is configured correctly at subrepo creation
1680
1698
1681 $ cd $TESTTMP/tc
1699 $ cd $TESTTMP/tc
1682 $ cat > .hgsub <<EOF
1700 $ cat > .hgsub <<EOF
1683 > # to clear bogus subrepo path 'bogus=[boguspath'
1701 > # to clear bogus subrepo path 'bogus=[boguspath'
1684 > s = s
1702 > s = s
1685 > t = t
1703 > t = t
1686 > EOF
1704 > EOF
1687 $ hg update -q --clean null
1705 $ hg update -q --clean null
1688 $ rm -rf s t
1706 $ rm -rf s t
1689 $ cat >> .hg/hgrc <<EOF
1707 $ cat >> .hg/hgrc <<EOF
1690 > [paths]
1708 > [paths]
1691 > default-push = /foo/bar
1709 > default-push = /foo/bar
1692 > EOF
1710 > EOF
1693 $ hg update -q
1711 $ hg update -q
1694 $ cat s/.hg/hgrc
1712 $ cat s/.hg/hgrc
1695 [paths]
1713 [paths]
1696 default = $TESTTMP/t/s
1714 default = $TESTTMP/t/s
1697 default-push = /foo/bar/s
1715 default-push = /foo/bar/s
1698 $ cat s/ss/.hg/hgrc
1716 $ cat s/ss/.hg/hgrc
1699 [paths]
1717 [paths]
1700 default = $TESTTMP/t/s/ss
1718 default = $TESTTMP/t/s/ss
1701 default-push = /foo/bar/s/ss
1719 default-push = /foo/bar/s/ss
1702 $ cat t/.hg/hgrc
1720 $ cat t/.hg/hgrc
1703 [paths]
1721 [paths]
1704 default = $TESTTMP/t/t
1722 default = $TESTTMP/t/t
1705 default-push = /foo/bar/t
1723 default-push = /foo/bar/t
1706
1724
1707 $ cd $TESTTMP/t
1725 $ cd $TESTTMP/t
1708 $ hg up -qC 0
1726 $ hg up -qC 0
1709 $ echo 'bar' > bar.txt
1727 $ echo 'bar' > bar.txt
1710 $ hg ci -Am 'branch before subrepo add'
1728 $ hg ci -Am 'branch before subrepo add'
1711 adding bar.txt
1729 adding bar.txt
1712 created new head
1730 created new head
1713 $ hg merge -r "first(subrepo('s'))"
1731 $ hg merge -r "first(subrepo('s'))"
1714 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1732 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1715 (branch merge, don't forget to commit)
1733 (branch merge, don't forget to commit)
1716 $ hg status -S -X '.hgsub*'
1734 $ hg status -S -X '.hgsub*'
1717 A s/a
1735 A s/a
1718 ? s/b
1736 ? s/b
1719 ? s/c
1737 ? s/c
1720 ? s/f1
1738 ? s/f1
1721 $ hg status -S --rev 'p2()'
1739 $ hg status -S --rev 'p2()'
1722 A bar.txt
1740 A bar.txt
1723 ? s/b
1741 ? s/b
1724 ? s/c
1742 ? s/c
1725 ? s/f1
1743 ? s/f1
1726 $ hg diff -S -X '.hgsub*' --nodates
1744 $ hg diff -S -X '.hgsub*' --nodates
1727 diff -r 000000000000 s/a
1745 diff -r 000000000000 s/a
1728 --- /dev/null
1746 --- /dev/null
1729 +++ b/s/a
1747 +++ b/s/a
1730 @@ -0,0 +1,1 @@
1748 @@ -0,0 +1,1 @@
1731 +a
1749 +a
1732 $ hg diff -S --rev 'p2()' --nodates
1750 $ hg diff -S --rev 'p2()' --nodates
1733 diff -r 7cf8cfea66e4 bar.txt
1751 diff -r 7cf8cfea66e4 bar.txt
1734 --- /dev/null
1752 --- /dev/null
1735 +++ b/bar.txt
1753 +++ b/bar.txt
1736 @@ -0,0 +1,1 @@
1754 @@ -0,0 +1,1 @@
1737 +bar
1755 +bar
1738
1756
1739 $ cd ..
1757 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now