Show More
@@ -1,1922 +1,1919 | |||||
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, short, hex, bin |
|
8 | from node import nullid, nullrev, 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 |
|
|
1250 | return [] | |
1251 | for p in self.parents(): |
|
|||
1252 | t.extend(p.tags()) |
|
|||
1253 | return t |
|
|||
1254 |
|
1251 | |||
1255 | def bookmarks(self): |
|
1252 | def bookmarks(self): | |
1256 | b = [] |
|
1253 | b = [] | |
1257 | for p in self.parents(): |
|
1254 | for p in self.parents(): | |
1258 | b.extend(p.bookmarks()) |
|
1255 | b.extend(p.bookmarks()) | |
1259 | return b |
|
1256 | return b | |
1260 |
|
1257 | |||
1261 | def phase(self): |
|
1258 | def phase(self): | |
1262 | phase = phases.draft # default phase to draft |
|
1259 | phase = phases.draft # default phase to draft | |
1263 | for p in self.parents(): |
|
1260 | for p in self.parents(): | |
1264 | phase = max(phase, p.phase()) |
|
1261 | phase = max(phase, p.phase()) | |
1265 | return phase |
|
1262 | return phase | |
1266 |
|
1263 | |||
1267 | def hidden(self): |
|
1264 | def hidden(self): | |
1268 | return False |
|
1265 | return False | |
1269 |
|
1266 | |||
1270 | def children(self): |
|
1267 | def children(self): | |
1271 | return [] |
|
1268 | return [] | |
1272 |
|
1269 | |||
1273 | def flags(self, path): |
|
1270 | def flags(self, path): | |
1274 | if '_manifest' in self.__dict__: |
|
1271 | if '_manifest' in self.__dict__: | |
1275 | try: |
|
1272 | try: | |
1276 | return self._manifest.flags(path) |
|
1273 | return self._manifest.flags(path) | |
1277 | except KeyError: |
|
1274 | except KeyError: | |
1278 | return '' |
|
1275 | return '' | |
1279 |
|
1276 | |||
1280 | try: |
|
1277 | try: | |
1281 | return self._flagfunc(path) |
|
1278 | return self._flagfunc(path) | |
1282 | except OSError: |
|
1279 | except OSError: | |
1283 | return '' |
|
1280 | return '' | |
1284 |
|
1281 | |||
1285 | def ancestor(self, c2): |
|
1282 | def ancestor(self, c2): | |
1286 | """return the "best" ancestor context of self and c2""" |
|
1283 | """return the "best" ancestor context of self and c2""" | |
1287 | 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 | |
1288 |
|
1285 | |||
1289 | def walk(self, match): |
|
1286 | def walk(self, match): | |
1290 | '''Generates matching file names.''' |
|
1287 | '''Generates matching file names.''' | |
1291 | return sorted(self._repo.dirstate.walk(match, sorted(self.substate), |
|
1288 | return sorted(self._repo.dirstate.walk(match, sorted(self.substate), | |
1292 | True, False)) |
|
1289 | True, False)) | |
1293 |
|
1290 | |||
1294 | def matches(self, match): |
|
1291 | def matches(self, match): | |
1295 | return sorted(self._repo.dirstate.matches(match)) |
|
1292 | return sorted(self._repo.dirstate.matches(match)) | |
1296 |
|
1293 | |||
1297 | def ancestors(self): |
|
1294 | def ancestors(self): | |
1298 | for p in self._parents: |
|
1295 | for p in self._parents: | |
1299 | yield p |
|
1296 | yield p | |
1300 | for a in self._repo.changelog.ancestors( |
|
1297 | for a in self._repo.changelog.ancestors( | |
1301 | [p.rev() for p in self._parents]): |
|
1298 | [p.rev() for p in self._parents]): | |
1302 | yield changectx(self._repo, a) |
|
1299 | yield changectx(self._repo, a) | |
1303 |
|
1300 | |||
1304 | def markcommitted(self, node): |
|
1301 | def markcommitted(self, node): | |
1305 | """Perform post-commit cleanup necessary after committing this ctx |
|
1302 | """Perform post-commit cleanup necessary after committing this ctx | |
1306 |
|
1303 | |||
1307 | Specifically, this updates backing stores this working context |
|
1304 | Specifically, this updates backing stores this working context | |
1308 | wraps to reflect the fact that the changes reflected by this |
|
1305 | wraps to reflect the fact that the changes reflected by this | |
1309 | workingctx have been committed. For example, it marks |
|
1306 | workingctx have been committed. For example, it marks | |
1310 | modified and added files as normal in the dirstate. |
|
1307 | modified and added files as normal in the dirstate. | |
1311 |
|
1308 | |||
1312 | """ |
|
1309 | """ | |
1313 |
|
1310 | |||
1314 | self._repo.dirstate.beginparentchange() |
|
1311 | self._repo.dirstate.beginparentchange() | |
1315 | for f in self.modified() + self.added(): |
|
1312 | for f in self.modified() + self.added(): | |
1316 | self._repo.dirstate.normal(f) |
|
1313 | self._repo.dirstate.normal(f) | |
1317 | for f in self.removed(): |
|
1314 | for f in self.removed(): | |
1318 | self._repo.dirstate.drop(f) |
|
1315 | self._repo.dirstate.drop(f) | |
1319 | self._repo.dirstate.setparents(node) |
|
1316 | self._repo.dirstate.setparents(node) | |
1320 | self._repo.dirstate.endparentchange() |
|
1317 | self._repo.dirstate.endparentchange() | |
1321 |
|
1318 | |||
1322 | class workingctx(committablectx): |
|
1319 | class workingctx(committablectx): | |
1323 | """A workingctx object makes access to data related to |
|
1320 | """A workingctx object makes access to data related to | |
1324 | the current working directory convenient. |
|
1321 | the current working directory convenient. | |
1325 | date - any valid date string or (unixtime, offset), or None. |
|
1322 | date - any valid date string or (unixtime, offset), or None. | |
1326 | user - username string, or None. |
|
1323 | user - username string, or None. | |
1327 | extra - a dictionary of extra values, or None. |
|
1324 | extra - a dictionary of extra values, or None. | |
1328 | changes - a list of file lists as returned by localrepo.status() |
|
1325 | changes - a list of file lists as returned by localrepo.status() | |
1329 | or None to use the repository status. |
|
1326 | or None to use the repository status. | |
1330 | """ |
|
1327 | """ | |
1331 | def __init__(self, repo, text="", user=None, date=None, extra=None, |
|
1328 | def __init__(self, repo, text="", user=None, date=None, extra=None, | |
1332 | changes=None): |
|
1329 | changes=None): | |
1333 | super(workingctx, self).__init__(repo, text, user, date, extra, changes) |
|
1330 | super(workingctx, self).__init__(repo, text, user, date, extra, changes) | |
1334 |
|
1331 | |||
1335 | def __iter__(self): |
|
1332 | def __iter__(self): | |
1336 | d = self._repo.dirstate |
|
1333 | d = self._repo.dirstate | |
1337 | for f in d: |
|
1334 | for f in d: | |
1338 | if d[f] != 'r': |
|
1335 | if d[f] != 'r': | |
1339 | yield f |
|
1336 | yield f | |
1340 |
|
1337 | |||
1341 | def __contains__(self, key): |
|
1338 | def __contains__(self, key): | |
1342 | return self._repo.dirstate[key] not in "?r" |
|
1339 | return self._repo.dirstate[key] not in "?r" | |
1343 |
|
1340 | |||
1344 | def hex(self): |
|
1341 | def hex(self): | |
1345 | return "ff" * 20 |
|
1342 | return "ff" * 20 | |
1346 |
|
1343 | |||
1347 | @propertycache |
|
1344 | @propertycache | |
1348 | def _parents(self): |
|
1345 | def _parents(self): | |
1349 | p = self._repo.dirstate.parents() |
|
1346 | p = self._repo.dirstate.parents() | |
1350 | if p[1] == nullid: |
|
1347 | if p[1] == nullid: | |
1351 | p = p[:-1] |
|
1348 | p = p[:-1] | |
1352 | return [changectx(self._repo, x) for x in p] |
|
1349 | return [changectx(self._repo, x) for x in p] | |
1353 |
|
1350 | |||
1354 | def filectx(self, path, filelog=None): |
|
1351 | def filectx(self, path, filelog=None): | |
1355 | """get a file context from the working directory""" |
|
1352 | """get a file context from the working directory""" | |
1356 | return workingfilectx(self._repo, path, workingctx=self, |
|
1353 | return workingfilectx(self._repo, path, workingctx=self, | |
1357 | filelog=filelog) |
|
1354 | filelog=filelog) | |
1358 |
|
1355 | |||
1359 | def dirty(self, missing=False, merge=True, branch=True): |
|
1356 | def dirty(self, missing=False, merge=True, branch=True): | |
1360 | "check whether a working directory is modified" |
|
1357 | "check whether a working directory is modified" | |
1361 | # check subrepos first |
|
1358 | # check subrepos first | |
1362 | for s in sorted(self.substate): |
|
1359 | for s in sorted(self.substate): | |
1363 | if self.sub(s).dirty(): |
|
1360 | if self.sub(s).dirty(): | |
1364 | return True |
|
1361 | return True | |
1365 | # check current working dir |
|
1362 | # check current working dir | |
1366 | return ((merge and self.p2()) or |
|
1363 | return ((merge and self.p2()) or | |
1367 | (branch and self.branch() != self.p1().branch()) or |
|
1364 | (branch and self.branch() != self.p1().branch()) or | |
1368 | self.modified() or self.added() or self.removed() or |
|
1365 | self.modified() or self.added() or self.removed() or | |
1369 | (missing and self.deleted())) |
|
1366 | (missing and self.deleted())) | |
1370 |
|
1367 | |||
1371 | def add(self, list, prefix=""): |
|
1368 | def add(self, list, prefix=""): | |
1372 | join = lambda f: os.path.join(prefix, f) |
|
1369 | join = lambda f: os.path.join(prefix, f) | |
1373 | wlock = self._repo.wlock() |
|
1370 | wlock = self._repo.wlock() | |
1374 | ui, ds = self._repo.ui, self._repo.dirstate |
|
1371 | ui, ds = self._repo.ui, self._repo.dirstate | |
1375 | try: |
|
1372 | try: | |
1376 | rejected = [] |
|
1373 | rejected = [] | |
1377 | lstat = self._repo.wvfs.lstat |
|
1374 | lstat = self._repo.wvfs.lstat | |
1378 | for f in list: |
|
1375 | for f in list: | |
1379 | scmutil.checkportable(ui, join(f)) |
|
1376 | scmutil.checkportable(ui, join(f)) | |
1380 | try: |
|
1377 | try: | |
1381 | st = lstat(f) |
|
1378 | st = lstat(f) | |
1382 | except OSError: |
|
1379 | except OSError: | |
1383 | ui.warn(_("%s does not exist!\n") % join(f)) |
|
1380 | ui.warn(_("%s does not exist!\n") % join(f)) | |
1384 | rejected.append(f) |
|
1381 | rejected.append(f) | |
1385 | continue |
|
1382 | continue | |
1386 | if st.st_size > 10000000: |
|
1383 | if st.st_size > 10000000: | |
1387 | 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 " | |
1388 | "to manage this file\n" |
|
1385 | "to manage this file\n" | |
1389 | "(use 'hg revert %s' to cancel the " |
|
1386 | "(use 'hg revert %s' to cancel the " | |
1390 | "pending addition)\n") |
|
1387 | "pending addition)\n") | |
1391 | % (f, 3 * st.st_size // 1000000, join(f))) |
|
1388 | % (f, 3 * st.st_size // 1000000, join(f))) | |
1392 | 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)): | |
1393 | ui.warn(_("%s not added: only files and symlinks " |
|
1390 | ui.warn(_("%s not added: only files and symlinks " | |
1394 | "supported currently\n") % join(f)) |
|
1391 | "supported currently\n") % join(f)) | |
1395 | rejected.append(f) |
|
1392 | rejected.append(f) | |
1396 | elif ds[f] in 'amn': |
|
1393 | elif ds[f] in 'amn': | |
1397 | ui.warn(_("%s already tracked!\n") % join(f)) |
|
1394 | ui.warn(_("%s already tracked!\n") % join(f)) | |
1398 | elif ds[f] == 'r': |
|
1395 | elif ds[f] == 'r': | |
1399 | ds.normallookup(f) |
|
1396 | ds.normallookup(f) | |
1400 | else: |
|
1397 | else: | |
1401 | ds.add(f) |
|
1398 | ds.add(f) | |
1402 | return rejected |
|
1399 | return rejected | |
1403 | finally: |
|
1400 | finally: | |
1404 | wlock.release() |
|
1401 | wlock.release() | |
1405 |
|
1402 | |||
1406 | def forget(self, files, prefix=""): |
|
1403 | def forget(self, files, prefix=""): | |
1407 | join = lambda f: os.path.join(prefix, f) |
|
1404 | join = lambda f: os.path.join(prefix, f) | |
1408 | wlock = self._repo.wlock() |
|
1405 | wlock = self._repo.wlock() | |
1409 | try: |
|
1406 | try: | |
1410 | rejected = [] |
|
1407 | rejected = [] | |
1411 | for f in files: |
|
1408 | for f in files: | |
1412 | if f not in self._repo.dirstate: |
|
1409 | if f not in self._repo.dirstate: | |
1413 | self._repo.ui.warn(_("%s not tracked!\n") % join(f)) |
|
1410 | self._repo.ui.warn(_("%s not tracked!\n") % join(f)) | |
1414 | rejected.append(f) |
|
1411 | rejected.append(f) | |
1415 | elif self._repo.dirstate[f] != 'a': |
|
1412 | elif self._repo.dirstate[f] != 'a': | |
1416 | self._repo.dirstate.remove(f) |
|
1413 | self._repo.dirstate.remove(f) | |
1417 | else: |
|
1414 | else: | |
1418 | self._repo.dirstate.drop(f) |
|
1415 | self._repo.dirstate.drop(f) | |
1419 | return rejected |
|
1416 | return rejected | |
1420 | finally: |
|
1417 | finally: | |
1421 | wlock.release() |
|
1418 | wlock.release() | |
1422 |
|
1419 | |||
1423 | def undelete(self, list): |
|
1420 | def undelete(self, list): | |
1424 | pctxs = self.parents() |
|
1421 | pctxs = self.parents() | |
1425 | wlock = self._repo.wlock() |
|
1422 | wlock = self._repo.wlock() | |
1426 | try: |
|
1423 | try: | |
1427 | for f in list: |
|
1424 | for f in list: | |
1428 | if self._repo.dirstate[f] != 'r': |
|
1425 | if self._repo.dirstate[f] != 'r': | |
1429 | self._repo.ui.warn(_("%s not removed!\n") % f) |
|
1426 | self._repo.ui.warn(_("%s not removed!\n") % f) | |
1430 | else: |
|
1427 | else: | |
1431 | 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] | |
1432 | t = fctx.data() |
|
1429 | t = fctx.data() | |
1433 | self._repo.wwrite(f, t, fctx.flags()) |
|
1430 | self._repo.wwrite(f, t, fctx.flags()) | |
1434 | self._repo.dirstate.normal(f) |
|
1431 | self._repo.dirstate.normal(f) | |
1435 | finally: |
|
1432 | finally: | |
1436 | wlock.release() |
|
1433 | wlock.release() | |
1437 |
|
1434 | |||
1438 | def copy(self, source, dest): |
|
1435 | def copy(self, source, dest): | |
1439 | try: |
|
1436 | try: | |
1440 | st = self._repo.wvfs.lstat(dest) |
|
1437 | st = self._repo.wvfs.lstat(dest) | |
1441 | except OSError as err: |
|
1438 | except OSError as err: | |
1442 | if err.errno != errno.ENOENT: |
|
1439 | if err.errno != errno.ENOENT: | |
1443 | raise |
|
1440 | raise | |
1444 | self._repo.ui.warn(_("%s does not exist!\n") % dest) |
|
1441 | self._repo.ui.warn(_("%s does not exist!\n") % dest) | |
1445 | return |
|
1442 | return | |
1446 | 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)): | |
1447 | 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 " | |
1448 | "symbolic link\n") % dest) |
|
1445 | "symbolic link\n") % dest) | |
1449 | else: |
|
1446 | else: | |
1450 | wlock = self._repo.wlock() |
|
1447 | wlock = self._repo.wlock() | |
1451 | try: |
|
1448 | try: | |
1452 | if self._repo.dirstate[dest] in '?': |
|
1449 | if self._repo.dirstate[dest] in '?': | |
1453 | self._repo.dirstate.add(dest) |
|
1450 | self._repo.dirstate.add(dest) | |
1454 | elif self._repo.dirstate[dest] in 'r': |
|
1451 | elif self._repo.dirstate[dest] in 'r': | |
1455 | self._repo.dirstate.normallookup(dest) |
|
1452 | self._repo.dirstate.normallookup(dest) | |
1456 | self._repo.dirstate.copy(source, dest) |
|
1453 | self._repo.dirstate.copy(source, dest) | |
1457 | finally: |
|
1454 | finally: | |
1458 | wlock.release() |
|
1455 | wlock.release() | |
1459 |
|
1456 | |||
1460 | def match(self, pats=[], include=None, exclude=None, default='glob', |
|
1457 | def match(self, pats=[], include=None, exclude=None, default='glob', | |
1461 | listsubrepos=False, badfn=None): |
|
1458 | listsubrepos=False, badfn=None): | |
1462 | r = self._repo |
|
1459 | r = self._repo | |
1463 |
|
1460 | |||
1464 | # Only a case insensitive filesystem needs magic to translate user input |
|
1461 | # Only a case insensitive filesystem needs magic to translate user input | |
1465 | # to actual case in the filesystem. |
|
1462 | # to actual case in the filesystem. | |
1466 | if not util.checkcase(r.root): |
|
1463 | if not util.checkcase(r.root): | |
1467 | return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, |
|
1464 | return matchmod.icasefsmatcher(r.root, r.getcwd(), pats, include, | |
1468 | exclude, default, r.auditor, self, |
|
1465 | exclude, default, r.auditor, self, | |
1469 | listsubrepos=listsubrepos, |
|
1466 | listsubrepos=listsubrepos, | |
1470 | badfn=badfn) |
|
1467 | badfn=badfn) | |
1471 | return matchmod.match(r.root, r.getcwd(), pats, |
|
1468 | return matchmod.match(r.root, r.getcwd(), pats, | |
1472 | include, exclude, default, |
|
1469 | include, exclude, default, | |
1473 | auditor=r.auditor, ctx=self, |
|
1470 | auditor=r.auditor, ctx=self, | |
1474 | listsubrepos=listsubrepos, badfn=badfn) |
|
1471 | listsubrepos=listsubrepos, badfn=badfn) | |
1475 |
|
1472 | |||
1476 | def _filtersuspectsymlink(self, files): |
|
1473 | def _filtersuspectsymlink(self, files): | |
1477 | if not files or self._repo.dirstate._checklink: |
|
1474 | if not files or self._repo.dirstate._checklink: | |
1478 | return files |
|
1475 | return files | |
1479 |
|
1476 | |||
1480 | # Symlink placeholders may get non-symlink-like contents |
|
1477 | # Symlink placeholders may get non-symlink-like contents | |
1481 | # via user error or dereferencing by NFS or Samba servers, |
|
1478 | # via user error or dereferencing by NFS or Samba servers, | |
1482 | # 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 | |
1483 | # symlink |
|
1480 | # symlink | |
1484 | sane = [] |
|
1481 | sane = [] | |
1485 | for f in files: |
|
1482 | for f in files: | |
1486 | if self.flags(f) == 'l': |
|
1483 | if self.flags(f) == 'l': | |
1487 | d = self[f].data() |
|
1484 | d = self[f].data() | |
1488 | 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): | |
1489 | self._repo.ui.debug('ignoring suspect symlink placeholder' |
|
1486 | self._repo.ui.debug('ignoring suspect symlink placeholder' | |
1490 | ' "%s"\n' % f) |
|
1487 | ' "%s"\n' % f) | |
1491 | continue |
|
1488 | continue | |
1492 | sane.append(f) |
|
1489 | sane.append(f) | |
1493 | return sane |
|
1490 | return sane | |
1494 |
|
1491 | |||
1495 | def _checklookup(self, files): |
|
1492 | def _checklookup(self, files): | |
1496 | # check for any possibly clean files |
|
1493 | # check for any possibly clean files | |
1497 | if not files: |
|
1494 | if not files: | |
1498 | return [], [] |
|
1495 | return [], [] | |
1499 |
|
1496 | |||
1500 | modified = [] |
|
1497 | modified = [] | |
1501 | fixup = [] |
|
1498 | fixup = [] | |
1502 | pctx = self._parents[0] |
|
1499 | pctx = self._parents[0] | |
1503 | # do a full compare of any files that might have changed |
|
1500 | # do a full compare of any files that might have changed | |
1504 | for f in sorted(files): |
|
1501 | for f in sorted(files): | |
1505 | 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) | |
1506 | or pctx[f].cmp(self[f])): |
|
1503 | or pctx[f].cmp(self[f])): | |
1507 | modified.append(f) |
|
1504 | modified.append(f) | |
1508 | else: |
|
1505 | else: | |
1509 | fixup.append(f) |
|
1506 | fixup.append(f) | |
1510 |
|
1507 | |||
1511 | # update dirstate for files that are actually clean |
|
1508 | # update dirstate for files that are actually clean | |
1512 | if fixup: |
|
1509 | if fixup: | |
1513 | try: |
|
1510 | try: | |
1514 | # updating the dirstate is optional |
|
1511 | # updating the dirstate is optional | |
1515 | # so we don't wait on the lock |
|
1512 | # so we don't wait on the lock | |
1516 | # wlock can invalidate the dirstate, so cache normal _after_ |
|
1513 | # wlock can invalidate the dirstate, so cache normal _after_ | |
1517 | # taking the lock |
|
1514 | # taking the lock | |
1518 | wlock = self._repo.wlock(False) |
|
1515 | wlock = self._repo.wlock(False) | |
1519 | normal = self._repo.dirstate.normal |
|
1516 | normal = self._repo.dirstate.normal | |
1520 | try: |
|
1517 | try: | |
1521 | for f in fixup: |
|
1518 | for f in fixup: | |
1522 | normal(f) |
|
1519 | normal(f) | |
1523 | finally: |
|
1520 | finally: | |
1524 | wlock.release() |
|
1521 | wlock.release() | |
1525 | except error.LockError: |
|
1522 | except error.LockError: | |
1526 | pass |
|
1523 | pass | |
1527 | return modified, fixup |
|
1524 | return modified, fixup | |
1528 |
|
1525 | |||
1529 | def _manifestmatches(self, match, s): |
|
1526 | def _manifestmatches(self, match, s): | |
1530 | """Slow path for workingctx |
|
1527 | """Slow path for workingctx | |
1531 |
|
1528 | |||
1532 | The fast path is when we compare the working directory to its parent |
|
1529 | The fast path is when we compare the working directory to its parent | |
1533 | which means this function is comparing with a non-parent; therefore we |
|
1530 | which means this function is comparing with a non-parent; therefore we | |
1534 | need to build a manifest and return what matches. |
|
1531 | need to build a manifest and return what matches. | |
1535 | """ |
|
1532 | """ | |
1536 | mf = self._repo['.']._manifestmatches(match, s) |
|
1533 | mf = self._repo['.']._manifestmatches(match, s) | |
1537 | for f in s.modified + s.added: |
|
1534 | for f in s.modified + s.added: | |
1538 | mf[f] = _newnode |
|
1535 | mf[f] = _newnode | |
1539 | mf.setflag(f, self.flags(f)) |
|
1536 | mf.setflag(f, self.flags(f)) | |
1540 | for f in s.removed: |
|
1537 | for f in s.removed: | |
1541 | if f in mf: |
|
1538 | if f in mf: | |
1542 | del mf[f] |
|
1539 | del mf[f] | |
1543 | return mf |
|
1540 | return mf | |
1544 |
|
1541 | |||
1545 | def _dirstatestatus(self, match=None, ignored=False, clean=False, |
|
1542 | def _dirstatestatus(self, match=None, ignored=False, clean=False, | |
1546 | unknown=False): |
|
1543 | unknown=False): | |
1547 | '''Gets the status from the dirstate -- internal use only.''' |
|
1544 | '''Gets the status from the dirstate -- internal use only.''' | |
1548 | listignored, listclean, listunknown = ignored, clean, unknown |
|
1545 | listignored, listclean, listunknown = ignored, clean, unknown | |
1549 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) |
|
1546 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) | |
1550 | subrepos = [] |
|
1547 | subrepos = [] | |
1551 | if '.hgsub' in self: |
|
1548 | if '.hgsub' in self: | |
1552 | subrepos = sorted(self.substate) |
|
1549 | subrepos = sorted(self.substate) | |
1553 | cmp, s = self._repo.dirstate.status(match, subrepos, listignored, |
|
1550 | cmp, s = self._repo.dirstate.status(match, subrepos, listignored, | |
1554 | listclean, listunknown) |
|
1551 | listclean, listunknown) | |
1555 |
|
1552 | |||
1556 | # check for any possibly clean files |
|
1553 | # check for any possibly clean files | |
1557 | if cmp: |
|
1554 | if cmp: | |
1558 | modified2, fixup = self._checklookup(cmp) |
|
1555 | modified2, fixup = self._checklookup(cmp) | |
1559 | s.modified.extend(modified2) |
|
1556 | s.modified.extend(modified2) | |
1560 |
|
1557 | |||
1561 | # update dirstate for files that are actually clean |
|
1558 | # update dirstate for files that are actually clean | |
1562 | if fixup and listclean: |
|
1559 | if fixup and listclean: | |
1563 | s.clean.extend(fixup) |
|
1560 | s.clean.extend(fixup) | |
1564 |
|
1561 | |||
1565 | if match.always(): |
|
1562 | if match.always(): | |
1566 | # cache for performance |
|
1563 | # cache for performance | |
1567 | if s.unknown or s.ignored or s.clean: |
|
1564 | if s.unknown or s.ignored or s.clean: | |
1568 | # "_status" is cached with list*=False in the normal route |
|
1565 | # "_status" is cached with list*=False in the normal route | |
1569 | self._status = scmutil.status(s.modified, s.added, s.removed, |
|
1566 | self._status = scmutil.status(s.modified, s.added, s.removed, | |
1570 | s.deleted, [], [], []) |
|
1567 | s.deleted, [], [], []) | |
1571 | else: |
|
1568 | else: | |
1572 | self._status = s |
|
1569 | self._status = s | |
1573 |
|
1570 | |||
1574 | return s |
|
1571 | return s | |
1575 |
|
1572 | |||
1576 | def _buildstatus(self, other, s, match, listignored, listclean, |
|
1573 | def _buildstatus(self, other, s, match, listignored, listclean, | |
1577 | listunknown): |
|
1574 | listunknown): | |
1578 | """build a status with respect to another context |
|
1575 | """build a status with respect to another context | |
1579 |
|
1576 | |||
1580 | This includes logic for maintaining the fast path of status when |
|
1577 | This includes logic for maintaining the fast path of status when | |
1581 | comparing the working directory against its parent, which is to skip |
|
1578 | comparing the working directory against its parent, which is to skip | |
1582 | building a new manifest if self (working directory) is not comparing |
|
1579 | building a new manifest if self (working directory) is not comparing | |
1583 | against its parent (repo['.']). |
|
1580 | against its parent (repo['.']). | |
1584 | """ |
|
1581 | """ | |
1585 | s = self._dirstatestatus(match, listignored, listclean, listunknown) |
|
1582 | s = self._dirstatestatus(match, listignored, listclean, listunknown) | |
1586 | # Filter out symlinks that, in the case of FAT32 and NTFS filesystems, |
|
1583 | # Filter out symlinks that, in the case of FAT32 and NTFS filesystems, | |
1587 | # might have accidentally ended up with the entire contents of the file |
|
1584 | # might have accidentally ended up with the entire contents of the file | |
1588 | # they are supposed to be linking to. |
|
1585 | # they are supposed to be linking to. | |
1589 | s.modified[:] = self._filtersuspectsymlink(s.modified) |
|
1586 | s.modified[:] = self._filtersuspectsymlink(s.modified) | |
1590 | if other != self._repo['.']: |
|
1587 | if other != self._repo['.']: | |
1591 | s = super(workingctx, self)._buildstatus(other, s, match, |
|
1588 | s = super(workingctx, self)._buildstatus(other, s, match, | |
1592 | listignored, listclean, |
|
1589 | listignored, listclean, | |
1593 | listunknown) |
|
1590 | listunknown) | |
1594 | return s |
|
1591 | return s | |
1595 |
|
1592 | |||
1596 | def _matchstatus(self, other, match): |
|
1593 | def _matchstatus(self, other, match): | |
1597 | """override the match method with a filter for directory patterns |
|
1594 | """override the match method with a filter for directory patterns | |
1598 |
|
1595 | |||
1599 | We use inheritance to customize the match.bad method only in cases of |
|
1596 | We use inheritance to customize the match.bad method only in cases of | |
1600 | workingctx since it belongs only to the working directory when |
|
1597 | workingctx since it belongs only to the working directory when | |
1601 | comparing against the parent changeset. |
|
1598 | comparing against the parent changeset. | |
1602 |
|
1599 | |||
1603 | If we aren't comparing against the working directory's parent, then we |
|
1600 | If we aren't comparing against the working directory's parent, then we | |
1604 | just use the default match object sent to us. |
|
1601 | just use the default match object sent to us. | |
1605 | """ |
|
1602 | """ | |
1606 | superself = super(workingctx, self) |
|
1603 | superself = super(workingctx, self) | |
1607 | match = superself._matchstatus(other, match) |
|
1604 | match = superself._matchstatus(other, match) | |
1608 | if other != self._repo['.']: |
|
1605 | if other != self._repo['.']: | |
1609 | def bad(f, msg): |
|
1606 | def bad(f, msg): | |
1610 | # 'f' may be a directory pattern from 'match.files()', |
|
1607 | # 'f' may be a directory pattern from 'match.files()', | |
1611 | # so 'f not in ctx1' is not enough |
|
1608 | # so 'f not in ctx1' is not enough | |
1612 | if f not in other and not other.hasdir(f): |
|
1609 | if f not in other and not other.hasdir(f): | |
1613 | self._repo.ui.warn('%s: %s\n' % |
|
1610 | self._repo.ui.warn('%s: %s\n' % | |
1614 | (self._repo.dirstate.pathto(f), msg)) |
|
1611 | (self._repo.dirstate.pathto(f), msg)) | |
1615 | match.bad = bad |
|
1612 | match.bad = bad | |
1616 | return match |
|
1613 | return match | |
1617 |
|
1614 | |||
1618 | class committablefilectx(basefilectx): |
|
1615 | class committablefilectx(basefilectx): | |
1619 | """A committablefilectx provides common functionality for a file context |
|
1616 | """A committablefilectx provides common functionality for a file context | |
1620 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" |
|
1617 | that wants the ability to commit, e.g. workingfilectx or memfilectx.""" | |
1621 | def __init__(self, repo, path, filelog=None, ctx=None): |
|
1618 | def __init__(self, repo, path, filelog=None, ctx=None): | |
1622 | self._repo = repo |
|
1619 | self._repo = repo | |
1623 | self._path = path |
|
1620 | self._path = path | |
1624 | self._changeid = None |
|
1621 | self._changeid = None | |
1625 | self._filerev = self._filenode = None |
|
1622 | self._filerev = self._filenode = None | |
1626 |
|
1623 | |||
1627 | if filelog is not None: |
|
1624 | if filelog is not None: | |
1628 | self._filelog = filelog |
|
1625 | self._filelog = filelog | |
1629 | if ctx: |
|
1626 | if ctx: | |
1630 | self._changectx = ctx |
|
1627 | self._changectx = ctx | |
1631 |
|
1628 | |||
1632 | def __nonzero__(self): |
|
1629 | def __nonzero__(self): | |
1633 | return True |
|
1630 | return True | |
1634 |
|
1631 | |||
1635 | def linkrev(self): |
|
1632 | def linkrev(self): | |
1636 | # linked to self._changectx no matter if file is modified or not |
|
1633 | # linked to self._changectx no matter if file is modified or not | |
1637 | return self.rev() |
|
1634 | return self.rev() | |
1638 |
|
1635 | |||
1639 | def parents(self): |
|
1636 | def parents(self): | |
1640 | '''return parent filectxs, following copies if necessary''' |
|
1637 | '''return parent filectxs, following copies if necessary''' | |
1641 | def filenode(ctx, path): |
|
1638 | def filenode(ctx, path): | |
1642 | return ctx._manifest.get(path, nullid) |
|
1639 | return ctx._manifest.get(path, nullid) | |
1643 |
|
1640 | |||
1644 | path = self._path |
|
1641 | path = self._path | |
1645 | fl = self._filelog |
|
1642 | fl = self._filelog | |
1646 | pcl = self._changectx._parents |
|
1643 | pcl = self._changectx._parents | |
1647 | renamed = self.renamed() |
|
1644 | renamed = self.renamed() | |
1648 |
|
1645 | |||
1649 | if renamed: |
|
1646 | if renamed: | |
1650 | pl = [renamed + (None,)] |
|
1647 | pl = [renamed + (None,)] | |
1651 | else: |
|
1648 | else: | |
1652 | pl = [(path, filenode(pcl[0], path), fl)] |
|
1649 | pl = [(path, filenode(pcl[0], path), fl)] | |
1653 |
|
1650 | |||
1654 | for pc in pcl[1:]: |
|
1651 | for pc in pcl[1:]: | |
1655 | pl.append((path, filenode(pc, path), fl)) |
|
1652 | pl.append((path, filenode(pc, path), fl)) | |
1656 |
|
1653 | |||
1657 | return [self._parentfilectx(p, fileid=n, filelog=l) |
|
1654 | return [self._parentfilectx(p, fileid=n, filelog=l) | |
1658 | for p, n, l in pl if n != nullid] |
|
1655 | for p, n, l in pl if n != nullid] | |
1659 |
|
1656 | |||
1660 | def children(self): |
|
1657 | def children(self): | |
1661 | return [] |
|
1658 | return [] | |
1662 |
|
1659 | |||
1663 | class workingfilectx(committablefilectx): |
|
1660 | class workingfilectx(committablefilectx): | |
1664 | """A workingfilectx object makes access to data related to a particular |
|
1661 | """A workingfilectx object makes access to data related to a particular | |
1665 | file in the working directory convenient.""" |
|
1662 | file in the working directory convenient.""" | |
1666 | def __init__(self, repo, path, filelog=None, workingctx=None): |
|
1663 | def __init__(self, repo, path, filelog=None, workingctx=None): | |
1667 | super(workingfilectx, self).__init__(repo, path, filelog, workingctx) |
|
1664 | super(workingfilectx, self).__init__(repo, path, filelog, workingctx) | |
1668 |
|
1665 | |||
1669 | @propertycache |
|
1666 | @propertycache | |
1670 | def _changectx(self): |
|
1667 | def _changectx(self): | |
1671 | return workingctx(self._repo) |
|
1668 | return workingctx(self._repo) | |
1672 |
|
1669 | |||
1673 | def data(self): |
|
1670 | def data(self): | |
1674 | return self._repo.wread(self._path) |
|
1671 | return self._repo.wread(self._path) | |
1675 | def renamed(self): |
|
1672 | def renamed(self): | |
1676 | rp = self._repo.dirstate.copied(self._path) |
|
1673 | rp = self._repo.dirstate.copied(self._path) | |
1677 | if not rp: |
|
1674 | if not rp: | |
1678 | return None |
|
1675 | return None | |
1679 | return rp, self._changectx._parents[0]._manifest.get(rp, nullid) |
|
1676 | return rp, self._changectx._parents[0]._manifest.get(rp, nullid) | |
1680 |
|
1677 | |||
1681 | def size(self): |
|
1678 | def size(self): | |
1682 | return self._repo.wvfs.lstat(self._path).st_size |
|
1679 | return self._repo.wvfs.lstat(self._path).st_size | |
1683 | def date(self): |
|
1680 | def date(self): | |
1684 | t, tz = self._changectx.date() |
|
1681 | t, tz = self._changectx.date() | |
1685 | try: |
|
1682 | try: | |
1686 | return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz) |
|
1683 | return (int(self._repo.wvfs.lstat(self._path).st_mtime), tz) | |
1687 | except OSError as err: |
|
1684 | except OSError as err: | |
1688 | if err.errno != errno.ENOENT: |
|
1685 | if err.errno != errno.ENOENT: | |
1689 | raise |
|
1686 | raise | |
1690 | return (t, tz) |
|
1687 | return (t, tz) | |
1691 |
|
1688 | |||
1692 | def cmp(self, fctx): |
|
1689 | def cmp(self, fctx): | |
1693 | """compare with other file context |
|
1690 | """compare with other file context | |
1694 |
|
1691 | |||
1695 | returns True if different than fctx. |
|
1692 | returns True if different than fctx. | |
1696 | """ |
|
1693 | """ | |
1697 | # fctx should be a filectx (not a workingfilectx) |
|
1694 | # fctx should be a filectx (not a workingfilectx) | |
1698 | # invert comparison to reuse the same code path |
|
1695 | # invert comparison to reuse the same code path | |
1699 | return fctx.cmp(self) |
|
1696 | return fctx.cmp(self) | |
1700 |
|
1697 | |||
1701 | def remove(self, ignoremissing=False): |
|
1698 | def remove(self, ignoremissing=False): | |
1702 | """wraps unlink for a repo's working directory""" |
|
1699 | """wraps unlink for a repo's working directory""" | |
1703 | util.unlinkpath(self._repo.wjoin(self._path), ignoremissing) |
|
1700 | util.unlinkpath(self._repo.wjoin(self._path), ignoremissing) | |
1704 |
|
1701 | |||
1705 | def write(self, data, flags): |
|
1702 | def write(self, data, flags): | |
1706 | """wraps repo.wwrite""" |
|
1703 | """wraps repo.wwrite""" | |
1707 | self._repo.wwrite(self._path, data, flags) |
|
1704 | self._repo.wwrite(self._path, data, flags) | |
1708 |
|
1705 | |||
1709 | class workingcommitctx(workingctx): |
|
1706 | class workingcommitctx(workingctx): | |
1710 | """A workingcommitctx object makes access to data related to |
|
1707 | """A workingcommitctx object makes access to data related to | |
1711 | the revision being committed convenient. |
|
1708 | the revision being committed convenient. | |
1712 |
|
1709 | |||
1713 | This hides changes in the working directory, if they aren't |
|
1710 | This hides changes in the working directory, if they aren't | |
1714 | committed in this context. |
|
1711 | committed in this context. | |
1715 | """ |
|
1712 | """ | |
1716 | def __init__(self, repo, changes, |
|
1713 | def __init__(self, repo, changes, | |
1717 | text="", user=None, date=None, extra=None): |
|
1714 | text="", user=None, date=None, extra=None): | |
1718 | super(workingctx, self).__init__(repo, text, user, date, extra, |
|
1715 | super(workingctx, self).__init__(repo, text, user, date, extra, | |
1719 | changes) |
|
1716 | changes) | |
1720 |
|
1717 | |||
1721 | def _dirstatestatus(self, match=None, ignored=False, clean=False, |
|
1718 | def _dirstatestatus(self, match=None, ignored=False, clean=False, | |
1722 | unknown=False): |
|
1719 | unknown=False): | |
1723 | """Return matched files only in ``self._status`` |
|
1720 | """Return matched files only in ``self._status`` | |
1724 |
|
1721 | |||
1725 | Uncommitted files appear "clean" via this context, even if |
|
1722 | Uncommitted files appear "clean" via this context, even if | |
1726 | they aren't actually so in the working directory. |
|
1723 | they aren't actually so in the working directory. | |
1727 | """ |
|
1724 | """ | |
1728 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) |
|
1725 | match = match or matchmod.always(self._repo.root, self._repo.getcwd()) | |
1729 | if clean: |
|
1726 | if clean: | |
1730 | clean = [f for f in self._manifest if f not in self._changedset] |
|
1727 | clean = [f for f in self._manifest if f not in self._changedset] | |
1731 | else: |
|
1728 | else: | |
1732 | clean = [] |
|
1729 | clean = [] | |
1733 | return scmutil.status([f for f in self._status.modified if match(f)], |
|
1730 | return scmutil.status([f for f in self._status.modified if match(f)], | |
1734 | [f for f in self._status.added if match(f)], |
|
1731 | [f for f in self._status.added if match(f)], | |
1735 | [f for f in self._status.removed if match(f)], |
|
1732 | [f for f in self._status.removed if match(f)], | |
1736 | [], [], [], clean) |
|
1733 | [], [], [], clean) | |
1737 |
|
1734 | |||
1738 | @propertycache |
|
1735 | @propertycache | |
1739 | def _changedset(self): |
|
1736 | def _changedset(self): | |
1740 | """Return the set of files changed in this context |
|
1737 | """Return the set of files changed in this context | |
1741 | """ |
|
1738 | """ | |
1742 | changed = set(self._status.modified) |
|
1739 | changed = set(self._status.modified) | |
1743 | changed.update(self._status.added) |
|
1740 | changed.update(self._status.added) | |
1744 | changed.update(self._status.removed) |
|
1741 | changed.update(self._status.removed) | |
1745 | return changed |
|
1742 | return changed | |
1746 |
|
1743 | |||
1747 | class memctx(committablectx): |
|
1744 | class memctx(committablectx): | |
1748 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
|
1745 | """Use memctx to perform in-memory commits via localrepo.commitctx(). | |
1749 |
|
1746 | |||
1750 | Revision information is supplied at initialization time while |
|
1747 | Revision information is supplied at initialization time while | |
1751 | related files data and is made available through a callback |
|
1748 | related files data and is made available through a callback | |
1752 | mechanism. 'repo' is the current localrepo, 'parents' is a |
|
1749 | mechanism. 'repo' is the current localrepo, 'parents' is a | |
1753 | sequence of two parent revisions identifiers (pass None for every |
|
1750 | sequence of two parent revisions identifiers (pass None for every | |
1754 | missing parent), 'text' is the commit message and 'files' lists |
|
1751 | missing parent), 'text' is the commit message and 'files' lists | |
1755 | names of files touched by the revision (normalized and relative to |
|
1752 | names of files touched by the revision (normalized and relative to | |
1756 | repository root). |
|
1753 | repository root). | |
1757 |
|
1754 | |||
1758 | filectxfn(repo, memctx, path) is a callable receiving the |
|
1755 | filectxfn(repo, memctx, path) is a callable receiving the | |
1759 | repository, the current memctx object and the normalized path of |
|
1756 | repository, the current memctx object and the normalized path of | |
1760 | requested file, relative to repository root. It is fired by the |
|
1757 | requested file, relative to repository root. It is fired by the | |
1761 | commit function for every file in 'files', but calls order is |
|
1758 | commit function for every file in 'files', but calls order is | |
1762 | undefined. If the file is available in the revision being |
|
1759 | undefined. If the file is available in the revision being | |
1763 | committed (updated or added), filectxfn returns a memfilectx |
|
1760 | committed (updated or added), filectxfn returns a memfilectx | |
1764 | object. If the file was removed, filectxfn raises an |
|
1761 | object. If the file was removed, filectxfn raises an | |
1765 | IOError. Moved files are represented by marking the source file |
|
1762 | IOError. Moved files are represented by marking the source file | |
1766 | removed and the new file added with copy information (see |
|
1763 | removed and the new file added with copy information (see | |
1767 | memfilectx). |
|
1764 | memfilectx). | |
1768 |
|
1765 | |||
1769 | user receives the committer name and defaults to current |
|
1766 | user receives the committer name and defaults to current | |
1770 | repository username, date is the commit date in any format |
|
1767 | repository username, date is the commit date in any format | |
1771 | supported by util.parsedate() and defaults to current date, extra |
|
1768 | supported by util.parsedate() and defaults to current date, extra | |
1772 | is a dictionary of metadata or is left empty. |
|
1769 | is a dictionary of metadata or is left empty. | |
1773 | """ |
|
1770 | """ | |
1774 |
|
1771 | |||
1775 | # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files. |
|
1772 | # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files. | |
1776 | # Extensions that need to retain compatibility across Mercurial 3.1 can use |
|
1773 | # Extensions that need to retain compatibility across Mercurial 3.1 can use | |
1777 | # this field to determine what to do in filectxfn. |
|
1774 | # this field to determine what to do in filectxfn. | |
1778 | _returnnoneformissingfiles = True |
|
1775 | _returnnoneformissingfiles = True | |
1779 |
|
1776 | |||
1780 | def __init__(self, repo, parents, text, files, filectxfn, user=None, |
|
1777 | def __init__(self, repo, parents, text, files, filectxfn, user=None, | |
1781 | date=None, extra=None, editor=False): |
|
1778 | date=None, extra=None, editor=False): | |
1782 | super(memctx, self).__init__(repo, text, user, date, extra) |
|
1779 | super(memctx, self).__init__(repo, text, user, date, extra) | |
1783 | self._rev = None |
|
1780 | self._rev = None | |
1784 | self._node = None |
|
1781 | self._node = None | |
1785 | parents = [(p or nullid) for p in parents] |
|
1782 | parents = [(p or nullid) for p in parents] | |
1786 | p1, p2 = parents |
|
1783 | p1, p2 = parents | |
1787 | self._parents = [changectx(self._repo, p) for p in (p1, p2)] |
|
1784 | self._parents = [changectx(self._repo, p) for p in (p1, p2)] | |
1788 | files = sorted(set(files)) |
|
1785 | files = sorted(set(files)) | |
1789 | self._files = files |
|
1786 | self._files = files | |
1790 | self.substate = {} |
|
1787 | self.substate = {} | |
1791 |
|
1788 | |||
1792 | # if store is not callable, wrap it in a function |
|
1789 | # if store is not callable, wrap it in a function | |
1793 | if not callable(filectxfn): |
|
1790 | if not callable(filectxfn): | |
1794 | def getfilectx(repo, memctx, path): |
|
1791 | def getfilectx(repo, memctx, path): | |
1795 | fctx = filectxfn[path] |
|
1792 | fctx = filectxfn[path] | |
1796 | # this is weird but apparently we only keep track of one parent |
|
1793 | # this is weird but apparently we only keep track of one parent | |
1797 | # (why not only store that instead of a tuple?) |
|
1794 | # (why not only store that instead of a tuple?) | |
1798 | copied = fctx.renamed() |
|
1795 | copied = fctx.renamed() | |
1799 | if copied: |
|
1796 | if copied: | |
1800 | copied = copied[0] |
|
1797 | copied = copied[0] | |
1801 | return memfilectx(repo, path, fctx.data(), |
|
1798 | return memfilectx(repo, path, fctx.data(), | |
1802 | islink=fctx.islink(), isexec=fctx.isexec(), |
|
1799 | islink=fctx.islink(), isexec=fctx.isexec(), | |
1803 | copied=copied, memctx=memctx) |
|
1800 | copied=copied, memctx=memctx) | |
1804 | self._filectxfn = getfilectx |
|
1801 | self._filectxfn = getfilectx | |
1805 | else: |
|
1802 | else: | |
1806 | # "util.cachefunc" reduces invocation of possibly expensive |
|
1803 | # "util.cachefunc" reduces invocation of possibly expensive | |
1807 | # "filectxfn" for performance (e.g. converting from another VCS) |
|
1804 | # "filectxfn" for performance (e.g. converting from another VCS) | |
1808 | self._filectxfn = util.cachefunc(filectxfn) |
|
1805 | self._filectxfn = util.cachefunc(filectxfn) | |
1809 |
|
1806 | |||
1810 | if extra: |
|
1807 | if extra: | |
1811 | self._extra = extra.copy() |
|
1808 | self._extra = extra.copy() | |
1812 | else: |
|
1809 | else: | |
1813 | self._extra = {} |
|
1810 | self._extra = {} | |
1814 |
|
1811 | |||
1815 | if self._extra.get('branch', '') == '': |
|
1812 | if self._extra.get('branch', '') == '': | |
1816 | self._extra['branch'] = 'default' |
|
1813 | self._extra['branch'] = 'default' | |
1817 |
|
1814 | |||
1818 | if editor: |
|
1815 | if editor: | |
1819 | self._text = editor(self._repo, self, []) |
|
1816 | self._text = editor(self._repo, self, []) | |
1820 | self._repo.savecommitmessage(self._text) |
|
1817 | self._repo.savecommitmessage(self._text) | |
1821 |
|
1818 | |||
1822 | def filectx(self, path, filelog=None): |
|
1819 | def filectx(self, path, filelog=None): | |
1823 | """get a file context from the working directory |
|
1820 | """get a file context from the working directory | |
1824 |
|
1821 | |||
1825 | Returns None if file doesn't exist and should be removed.""" |
|
1822 | Returns None if file doesn't exist and should be removed.""" | |
1826 | return self._filectxfn(self._repo, self, path) |
|
1823 | return self._filectxfn(self._repo, self, path) | |
1827 |
|
1824 | |||
1828 | def commit(self): |
|
1825 | def commit(self): | |
1829 | """commit context to the repo""" |
|
1826 | """commit context to the repo""" | |
1830 | return self._repo.commitctx(self) |
|
1827 | return self._repo.commitctx(self) | |
1831 |
|
1828 | |||
1832 | @propertycache |
|
1829 | @propertycache | |
1833 | def _manifest(self): |
|
1830 | def _manifest(self): | |
1834 | """generate a manifest based on the return values of filectxfn""" |
|
1831 | """generate a manifest based on the return values of filectxfn""" | |
1835 |
|
1832 | |||
1836 | # keep this simple for now; just worry about p1 |
|
1833 | # keep this simple for now; just worry about p1 | |
1837 | pctx = self._parents[0] |
|
1834 | pctx = self._parents[0] | |
1838 | man = pctx.manifest().copy() |
|
1835 | man = pctx.manifest().copy() | |
1839 |
|
1836 | |||
1840 | for f in self._status.modified: |
|
1837 | for f in self._status.modified: | |
1841 | p1node = nullid |
|
1838 | p1node = nullid | |
1842 | p2node = nullid |
|
1839 | p2node = nullid | |
1843 | p = pctx[f].parents() # if file isn't in pctx, check p2? |
|
1840 | p = pctx[f].parents() # if file isn't in pctx, check p2? | |
1844 | if len(p) > 0: |
|
1841 | if len(p) > 0: | |
1845 | p1node = p[0].node() |
|
1842 | p1node = p[0].node() | |
1846 | if len(p) > 1: |
|
1843 | if len(p) > 1: | |
1847 | p2node = p[1].node() |
|
1844 | p2node = p[1].node() | |
1848 | man[f] = revlog.hash(self[f].data(), p1node, p2node) |
|
1845 | man[f] = revlog.hash(self[f].data(), p1node, p2node) | |
1849 |
|
1846 | |||
1850 | for f in self._status.added: |
|
1847 | for f in self._status.added: | |
1851 | man[f] = revlog.hash(self[f].data(), nullid, nullid) |
|
1848 | man[f] = revlog.hash(self[f].data(), nullid, nullid) | |
1852 |
|
1849 | |||
1853 | for f in self._status.removed: |
|
1850 | for f in self._status.removed: | |
1854 | if f in man: |
|
1851 | if f in man: | |
1855 | del man[f] |
|
1852 | del man[f] | |
1856 |
|
1853 | |||
1857 | return man |
|
1854 | return man | |
1858 |
|
1855 | |||
1859 | @propertycache |
|
1856 | @propertycache | |
1860 | def _status(self): |
|
1857 | def _status(self): | |
1861 | """Calculate exact status from ``files`` specified at construction |
|
1858 | """Calculate exact status from ``files`` specified at construction | |
1862 | """ |
|
1859 | """ | |
1863 | man1 = self.p1().manifest() |
|
1860 | man1 = self.p1().manifest() | |
1864 | p2 = self._parents[1] |
|
1861 | p2 = self._parents[1] | |
1865 | # "1 < len(self._parents)" can't be used for checking |
|
1862 | # "1 < len(self._parents)" can't be used for checking | |
1866 | # existence of the 2nd parent, because "memctx._parents" is |
|
1863 | # existence of the 2nd parent, because "memctx._parents" is | |
1867 | # explicitly initialized by the list, of which length is 2. |
|
1864 | # explicitly initialized by the list, of which length is 2. | |
1868 | if p2.node() != nullid: |
|
1865 | if p2.node() != nullid: | |
1869 | man2 = p2.manifest() |
|
1866 | man2 = p2.manifest() | |
1870 | managing = lambda f: f in man1 or f in man2 |
|
1867 | managing = lambda f: f in man1 or f in man2 | |
1871 | else: |
|
1868 | else: | |
1872 | managing = lambda f: f in man1 |
|
1869 | managing = lambda f: f in man1 | |
1873 |
|
1870 | |||
1874 | modified, added, removed = [], [], [] |
|
1871 | modified, added, removed = [], [], [] | |
1875 | for f in self._files: |
|
1872 | for f in self._files: | |
1876 | if not managing(f): |
|
1873 | if not managing(f): | |
1877 | added.append(f) |
|
1874 | added.append(f) | |
1878 | elif self[f]: |
|
1875 | elif self[f]: | |
1879 | modified.append(f) |
|
1876 | modified.append(f) | |
1880 | else: |
|
1877 | else: | |
1881 | removed.append(f) |
|
1878 | removed.append(f) | |
1882 |
|
1879 | |||
1883 | return scmutil.status(modified, added, removed, [], [], [], []) |
|
1880 | return scmutil.status(modified, added, removed, [], [], [], []) | |
1884 |
|
1881 | |||
1885 | class memfilectx(committablefilectx): |
|
1882 | class memfilectx(committablefilectx): | |
1886 | """memfilectx represents an in-memory file to commit. |
|
1883 | """memfilectx represents an in-memory file to commit. | |
1887 |
|
1884 | |||
1888 | See memctx and committablefilectx for more details. |
|
1885 | See memctx and committablefilectx for more details. | |
1889 | """ |
|
1886 | """ | |
1890 | def __init__(self, repo, path, data, islink=False, |
|
1887 | def __init__(self, repo, path, data, islink=False, | |
1891 | isexec=False, copied=None, memctx=None): |
|
1888 | isexec=False, copied=None, memctx=None): | |
1892 | """ |
|
1889 | """ | |
1893 | path is the normalized file path relative to repository root. |
|
1890 | path is the normalized file path relative to repository root. | |
1894 | data is the file content as a string. |
|
1891 | data is the file content as a string. | |
1895 | islink is True if the file is a symbolic link. |
|
1892 | islink is True if the file is a symbolic link. | |
1896 | isexec is True if the file is executable. |
|
1893 | isexec is True if the file is executable. | |
1897 | copied is the source file path if current file was copied in the |
|
1894 | copied is the source file path if current file was copied in the | |
1898 | revision being committed, or None.""" |
|
1895 | revision being committed, or None.""" | |
1899 | super(memfilectx, self).__init__(repo, path, None, memctx) |
|
1896 | super(memfilectx, self).__init__(repo, path, None, memctx) | |
1900 | self._data = data |
|
1897 | self._data = data | |
1901 | self._flags = (islink and 'l' or '') + (isexec and 'x' or '') |
|
1898 | self._flags = (islink and 'l' or '') + (isexec and 'x' or '') | |
1902 | self._copied = None |
|
1899 | self._copied = None | |
1903 | if copied: |
|
1900 | if copied: | |
1904 | self._copied = (copied, nullid) |
|
1901 | self._copied = (copied, nullid) | |
1905 |
|
1902 | |||
1906 | def data(self): |
|
1903 | def data(self): | |
1907 | return self._data |
|
1904 | return self._data | |
1908 | def size(self): |
|
1905 | def size(self): | |
1909 | return len(self.data()) |
|
1906 | return len(self.data()) | |
1910 | def flags(self): |
|
1907 | def flags(self): | |
1911 | return self._flags |
|
1908 | return self._flags | |
1912 | def renamed(self): |
|
1909 | def renamed(self): | |
1913 | return self._copied |
|
1910 | return self._copied | |
1914 |
|
1911 | |||
1915 | def remove(self, ignoremissing=False): |
|
1912 | def remove(self, ignoremissing=False): | |
1916 | """wraps unlink for a repo's working directory""" |
|
1913 | """wraps unlink for a repo's working directory""" | |
1917 | # need to figure out what to do here |
|
1914 | # need to figure out what to do here | |
1918 | del self._changectx[self._path] |
|
1915 | del self._changectx[self._path] | |
1919 |
|
1916 | |||
1920 | def write(self, data, flags): |
|
1917 | def write(self, data, flags): | |
1921 | """wraps repo.wwrite""" |
|
1918 | """wraps repo.wwrite""" | |
1922 | self._data = data |
|
1919 | self._data = data |
@@ -1,2052 +1,2052 | |||||
1 | Log on empty repository: checking consistency |
|
1 | Log on empty repository: checking consistency | |
2 |
|
2 | |||
3 | $ hg init empty |
|
3 | $ hg init empty | |
4 | $ cd empty |
|
4 | $ cd empty | |
5 | $ hg log |
|
5 | $ hg log | |
6 | $ hg log -r 1 |
|
6 | $ hg log -r 1 | |
7 | abort: unknown revision '1'! |
|
7 | abort: unknown revision '1'! | |
8 | [255] |
|
8 | [255] | |
9 | $ hg log -r -1:0 |
|
9 | $ hg log -r -1:0 | |
10 | abort: unknown revision '-1'! |
|
10 | abort: unknown revision '-1'! | |
11 | [255] |
|
11 | [255] | |
12 | $ hg log -r 'branch(name)' |
|
12 | $ hg log -r 'branch(name)' | |
13 | abort: unknown revision 'name'! |
|
13 | abort: unknown revision 'name'! | |
14 | [255] |
|
14 | [255] | |
15 | $ hg log -r null -q |
|
15 | $ hg log -r null -q | |
16 | -1:000000000000 |
|
16 | -1:000000000000 | |
17 |
|
17 | |||
18 | The g is crafted to have 2 filelog topological heads in a linear |
|
18 | The g is crafted to have 2 filelog topological heads in a linear | |
19 | changeset graph |
|
19 | changeset graph | |
20 |
|
20 | |||
21 | $ hg init a |
|
21 | $ hg init a | |
22 | $ cd a |
|
22 | $ cd a | |
23 | $ echo a > a |
|
23 | $ echo a > a | |
24 | $ echo f > f |
|
24 | $ echo f > f | |
25 | $ hg ci -Ama -d '1 0' |
|
25 | $ hg ci -Ama -d '1 0' | |
26 | adding a |
|
26 | adding a | |
27 | adding f |
|
27 | adding f | |
28 |
|
28 | |||
29 | $ hg cp a b |
|
29 | $ hg cp a b | |
30 | $ hg cp f g |
|
30 | $ hg cp f g | |
31 | $ hg ci -mb -d '2 0' |
|
31 | $ hg ci -mb -d '2 0' | |
32 |
|
32 | |||
33 | $ mkdir dir |
|
33 | $ mkdir dir | |
34 | $ hg mv b dir |
|
34 | $ hg mv b dir | |
35 | $ echo g >> g |
|
35 | $ echo g >> g | |
36 | $ echo f >> f |
|
36 | $ echo f >> f | |
37 | $ hg ci -mc -d '3 0' |
|
37 | $ hg ci -mc -d '3 0' | |
38 |
|
38 | |||
39 | $ hg mv a b |
|
39 | $ hg mv a b | |
40 | $ hg cp -f f g |
|
40 | $ hg cp -f f g | |
41 | $ echo a > d |
|
41 | $ echo a > d | |
42 | $ hg add d |
|
42 | $ hg add d | |
43 | $ hg ci -md -d '4 0' |
|
43 | $ hg ci -md -d '4 0' | |
44 |
|
44 | |||
45 | $ hg mv dir/b e |
|
45 | $ hg mv dir/b e | |
46 | $ hg ci -me -d '5 0' |
|
46 | $ hg ci -me -d '5 0' | |
47 |
|
47 | |||
48 | Make sure largefiles doesn't interfere with logging a regular file |
|
48 | Make sure largefiles doesn't interfere with logging a regular file | |
49 | $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles= |
|
49 | $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles= | |
50 | updated patterns: ['.hglf/a', 'a'] |
|
50 | updated patterns: ['.hglf/a', 'a'] | |
51 | 0: a |
|
51 | 0: a | |
52 | $ hg log a |
|
52 | $ hg log a | |
53 | changeset: 0:9161b9aeaf16 |
|
53 | changeset: 0:9161b9aeaf16 | |
54 | user: test |
|
54 | user: test | |
55 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
55 | date: Thu Jan 01 00:00:01 1970 +0000 | |
56 | summary: a |
|
56 | summary: a | |
57 |
|
57 | |||
58 | $ hg log glob:a* |
|
58 | $ hg log glob:a* | |
59 | changeset: 3:2ca5ba701980 |
|
59 | changeset: 3:2ca5ba701980 | |
60 | user: test |
|
60 | user: test | |
61 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
61 | date: Thu Jan 01 00:00:04 1970 +0000 | |
62 | summary: d |
|
62 | summary: d | |
63 |
|
63 | |||
64 | changeset: 0:9161b9aeaf16 |
|
64 | changeset: 0:9161b9aeaf16 | |
65 | user: test |
|
65 | user: test | |
66 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
66 | date: Thu Jan 01 00:00:01 1970 +0000 | |
67 | summary: a |
|
67 | summary: a | |
68 |
|
68 | |||
69 | $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles= |
|
69 | $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles= | |
70 | updated patterns: ['glob:.hglf/a*', 'glob:a*'] |
|
70 | updated patterns: ['glob:.hglf/a*', 'glob:a*'] | |
71 | 3: d |
|
71 | 3: d | |
72 | 0: a |
|
72 | 0: a | |
73 |
|
73 | |||
74 | log on directory |
|
74 | log on directory | |
75 |
|
75 | |||
76 | $ hg log dir |
|
76 | $ hg log dir | |
77 | changeset: 4:7e4639b4691b |
|
77 | changeset: 4:7e4639b4691b | |
78 | tag: tip |
|
78 | tag: tip | |
79 | user: test |
|
79 | user: test | |
80 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
80 | date: Thu Jan 01 00:00:05 1970 +0000 | |
81 | summary: e |
|
81 | summary: e | |
82 |
|
82 | |||
83 | changeset: 2:f8954cd4dc1f |
|
83 | changeset: 2:f8954cd4dc1f | |
84 | user: test |
|
84 | user: test | |
85 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
85 | date: Thu Jan 01 00:00:03 1970 +0000 | |
86 | summary: c |
|
86 | summary: c | |
87 |
|
87 | |||
88 | $ hg log somethingthatdoesntexist dir |
|
88 | $ hg log somethingthatdoesntexist dir | |
89 | changeset: 4:7e4639b4691b |
|
89 | changeset: 4:7e4639b4691b | |
90 | tag: tip |
|
90 | tag: tip | |
91 | user: test |
|
91 | user: test | |
92 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
92 | date: Thu Jan 01 00:00:05 1970 +0000 | |
93 | summary: e |
|
93 | summary: e | |
94 |
|
94 | |||
95 | changeset: 2:f8954cd4dc1f |
|
95 | changeset: 2:f8954cd4dc1f | |
96 | user: test |
|
96 | user: test | |
97 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
97 | date: Thu Jan 01 00:00:03 1970 +0000 | |
98 | summary: c |
|
98 | summary: c | |
99 |
|
99 | |||
100 |
|
100 | |||
101 | -f, non-existent directory |
|
101 | -f, non-existent directory | |
102 |
|
102 | |||
103 | $ hg log -f dir |
|
103 | $ hg log -f dir | |
104 | abort: cannot follow file not in parent revision: "dir" |
|
104 | abort: cannot follow file not in parent revision: "dir" | |
105 | [255] |
|
105 | [255] | |
106 |
|
106 | |||
107 | -f, directory |
|
107 | -f, directory | |
108 |
|
108 | |||
109 | $ hg up -q 3 |
|
109 | $ hg up -q 3 | |
110 | $ hg log -f dir |
|
110 | $ hg log -f dir | |
111 | changeset: 2:f8954cd4dc1f |
|
111 | changeset: 2:f8954cd4dc1f | |
112 | user: test |
|
112 | user: test | |
113 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
113 | date: Thu Jan 01 00:00:03 1970 +0000 | |
114 | summary: c |
|
114 | summary: c | |
115 |
|
115 | |||
116 | -f, directory with --patch |
|
116 | -f, directory with --patch | |
117 |
|
117 | |||
118 | $ hg log -f dir -p |
|
118 | $ hg log -f dir -p | |
119 | changeset: 2:f8954cd4dc1f |
|
119 | changeset: 2:f8954cd4dc1f | |
120 | user: test |
|
120 | user: test | |
121 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
121 | date: Thu Jan 01 00:00:03 1970 +0000 | |
122 | summary: c |
|
122 | summary: c | |
123 |
|
123 | |||
124 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b |
|
124 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b | |
125 | --- /dev/null* (glob) |
|
125 | --- /dev/null* (glob) | |
126 | +++ b/dir/b* (glob) |
|
126 | +++ b/dir/b* (glob) | |
127 | @@ -0,0 +1,1 @@ |
|
127 | @@ -0,0 +1,1 @@ | |
128 | +a |
|
128 | +a | |
129 |
|
129 | |||
130 |
|
130 | |||
131 | -f, pattern |
|
131 | -f, pattern | |
132 |
|
132 | |||
133 | $ hg log -f -I 'dir**' -p |
|
133 | $ hg log -f -I 'dir**' -p | |
134 | changeset: 2:f8954cd4dc1f |
|
134 | changeset: 2:f8954cd4dc1f | |
135 | user: test |
|
135 | user: test | |
136 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
136 | date: Thu Jan 01 00:00:03 1970 +0000 | |
137 | summary: c |
|
137 | summary: c | |
138 |
|
138 | |||
139 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b |
|
139 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b | |
140 | --- /dev/null* (glob) |
|
140 | --- /dev/null* (glob) | |
141 | +++ b/dir/b* (glob) |
|
141 | +++ b/dir/b* (glob) | |
142 | @@ -0,0 +1,1 @@ |
|
142 | @@ -0,0 +1,1 @@ | |
143 | +a |
|
143 | +a | |
144 |
|
144 | |||
145 | $ hg up -q 4 |
|
145 | $ hg up -q 4 | |
146 |
|
146 | |||
147 | -f, a wrong style |
|
147 | -f, a wrong style | |
148 |
|
148 | |||
149 | $ hg log -f -l1 --style something |
|
149 | $ hg log -f -l1 --style something | |
150 | abort: style 'something' not found |
|
150 | abort: style 'something' not found | |
151 | (available styles: bisect, changelog, compact, default, phases, status, xml) |
|
151 | (available styles: bisect, changelog, compact, default, phases, status, xml) | |
152 | [255] |
|
152 | [255] | |
153 |
|
153 | |||
154 | -f, phases style |
|
154 | -f, phases style | |
155 |
|
155 | |||
156 |
|
156 | |||
157 | $ hg log -f -l1 --style phases |
|
157 | $ hg log -f -l1 --style phases | |
158 | changeset: 4:7e4639b4691b |
|
158 | changeset: 4:7e4639b4691b | |
159 | tag: tip |
|
159 | tag: tip | |
160 | phase: draft |
|
160 | phase: draft | |
161 | user: test |
|
161 | user: test | |
162 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
162 | date: Thu Jan 01 00:00:05 1970 +0000 | |
163 | summary: e |
|
163 | summary: e | |
164 |
|
164 | |||
165 |
|
165 | |||
166 | $ hg log -f -l1 --style phases -q |
|
166 | $ hg log -f -l1 --style phases -q | |
167 | 4:7e4639b4691b |
|
167 | 4:7e4639b4691b | |
168 |
|
168 | |||
169 | -f, but no args |
|
169 | -f, but no args | |
170 |
|
170 | |||
171 | $ hg log -f |
|
171 | $ hg log -f | |
172 | changeset: 4:7e4639b4691b |
|
172 | changeset: 4:7e4639b4691b | |
173 | tag: tip |
|
173 | tag: tip | |
174 | user: test |
|
174 | user: test | |
175 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
175 | date: Thu Jan 01 00:00:05 1970 +0000 | |
176 | summary: e |
|
176 | summary: e | |
177 |
|
177 | |||
178 | changeset: 3:2ca5ba701980 |
|
178 | changeset: 3:2ca5ba701980 | |
179 | user: test |
|
179 | user: test | |
180 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
180 | date: Thu Jan 01 00:00:04 1970 +0000 | |
181 | summary: d |
|
181 | summary: d | |
182 |
|
182 | |||
183 | changeset: 2:f8954cd4dc1f |
|
183 | changeset: 2:f8954cd4dc1f | |
184 | user: test |
|
184 | user: test | |
185 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
185 | date: Thu Jan 01 00:00:03 1970 +0000 | |
186 | summary: c |
|
186 | summary: c | |
187 |
|
187 | |||
188 | changeset: 1:d89b0a12d229 |
|
188 | changeset: 1:d89b0a12d229 | |
189 | user: test |
|
189 | user: test | |
190 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
190 | date: Thu Jan 01 00:00:02 1970 +0000 | |
191 | summary: b |
|
191 | summary: b | |
192 |
|
192 | |||
193 | changeset: 0:9161b9aeaf16 |
|
193 | changeset: 0:9161b9aeaf16 | |
194 | user: test |
|
194 | user: test | |
195 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
195 | date: Thu Jan 01 00:00:01 1970 +0000 | |
196 | summary: a |
|
196 | summary: a | |
197 |
|
197 | |||
198 |
|
198 | |||
199 | one rename |
|
199 | one rename | |
200 |
|
200 | |||
201 | $ hg up -q 2 |
|
201 | $ hg up -q 2 | |
202 | $ hg log -vf a |
|
202 | $ hg log -vf a | |
203 | changeset: 0:9161b9aeaf16 |
|
203 | changeset: 0:9161b9aeaf16 | |
204 | user: test |
|
204 | user: test | |
205 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
205 | date: Thu Jan 01 00:00:01 1970 +0000 | |
206 | files: a f |
|
206 | files: a f | |
207 | description: |
|
207 | description: | |
208 | a |
|
208 | a | |
209 |
|
209 | |||
210 |
|
210 | |||
211 |
|
211 | |||
212 | many renames |
|
212 | many renames | |
213 |
|
213 | |||
214 | $ hg up -q tip |
|
214 | $ hg up -q tip | |
215 | $ hg log -vf e |
|
215 | $ hg log -vf e | |
216 | changeset: 4:7e4639b4691b |
|
216 | changeset: 4:7e4639b4691b | |
217 | tag: tip |
|
217 | tag: tip | |
218 | user: test |
|
218 | user: test | |
219 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
219 | date: Thu Jan 01 00:00:05 1970 +0000 | |
220 | files: dir/b e |
|
220 | files: dir/b e | |
221 | description: |
|
221 | description: | |
222 | e |
|
222 | e | |
223 |
|
223 | |||
224 |
|
224 | |||
225 | changeset: 2:f8954cd4dc1f |
|
225 | changeset: 2:f8954cd4dc1f | |
226 | user: test |
|
226 | user: test | |
227 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
227 | date: Thu Jan 01 00:00:03 1970 +0000 | |
228 | files: b dir/b f g |
|
228 | files: b dir/b f g | |
229 | description: |
|
229 | description: | |
230 | c |
|
230 | c | |
231 |
|
231 | |||
232 |
|
232 | |||
233 | changeset: 1:d89b0a12d229 |
|
233 | changeset: 1:d89b0a12d229 | |
234 | user: test |
|
234 | user: test | |
235 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
235 | date: Thu Jan 01 00:00:02 1970 +0000 | |
236 | files: b g |
|
236 | files: b g | |
237 | description: |
|
237 | description: | |
238 | b |
|
238 | b | |
239 |
|
239 | |||
240 |
|
240 | |||
241 | changeset: 0:9161b9aeaf16 |
|
241 | changeset: 0:9161b9aeaf16 | |
242 | user: test |
|
242 | user: test | |
243 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
243 | date: Thu Jan 01 00:00:01 1970 +0000 | |
244 | files: a f |
|
244 | files: a f | |
245 | description: |
|
245 | description: | |
246 | a |
|
246 | a | |
247 |
|
247 | |||
248 |
|
248 | |||
249 |
|
249 | |||
250 |
|
250 | |||
251 | log -pf dir/b |
|
251 | log -pf dir/b | |
252 |
|
252 | |||
253 | $ hg up -q 3 |
|
253 | $ hg up -q 3 | |
254 | $ hg log -pf dir/b |
|
254 | $ hg log -pf dir/b | |
255 | changeset: 2:f8954cd4dc1f |
|
255 | changeset: 2:f8954cd4dc1f | |
256 | user: test |
|
256 | user: test | |
257 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
257 | date: Thu Jan 01 00:00:03 1970 +0000 | |
258 | summary: c |
|
258 | summary: c | |
259 |
|
259 | |||
260 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b |
|
260 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b | |
261 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
261 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
262 | +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000 |
|
262 | +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000 | |
263 | @@ -0,0 +1,1 @@ |
|
263 | @@ -0,0 +1,1 @@ | |
264 | +a |
|
264 | +a | |
265 |
|
265 | |||
266 | changeset: 1:d89b0a12d229 |
|
266 | changeset: 1:d89b0a12d229 | |
267 | user: test |
|
267 | user: test | |
268 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
268 | date: Thu Jan 01 00:00:02 1970 +0000 | |
269 | summary: b |
|
269 | summary: b | |
270 |
|
270 | |||
271 | diff -r 9161b9aeaf16 -r d89b0a12d229 b |
|
271 | diff -r 9161b9aeaf16 -r d89b0a12d229 b | |
272 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
272 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
273 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 |
|
273 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 | |
274 | @@ -0,0 +1,1 @@ |
|
274 | @@ -0,0 +1,1 @@ | |
275 | +a |
|
275 | +a | |
276 |
|
276 | |||
277 | changeset: 0:9161b9aeaf16 |
|
277 | changeset: 0:9161b9aeaf16 | |
278 | user: test |
|
278 | user: test | |
279 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
279 | date: Thu Jan 01 00:00:01 1970 +0000 | |
280 | summary: a |
|
280 | summary: a | |
281 |
|
281 | |||
282 | diff -r 000000000000 -r 9161b9aeaf16 a |
|
282 | diff -r 000000000000 -r 9161b9aeaf16 a | |
283 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
283 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
284 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
284 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |
285 | @@ -0,0 +1,1 @@ |
|
285 | @@ -0,0 +1,1 @@ | |
286 | +a |
|
286 | +a | |
287 |
|
287 | |||
288 |
|
288 | |||
289 | log -pf b inside dir |
|
289 | log -pf b inside dir | |
290 |
|
290 | |||
291 | $ hg --cwd=dir log -pf b |
|
291 | $ hg --cwd=dir log -pf b | |
292 | changeset: 2:f8954cd4dc1f |
|
292 | changeset: 2:f8954cd4dc1f | |
293 | user: test |
|
293 | user: test | |
294 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
294 | date: Thu Jan 01 00:00:03 1970 +0000 | |
295 | summary: c |
|
295 | summary: c | |
296 |
|
296 | |||
297 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b |
|
297 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b | |
298 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
298 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
299 | +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000 |
|
299 | +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000 | |
300 | @@ -0,0 +1,1 @@ |
|
300 | @@ -0,0 +1,1 @@ | |
301 | +a |
|
301 | +a | |
302 |
|
302 | |||
303 | changeset: 1:d89b0a12d229 |
|
303 | changeset: 1:d89b0a12d229 | |
304 | user: test |
|
304 | user: test | |
305 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
305 | date: Thu Jan 01 00:00:02 1970 +0000 | |
306 | summary: b |
|
306 | summary: b | |
307 |
|
307 | |||
308 | diff -r 9161b9aeaf16 -r d89b0a12d229 b |
|
308 | diff -r 9161b9aeaf16 -r d89b0a12d229 b | |
309 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
309 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
310 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 |
|
310 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 | |
311 | @@ -0,0 +1,1 @@ |
|
311 | @@ -0,0 +1,1 @@ | |
312 | +a |
|
312 | +a | |
313 |
|
313 | |||
314 | changeset: 0:9161b9aeaf16 |
|
314 | changeset: 0:9161b9aeaf16 | |
315 | user: test |
|
315 | user: test | |
316 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
316 | date: Thu Jan 01 00:00:01 1970 +0000 | |
317 | summary: a |
|
317 | summary: a | |
318 |
|
318 | |||
319 | diff -r 000000000000 -r 9161b9aeaf16 a |
|
319 | diff -r 000000000000 -r 9161b9aeaf16 a | |
320 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
320 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
321 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
321 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |
322 | @@ -0,0 +1,1 @@ |
|
322 | @@ -0,0 +1,1 @@ | |
323 | +a |
|
323 | +a | |
324 |
|
324 | |||
325 |
|
325 | |||
326 | log -pf, but no args |
|
326 | log -pf, but no args | |
327 |
|
327 | |||
328 | $ hg log -pf |
|
328 | $ hg log -pf | |
329 | changeset: 3:2ca5ba701980 |
|
329 | changeset: 3:2ca5ba701980 | |
330 | user: test |
|
330 | user: test | |
331 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
331 | date: Thu Jan 01 00:00:04 1970 +0000 | |
332 | summary: d |
|
332 | summary: d | |
333 |
|
333 | |||
334 | diff -r f8954cd4dc1f -r 2ca5ba701980 a |
|
334 | diff -r f8954cd4dc1f -r 2ca5ba701980 a | |
335 | --- a/a Thu Jan 01 00:00:03 1970 +0000 |
|
335 | --- a/a Thu Jan 01 00:00:03 1970 +0000 | |
336 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
336 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
337 | @@ -1,1 +0,0 @@ |
|
337 | @@ -1,1 +0,0 @@ | |
338 | -a |
|
338 | -a | |
339 | diff -r f8954cd4dc1f -r 2ca5ba701980 b |
|
339 | diff -r f8954cd4dc1f -r 2ca5ba701980 b | |
340 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
340 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
341 | +++ b/b Thu Jan 01 00:00:04 1970 +0000 |
|
341 | +++ b/b Thu Jan 01 00:00:04 1970 +0000 | |
342 | @@ -0,0 +1,1 @@ |
|
342 | @@ -0,0 +1,1 @@ | |
343 | +a |
|
343 | +a | |
344 | diff -r f8954cd4dc1f -r 2ca5ba701980 d |
|
344 | diff -r f8954cd4dc1f -r 2ca5ba701980 d | |
345 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
345 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
346 | +++ b/d Thu Jan 01 00:00:04 1970 +0000 |
|
346 | +++ b/d Thu Jan 01 00:00:04 1970 +0000 | |
347 | @@ -0,0 +1,1 @@ |
|
347 | @@ -0,0 +1,1 @@ | |
348 | +a |
|
348 | +a | |
349 | diff -r f8954cd4dc1f -r 2ca5ba701980 g |
|
349 | diff -r f8954cd4dc1f -r 2ca5ba701980 g | |
350 | --- a/g Thu Jan 01 00:00:03 1970 +0000 |
|
350 | --- a/g Thu Jan 01 00:00:03 1970 +0000 | |
351 | +++ b/g Thu Jan 01 00:00:04 1970 +0000 |
|
351 | +++ b/g Thu Jan 01 00:00:04 1970 +0000 | |
352 | @@ -1,2 +1,2 @@ |
|
352 | @@ -1,2 +1,2 @@ | |
353 | f |
|
353 | f | |
354 | -g |
|
354 | -g | |
355 | +f |
|
355 | +f | |
356 |
|
356 | |||
357 | changeset: 2:f8954cd4dc1f |
|
357 | changeset: 2:f8954cd4dc1f | |
358 | user: test |
|
358 | user: test | |
359 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
359 | date: Thu Jan 01 00:00:03 1970 +0000 | |
360 | summary: c |
|
360 | summary: c | |
361 |
|
361 | |||
362 | diff -r d89b0a12d229 -r f8954cd4dc1f b |
|
362 | diff -r d89b0a12d229 -r f8954cd4dc1f b | |
363 | --- a/b Thu Jan 01 00:00:02 1970 +0000 |
|
363 | --- a/b Thu Jan 01 00:00:02 1970 +0000 | |
364 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
364 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
365 | @@ -1,1 +0,0 @@ |
|
365 | @@ -1,1 +0,0 @@ | |
366 | -a |
|
366 | -a | |
367 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b |
|
367 | diff -r d89b0a12d229 -r f8954cd4dc1f dir/b | |
368 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
368 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
369 | +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000 |
|
369 | +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000 | |
370 | @@ -0,0 +1,1 @@ |
|
370 | @@ -0,0 +1,1 @@ | |
371 | +a |
|
371 | +a | |
372 | diff -r d89b0a12d229 -r f8954cd4dc1f f |
|
372 | diff -r d89b0a12d229 -r f8954cd4dc1f f | |
373 | --- a/f Thu Jan 01 00:00:02 1970 +0000 |
|
373 | --- a/f Thu Jan 01 00:00:02 1970 +0000 | |
374 | +++ b/f Thu Jan 01 00:00:03 1970 +0000 |
|
374 | +++ b/f Thu Jan 01 00:00:03 1970 +0000 | |
375 | @@ -1,1 +1,2 @@ |
|
375 | @@ -1,1 +1,2 @@ | |
376 | f |
|
376 | f | |
377 | +f |
|
377 | +f | |
378 | diff -r d89b0a12d229 -r f8954cd4dc1f g |
|
378 | diff -r d89b0a12d229 -r f8954cd4dc1f g | |
379 | --- a/g Thu Jan 01 00:00:02 1970 +0000 |
|
379 | --- a/g Thu Jan 01 00:00:02 1970 +0000 | |
380 | +++ b/g Thu Jan 01 00:00:03 1970 +0000 |
|
380 | +++ b/g Thu Jan 01 00:00:03 1970 +0000 | |
381 | @@ -1,1 +1,2 @@ |
|
381 | @@ -1,1 +1,2 @@ | |
382 | f |
|
382 | f | |
383 | +g |
|
383 | +g | |
384 |
|
384 | |||
385 | changeset: 1:d89b0a12d229 |
|
385 | changeset: 1:d89b0a12d229 | |
386 | user: test |
|
386 | user: test | |
387 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
387 | date: Thu Jan 01 00:00:02 1970 +0000 | |
388 | summary: b |
|
388 | summary: b | |
389 |
|
389 | |||
390 | diff -r 9161b9aeaf16 -r d89b0a12d229 b |
|
390 | diff -r 9161b9aeaf16 -r d89b0a12d229 b | |
391 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
391 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
392 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 |
|
392 | +++ b/b Thu Jan 01 00:00:02 1970 +0000 | |
393 | @@ -0,0 +1,1 @@ |
|
393 | @@ -0,0 +1,1 @@ | |
394 | +a |
|
394 | +a | |
395 | diff -r 9161b9aeaf16 -r d89b0a12d229 g |
|
395 | diff -r 9161b9aeaf16 -r d89b0a12d229 g | |
396 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
396 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
397 | +++ b/g Thu Jan 01 00:00:02 1970 +0000 |
|
397 | +++ b/g Thu Jan 01 00:00:02 1970 +0000 | |
398 | @@ -0,0 +1,1 @@ |
|
398 | @@ -0,0 +1,1 @@ | |
399 | +f |
|
399 | +f | |
400 |
|
400 | |||
401 | changeset: 0:9161b9aeaf16 |
|
401 | changeset: 0:9161b9aeaf16 | |
402 | user: test |
|
402 | user: test | |
403 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
403 | date: Thu Jan 01 00:00:01 1970 +0000 | |
404 | summary: a |
|
404 | summary: a | |
405 |
|
405 | |||
406 | diff -r 000000000000 -r 9161b9aeaf16 a |
|
406 | diff -r 000000000000 -r 9161b9aeaf16 a | |
407 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
407 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
408 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 |
|
408 | +++ b/a Thu Jan 01 00:00:01 1970 +0000 | |
409 | @@ -0,0 +1,1 @@ |
|
409 | @@ -0,0 +1,1 @@ | |
410 | +a |
|
410 | +a | |
411 | diff -r 000000000000 -r 9161b9aeaf16 f |
|
411 | diff -r 000000000000 -r 9161b9aeaf16 f | |
412 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
412 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
413 | +++ b/f Thu Jan 01 00:00:01 1970 +0000 |
|
413 | +++ b/f Thu Jan 01 00:00:01 1970 +0000 | |
414 | @@ -0,0 +1,1 @@ |
|
414 | @@ -0,0 +1,1 @@ | |
415 | +f |
|
415 | +f | |
416 |
|
416 | |||
417 |
|
417 | |||
418 | log -vf dir/b |
|
418 | log -vf dir/b | |
419 |
|
419 | |||
420 | $ hg log -vf dir/b |
|
420 | $ hg log -vf dir/b | |
421 | changeset: 2:f8954cd4dc1f |
|
421 | changeset: 2:f8954cd4dc1f | |
422 | user: test |
|
422 | user: test | |
423 | date: Thu Jan 01 00:00:03 1970 +0000 |
|
423 | date: Thu Jan 01 00:00:03 1970 +0000 | |
424 | files: b dir/b f g |
|
424 | files: b dir/b f g | |
425 | description: |
|
425 | description: | |
426 | c |
|
426 | c | |
427 |
|
427 | |||
428 |
|
428 | |||
429 | changeset: 1:d89b0a12d229 |
|
429 | changeset: 1:d89b0a12d229 | |
430 | user: test |
|
430 | user: test | |
431 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
431 | date: Thu Jan 01 00:00:02 1970 +0000 | |
432 | files: b g |
|
432 | files: b g | |
433 | description: |
|
433 | description: | |
434 | b |
|
434 | b | |
435 |
|
435 | |||
436 |
|
436 | |||
437 | changeset: 0:9161b9aeaf16 |
|
437 | changeset: 0:9161b9aeaf16 | |
438 | user: test |
|
438 | user: test | |
439 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
439 | date: Thu Jan 01 00:00:01 1970 +0000 | |
440 | files: a f |
|
440 | files: a f | |
441 | description: |
|
441 | description: | |
442 | a |
|
442 | a | |
443 |
|
443 | |||
444 |
|
444 | |||
445 |
|
445 | |||
446 |
|
446 | |||
447 | -f and multiple filelog heads |
|
447 | -f and multiple filelog heads | |
448 |
|
448 | |||
449 | $ hg up -q 2 |
|
449 | $ hg up -q 2 | |
450 | $ hg log -f g --template '{rev}\n' |
|
450 | $ hg log -f g --template '{rev}\n' | |
451 | 2 |
|
451 | 2 | |
452 | 1 |
|
452 | 1 | |
453 | 0 |
|
453 | 0 | |
454 | $ hg up -q tip |
|
454 | $ hg up -q tip | |
455 | $ hg log -f g --template '{rev}\n' |
|
455 | $ hg log -f g --template '{rev}\n' | |
456 | 3 |
|
456 | 3 | |
457 | 2 |
|
457 | 2 | |
458 | 0 |
|
458 | 0 | |
459 |
|
459 | |||
460 |
|
460 | |||
461 | log copies with --copies |
|
461 | log copies with --copies | |
462 |
|
462 | |||
463 | $ hg log -vC --template '{rev} {file_copies}\n' |
|
463 | $ hg log -vC --template '{rev} {file_copies}\n' | |
464 | 4 e (dir/b) |
|
464 | 4 e (dir/b) | |
465 | 3 b (a)g (f) |
|
465 | 3 b (a)g (f) | |
466 | 2 dir/b (b) |
|
466 | 2 dir/b (b) | |
467 | 1 b (a)g (f) |
|
467 | 1 b (a)g (f) | |
468 | 0 |
|
468 | 0 | |
469 |
|
469 | |||
470 | log copies switch without --copies, with old filecopy template |
|
470 | log copies switch without --copies, with old filecopy template | |
471 |
|
471 | |||
472 | $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n' |
|
472 | $ hg log -v --template '{rev} {file_copies_switch%filecopy}\n' | |
473 | 4 |
|
473 | 4 | |
474 | 3 |
|
474 | 3 | |
475 | 2 |
|
475 | 2 | |
476 | 1 |
|
476 | 1 | |
477 | 0 |
|
477 | 0 | |
478 |
|
478 | |||
479 | log copies switch with --copies |
|
479 | log copies switch with --copies | |
480 |
|
480 | |||
481 | $ hg log -vC --template '{rev} {file_copies_switch}\n' |
|
481 | $ hg log -vC --template '{rev} {file_copies_switch}\n' | |
482 | 4 e (dir/b) |
|
482 | 4 e (dir/b) | |
483 | 3 b (a)g (f) |
|
483 | 3 b (a)g (f) | |
484 | 2 dir/b (b) |
|
484 | 2 dir/b (b) | |
485 | 1 b (a)g (f) |
|
485 | 1 b (a)g (f) | |
486 | 0 |
|
486 | 0 | |
487 |
|
487 | |||
488 |
|
488 | |||
489 | log copies with hardcoded style and with --style=default |
|
489 | log copies with hardcoded style and with --style=default | |
490 |
|
490 | |||
491 | $ hg log -vC -r4 |
|
491 | $ hg log -vC -r4 | |
492 | changeset: 4:7e4639b4691b |
|
492 | changeset: 4:7e4639b4691b | |
493 | tag: tip |
|
493 | tag: tip | |
494 | user: test |
|
494 | user: test | |
495 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
495 | date: Thu Jan 01 00:00:05 1970 +0000 | |
496 | files: dir/b e |
|
496 | files: dir/b e | |
497 | copies: e (dir/b) |
|
497 | copies: e (dir/b) | |
498 | description: |
|
498 | description: | |
499 | e |
|
499 | e | |
500 |
|
500 | |||
501 |
|
501 | |||
502 | $ hg log -vC -r4 --style=default |
|
502 | $ hg log -vC -r4 --style=default | |
503 | changeset: 4:7e4639b4691b |
|
503 | changeset: 4:7e4639b4691b | |
504 | tag: tip |
|
504 | tag: tip | |
505 | user: test |
|
505 | user: test | |
506 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
506 | date: Thu Jan 01 00:00:05 1970 +0000 | |
507 | files: dir/b e |
|
507 | files: dir/b e | |
508 | copies: e (dir/b) |
|
508 | copies: e (dir/b) | |
509 | description: |
|
509 | description: | |
510 | e |
|
510 | e | |
511 |
|
511 | |||
512 |
|
512 | |||
513 | $ hg log -vC -r4 -Tjson |
|
513 | $ hg log -vC -r4 -Tjson | |
514 | [ |
|
514 | [ | |
515 | { |
|
515 | { | |
516 | "rev": 4, |
|
516 | "rev": 4, | |
517 | "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3", |
|
517 | "node": "7e4639b4691b9f84b81036a8d4fb218ce3c5e3a3", | |
518 | "branch": "default", |
|
518 | "branch": "default", | |
519 | "phase": "draft", |
|
519 | "phase": "draft", | |
520 | "user": "test", |
|
520 | "user": "test", | |
521 | "date": [5, 0], |
|
521 | "date": [5, 0], | |
522 | "desc": "e", |
|
522 | "desc": "e", | |
523 | "bookmarks": [], |
|
523 | "bookmarks": [], | |
524 | "tags": ["tip"], |
|
524 | "tags": ["tip"], | |
525 | "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"], |
|
525 | "parents": ["2ca5ba7019804f1f597249caddf22a64d34df0ba"], | |
526 | "files": ["dir/b", "e"], |
|
526 | "files": ["dir/b", "e"], | |
527 | "copies": {"e": "dir/b"} |
|
527 | "copies": {"e": "dir/b"} | |
528 | } |
|
528 | } | |
529 | ] |
|
529 | ] | |
530 |
|
530 | |||
531 | log copies, non-linear manifest |
|
531 | log copies, non-linear manifest | |
532 |
|
532 | |||
533 | $ hg up -C 3 |
|
533 | $ hg up -C 3 | |
534 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
534 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
535 | $ hg mv dir/b e |
|
535 | $ hg mv dir/b e | |
536 | $ echo foo > foo |
|
536 | $ echo foo > foo | |
537 | $ hg ci -Ame2 -d '6 0' |
|
537 | $ hg ci -Ame2 -d '6 0' | |
538 | adding foo |
|
538 | adding foo | |
539 | created new head |
|
539 | created new head | |
540 | $ hg log -v --template '{rev} {file_copies}\n' -r 5 |
|
540 | $ hg log -v --template '{rev} {file_copies}\n' -r 5 | |
541 | 5 e (dir/b) |
|
541 | 5 e (dir/b) | |
542 |
|
542 | |||
543 |
|
543 | |||
544 | log copies, execute bit set |
|
544 | log copies, execute bit set | |
545 |
|
545 | |||
546 | #if execbit |
|
546 | #if execbit | |
547 | $ chmod +x e |
|
547 | $ chmod +x e | |
548 | $ hg ci -me3 -d '7 0' |
|
548 | $ hg ci -me3 -d '7 0' | |
549 | $ hg log -v --template '{rev} {file_copies}\n' -r 6 |
|
549 | $ hg log -v --template '{rev} {file_copies}\n' -r 6 | |
550 | 6 |
|
550 | 6 | |
551 | #endif |
|
551 | #endif | |
552 |
|
552 | |||
553 |
|
553 | |||
554 | log -p d |
|
554 | log -p d | |
555 |
|
555 | |||
556 | $ hg log -pv d |
|
556 | $ hg log -pv d | |
557 | changeset: 3:2ca5ba701980 |
|
557 | changeset: 3:2ca5ba701980 | |
558 | user: test |
|
558 | user: test | |
559 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
559 | date: Thu Jan 01 00:00:04 1970 +0000 | |
560 | files: a b d g |
|
560 | files: a b d g | |
561 | description: |
|
561 | description: | |
562 | d |
|
562 | d | |
563 |
|
563 | |||
564 |
|
564 | |||
565 | diff -r f8954cd4dc1f -r 2ca5ba701980 d |
|
565 | diff -r f8954cd4dc1f -r 2ca5ba701980 d | |
566 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
566 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
567 | +++ b/d Thu Jan 01 00:00:04 1970 +0000 |
|
567 | +++ b/d Thu Jan 01 00:00:04 1970 +0000 | |
568 | @@ -0,0 +1,1 @@ |
|
568 | @@ -0,0 +1,1 @@ | |
569 | +a |
|
569 | +a | |
570 |
|
570 | |||
571 |
|
571 | |||
572 |
|
572 | |||
573 | log --removed file |
|
573 | log --removed file | |
574 |
|
574 | |||
575 | $ hg log --removed -v a |
|
575 | $ hg log --removed -v a | |
576 | changeset: 3:2ca5ba701980 |
|
576 | changeset: 3:2ca5ba701980 | |
577 | user: test |
|
577 | user: test | |
578 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
578 | date: Thu Jan 01 00:00:04 1970 +0000 | |
579 | files: a b d g |
|
579 | files: a b d g | |
580 | description: |
|
580 | description: | |
581 | d |
|
581 | d | |
582 |
|
582 | |||
583 |
|
583 | |||
584 | changeset: 0:9161b9aeaf16 |
|
584 | changeset: 0:9161b9aeaf16 | |
585 | user: test |
|
585 | user: test | |
586 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
586 | date: Thu Jan 01 00:00:01 1970 +0000 | |
587 | files: a f |
|
587 | files: a f | |
588 | description: |
|
588 | description: | |
589 | a |
|
589 | a | |
590 |
|
590 | |||
591 |
|
591 | |||
592 |
|
592 | |||
593 | log --removed revrange file |
|
593 | log --removed revrange file | |
594 |
|
594 | |||
595 | $ hg log --removed -v -r0:2 a |
|
595 | $ hg log --removed -v -r0:2 a | |
596 | changeset: 0:9161b9aeaf16 |
|
596 | changeset: 0:9161b9aeaf16 | |
597 | user: test |
|
597 | user: test | |
598 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
598 | date: Thu Jan 01 00:00:01 1970 +0000 | |
599 | files: a f |
|
599 | files: a f | |
600 | description: |
|
600 | description: | |
601 | a |
|
601 | a | |
602 |
|
602 | |||
603 |
|
603 | |||
604 | $ cd .. |
|
604 | $ cd .. | |
605 |
|
605 | |||
606 | log --follow tests |
|
606 | log --follow tests | |
607 |
|
607 | |||
608 | $ hg init follow |
|
608 | $ hg init follow | |
609 | $ cd follow |
|
609 | $ cd follow | |
610 |
|
610 | |||
611 | $ echo base > base |
|
611 | $ echo base > base | |
612 | $ hg ci -Ambase -d '1 0' |
|
612 | $ hg ci -Ambase -d '1 0' | |
613 | adding base |
|
613 | adding base | |
614 |
|
614 | |||
615 | $ echo r1 >> base |
|
615 | $ echo r1 >> base | |
616 | $ hg ci -Amr1 -d '1 0' |
|
616 | $ hg ci -Amr1 -d '1 0' | |
617 | $ echo r2 >> base |
|
617 | $ echo r2 >> base | |
618 | $ hg ci -Amr2 -d '1 0' |
|
618 | $ hg ci -Amr2 -d '1 0' | |
619 |
|
619 | |||
620 | $ hg up -C 1 |
|
620 | $ hg up -C 1 | |
621 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
621 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
622 | $ echo b1 > b1 |
|
622 | $ echo b1 > b1 | |
623 | $ hg ci -Amb1 -d '1 0' |
|
623 | $ hg ci -Amb1 -d '1 0' | |
624 | adding b1 |
|
624 | adding b1 | |
625 | created new head |
|
625 | created new head | |
626 |
|
626 | |||
627 |
|
627 | |||
628 | log -f |
|
628 | log -f | |
629 |
|
629 | |||
630 | $ hg log -f |
|
630 | $ hg log -f | |
631 | changeset: 3:e62f78d544b4 |
|
631 | changeset: 3:e62f78d544b4 | |
632 | tag: tip |
|
632 | tag: tip | |
633 | parent: 1:3d5bf5654eda |
|
633 | parent: 1:3d5bf5654eda | |
634 | user: test |
|
634 | user: test | |
635 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
635 | date: Thu Jan 01 00:00:01 1970 +0000 | |
636 | summary: b1 |
|
636 | summary: b1 | |
637 |
|
637 | |||
638 | changeset: 1:3d5bf5654eda |
|
638 | changeset: 1:3d5bf5654eda | |
639 | user: test |
|
639 | user: test | |
640 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
640 | date: Thu Jan 01 00:00:01 1970 +0000 | |
641 | summary: r1 |
|
641 | summary: r1 | |
642 |
|
642 | |||
643 | changeset: 0:67e992f2c4f3 |
|
643 | changeset: 0:67e992f2c4f3 | |
644 | user: test |
|
644 | user: test | |
645 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
645 | date: Thu Jan 01 00:00:01 1970 +0000 | |
646 | summary: base |
|
646 | summary: base | |
647 |
|
647 | |||
648 |
|
648 | |||
649 |
|
649 | |||
650 | log -f -r '1 + 4' |
|
650 | log -f -r '1 + 4' | |
651 |
|
651 | |||
652 | $ hg up -C 0 |
|
652 | $ hg up -C 0 | |
653 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
653 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
654 | $ echo b2 > b2 |
|
654 | $ echo b2 > b2 | |
655 | $ hg ci -Amb2 -d '1 0' |
|
655 | $ hg ci -Amb2 -d '1 0' | |
656 | adding b2 |
|
656 | adding b2 | |
657 | created new head |
|
657 | created new head | |
658 | $ hg log -f -r '1 + 4' |
|
658 | $ hg log -f -r '1 + 4' | |
659 | changeset: 4:ddb82e70d1a1 |
|
659 | changeset: 4:ddb82e70d1a1 | |
660 | tag: tip |
|
660 | tag: tip | |
661 | parent: 0:67e992f2c4f3 |
|
661 | parent: 0:67e992f2c4f3 | |
662 | user: test |
|
662 | user: test | |
663 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
663 | date: Thu Jan 01 00:00:01 1970 +0000 | |
664 | summary: b2 |
|
664 | summary: b2 | |
665 |
|
665 | |||
666 | changeset: 1:3d5bf5654eda |
|
666 | changeset: 1:3d5bf5654eda | |
667 | user: test |
|
667 | user: test | |
668 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
668 | date: Thu Jan 01 00:00:01 1970 +0000 | |
669 | summary: r1 |
|
669 | summary: r1 | |
670 |
|
670 | |||
671 | changeset: 0:67e992f2c4f3 |
|
671 | changeset: 0:67e992f2c4f3 | |
672 | user: test |
|
672 | user: test | |
673 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
673 | date: Thu Jan 01 00:00:01 1970 +0000 | |
674 | summary: base |
|
674 | summary: base | |
675 |
|
675 | |||
676 | log -f -r null |
|
676 | log -f -r null | |
677 |
|
677 | |||
678 | $ hg log -f -r null |
|
678 | $ hg log -f -r null | |
679 | changeset: -1:000000000000 |
|
679 | changeset: -1:000000000000 | |
680 | user: |
|
680 | user: | |
681 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
681 | date: Thu Jan 01 00:00:00 1970 +0000 | |
682 |
|
682 | |||
683 | $ hg log -f -r null -G |
|
683 | $ hg log -f -r null -G | |
684 | o changeset: -1:000000000000 |
|
684 | o changeset: -1:000000000000 | |
685 | user: |
|
685 | user: | |
686 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
686 | date: Thu Jan 01 00:00:00 1970 +0000 | |
687 |
|
687 | |||
688 |
|
688 | |||
689 |
|
689 | |||
690 | log -f with null parent |
|
690 | log -f with null parent | |
691 |
|
691 | |||
692 | $ hg up -C null |
|
692 | $ hg up -C null | |
693 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
693 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
694 | $ hg log -f |
|
694 | $ hg log -f | |
695 |
|
695 | |||
696 |
|
696 | |||
697 | log -r . with two parents |
|
697 | log -r . with two parents | |
698 |
|
698 | |||
699 | $ hg up -C 3 |
|
699 | $ hg up -C 3 | |
700 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
700 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
701 | $ hg merge tip |
|
701 | $ hg merge tip | |
702 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
702 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
703 | (branch merge, don't forget to commit) |
|
703 | (branch merge, don't forget to commit) | |
704 | $ hg log -r . |
|
704 | $ hg log -r . | |
705 | changeset: 3:e62f78d544b4 |
|
705 | changeset: 3:e62f78d544b4 | |
706 | parent: 1:3d5bf5654eda |
|
706 | parent: 1:3d5bf5654eda | |
707 | user: test |
|
707 | user: test | |
708 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
708 | date: Thu Jan 01 00:00:01 1970 +0000 | |
709 | summary: b1 |
|
709 | summary: b1 | |
710 |
|
710 | |||
711 |
|
711 | |||
712 |
|
712 | |||
713 | log -r . with one parent |
|
713 | log -r . with one parent | |
714 |
|
714 | |||
715 | $ hg ci -mm12 -d '1 0' |
|
715 | $ hg ci -mm12 -d '1 0' | |
716 | $ hg log -r . |
|
716 | $ hg log -r . | |
717 | changeset: 5:302e9dd6890d |
|
717 | changeset: 5:302e9dd6890d | |
718 | tag: tip |
|
718 | tag: tip | |
719 | parent: 3:e62f78d544b4 |
|
719 | parent: 3:e62f78d544b4 | |
720 | parent: 4:ddb82e70d1a1 |
|
720 | parent: 4:ddb82e70d1a1 | |
721 | user: test |
|
721 | user: test | |
722 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
722 | date: Thu Jan 01 00:00:01 1970 +0000 | |
723 | summary: m12 |
|
723 | summary: m12 | |
724 |
|
724 | |||
725 |
|
725 | |||
726 | $ echo postm >> b1 |
|
726 | $ echo postm >> b1 | |
727 | $ hg ci -Amb1.1 -d'1 0' |
|
727 | $ hg ci -Amb1.1 -d'1 0' | |
728 |
|
728 | |||
729 |
|
729 | |||
730 | log --follow-first |
|
730 | log --follow-first | |
731 |
|
731 | |||
732 | $ hg log --follow-first |
|
732 | $ hg log --follow-first | |
733 | changeset: 6:2404bbcab562 |
|
733 | changeset: 6:2404bbcab562 | |
734 | tag: tip |
|
734 | tag: tip | |
735 | user: test |
|
735 | user: test | |
736 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
736 | date: Thu Jan 01 00:00:01 1970 +0000 | |
737 | summary: b1.1 |
|
737 | summary: b1.1 | |
738 |
|
738 | |||
739 | changeset: 5:302e9dd6890d |
|
739 | changeset: 5:302e9dd6890d | |
740 | parent: 3:e62f78d544b4 |
|
740 | parent: 3:e62f78d544b4 | |
741 | parent: 4:ddb82e70d1a1 |
|
741 | parent: 4:ddb82e70d1a1 | |
742 | user: test |
|
742 | user: test | |
743 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
743 | date: Thu Jan 01 00:00:01 1970 +0000 | |
744 | summary: m12 |
|
744 | summary: m12 | |
745 |
|
745 | |||
746 | changeset: 3:e62f78d544b4 |
|
746 | changeset: 3:e62f78d544b4 | |
747 | parent: 1:3d5bf5654eda |
|
747 | parent: 1:3d5bf5654eda | |
748 | user: test |
|
748 | user: test | |
749 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
749 | date: Thu Jan 01 00:00:01 1970 +0000 | |
750 | summary: b1 |
|
750 | summary: b1 | |
751 |
|
751 | |||
752 | changeset: 1:3d5bf5654eda |
|
752 | changeset: 1:3d5bf5654eda | |
753 | user: test |
|
753 | user: test | |
754 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
754 | date: Thu Jan 01 00:00:01 1970 +0000 | |
755 | summary: r1 |
|
755 | summary: r1 | |
756 |
|
756 | |||
757 | changeset: 0:67e992f2c4f3 |
|
757 | changeset: 0:67e992f2c4f3 | |
758 | user: test |
|
758 | user: test | |
759 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
759 | date: Thu Jan 01 00:00:01 1970 +0000 | |
760 | summary: base |
|
760 | summary: base | |
761 |
|
761 | |||
762 |
|
762 | |||
763 |
|
763 | |||
764 | log -P 2 |
|
764 | log -P 2 | |
765 |
|
765 | |||
766 | $ hg log -P 2 |
|
766 | $ hg log -P 2 | |
767 | changeset: 6:2404bbcab562 |
|
767 | changeset: 6:2404bbcab562 | |
768 | tag: tip |
|
768 | tag: tip | |
769 | user: test |
|
769 | user: test | |
770 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
770 | date: Thu Jan 01 00:00:01 1970 +0000 | |
771 | summary: b1.1 |
|
771 | summary: b1.1 | |
772 |
|
772 | |||
773 | changeset: 5:302e9dd6890d |
|
773 | changeset: 5:302e9dd6890d | |
774 | parent: 3:e62f78d544b4 |
|
774 | parent: 3:e62f78d544b4 | |
775 | parent: 4:ddb82e70d1a1 |
|
775 | parent: 4:ddb82e70d1a1 | |
776 | user: test |
|
776 | user: test | |
777 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
777 | date: Thu Jan 01 00:00:01 1970 +0000 | |
778 | summary: m12 |
|
778 | summary: m12 | |
779 |
|
779 | |||
780 | changeset: 4:ddb82e70d1a1 |
|
780 | changeset: 4:ddb82e70d1a1 | |
781 | parent: 0:67e992f2c4f3 |
|
781 | parent: 0:67e992f2c4f3 | |
782 | user: test |
|
782 | user: test | |
783 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
783 | date: Thu Jan 01 00:00:01 1970 +0000 | |
784 | summary: b2 |
|
784 | summary: b2 | |
785 |
|
785 | |||
786 | changeset: 3:e62f78d544b4 |
|
786 | changeset: 3:e62f78d544b4 | |
787 | parent: 1:3d5bf5654eda |
|
787 | parent: 1:3d5bf5654eda | |
788 | user: test |
|
788 | user: test | |
789 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
789 | date: Thu Jan 01 00:00:01 1970 +0000 | |
790 | summary: b1 |
|
790 | summary: b1 | |
791 |
|
791 | |||
792 |
|
792 | |||
793 |
|
793 | |||
794 | log -r tip -p --git |
|
794 | log -r tip -p --git | |
795 |
|
795 | |||
796 | $ hg log -r tip -p --git |
|
796 | $ hg log -r tip -p --git | |
797 | changeset: 6:2404bbcab562 |
|
797 | changeset: 6:2404bbcab562 | |
798 | tag: tip |
|
798 | tag: tip | |
799 | user: test |
|
799 | user: test | |
800 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
800 | date: Thu Jan 01 00:00:01 1970 +0000 | |
801 | summary: b1.1 |
|
801 | summary: b1.1 | |
802 |
|
802 | |||
803 | diff --git a/b1 b/b1 |
|
803 | diff --git a/b1 b/b1 | |
804 | --- a/b1 |
|
804 | --- a/b1 | |
805 | +++ b/b1 |
|
805 | +++ b/b1 | |
806 | @@ -1,1 +1,2 @@ |
|
806 | @@ -1,1 +1,2 @@ | |
807 | b1 |
|
807 | b1 | |
808 | +postm |
|
808 | +postm | |
809 |
|
809 | |||
810 |
|
810 | |||
811 |
|
811 | |||
812 | log -r "" |
|
812 | log -r "" | |
813 |
|
813 | |||
814 | $ hg log -r '' |
|
814 | $ hg log -r '' | |
815 | hg: parse error: empty query |
|
815 | hg: parse error: empty query | |
816 | [255] |
|
816 | [255] | |
817 |
|
817 | |||
818 | log -r <some unknown node id> |
|
818 | log -r <some unknown node id> | |
819 |
|
819 | |||
820 | $ hg log -r 1000000000000000000000000000000000000000 |
|
820 | $ hg log -r 1000000000000000000000000000000000000000 | |
821 | abort: unknown revision '1000000000000000000000000000000000000000'! |
|
821 | abort: unknown revision '1000000000000000000000000000000000000000'! | |
822 | [255] |
|
822 | [255] | |
823 |
|
823 | |||
824 | log -k r1 |
|
824 | log -k r1 | |
825 |
|
825 | |||
826 | $ hg log -k r1 |
|
826 | $ hg log -k r1 | |
827 | changeset: 1:3d5bf5654eda |
|
827 | changeset: 1:3d5bf5654eda | |
828 | user: test |
|
828 | user: test | |
829 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
829 | date: Thu Jan 01 00:00:01 1970 +0000 | |
830 | summary: r1 |
|
830 | summary: r1 | |
831 |
|
831 | |||
832 | log -p -l2 --color=always |
|
832 | log -p -l2 --color=always | |
833 |
|
833 | |||
834 | $ hg --config extensions.color= --config color.mode=ansi \ |
|
834 | $ hg --config extensions.color= --config color.mode=ansi \ | |
835 | > log -p -l2 --color=always |
|
835 | > log -p -l2 --color=always | |
836 | \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc) |
|
836 | \x1b[0;33mchangeset: 6:2404bbcab562\x1b[0m (esc) | |
837 | tag: tip |
|
837 | tag: tip | |
838 | user: test |
|
838 | user: test | |
839 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
839 | date: Thu Jan 01 00:00:01 1970 +0000 | |
840 | summary: b1.1 |
|
840 | summary: b1.1 | |
841 |
|
841 | |||
842 | \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc) |
|
842 | \x1b[0;1mdiff -r 302e9dd6890d -r 2404bbcab562 b1\x1b[0m (esc) | |
843 | \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc) |
|
843 | \x1b[0;31;1m--- a/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc) | |
844 | \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc) |
|
844 | \x1b[0;32;1m+++ b/b1 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc) | |
845 | \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc) |
|
845 | \x1b[0;35m@@ -1,1 +1,2 @@\x1b[0m (esc) | |
846 | b1 |
|
846 | b1 | |
847 | \x1b[0;32m+postm\x1b[0m (esc) |
|
847 | \x1b[0;32m+postm\x1b[0m (esc) | |
848 |
|
848 | |||
849 | \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc) |
|
849 | \x1b[0;33mchangeset: 5:302e9dd6890d\x1b[0m (esc) | |
850 | parent: 3:e62f78d544b4 |
|
850 | parent: 3:e62f78d544b4 | |
851 | parent: 4:ddb82e70d1a1 |
|
851 | parent: 4:ddb82e70d1a1 | |
852 | user: test |
|
852 | user: test | |
853 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
853 | date: Thu Jan 01 00:00:01 1970 +0000 | |
854 | summary: m12 |
|
854 | summary: m12 | |
855 |
|
855 | |||
856 | \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc) |
|
856 | \x1b[0;1mdiff -r e62f78d544b4 -r 302e9dd6890d b2\x1b[0m (esc) | |
857 | \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc) |
|
857 | \x1b[0;31;1m--- /dev/null Thu Jan 01 00:00:00 1970 +0000\x1b[0m (esc) | |
858 | \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc) |
|
858 | \x1b[0;32;1m+++ b/b2 Thu Jan 01 00:00:01 1970 +0000\x1b[0m (esc) | |
859 | \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc) |
|
859 | \x1b[0;35m@@ -0,0 +1,1 @@\x1b[0m (esc) | |
860 | \x1b[0;32m+b2\x1b[0m (esc) |
|
860 | \x1b[0;32m+b2\x1b[0m (esc) | |
861 |
|
861 | |||
862 |
|
862 | |||
863 |
|
863 | |||
864 | log -r tip --stat |
|
864 | log -r tip --stat | |
865 |
|
865 | |||
866 | $ hg log -r tip --stat |
|
866 | $ hg log -r tip --stat | |
867 | changeset: 6:2404bbcab562 |
|
867 | changeset: 6:2404bbcab562 | |
868 | tag: tip |
|
868 | tag: tip | |
869 | user: test |
|
869 | user: test | |
870 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
870 | date: Thu Jan 01 00:00:01 1970 +0000 | |
871 | summary: b1.1 |
|
871 | summary: b1.1 | |
872 |
|
872 | |||
873 | b1 | 1 + |
|
873 | b1 | 1 + | |
874 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
874 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
875 |
|
875 | |||
876 |
|
876 | |||
877 | $ cd .. |
|
877 | $ cd .. | |
878 |
|
878 | |||
879 |
|
879 | |||
880 | User |
|
880 | User | |
881 |
|
881 | |||
882 | $ hg init usertest |
|
882 | $ hg init usertest | |
883 | $ cd usertest |
|
883 | $ cd usertest | |
884 |
|
884 | |||
885 | $ echo a > a |
|
885 | $ echo a > a | |
886 | $ hg ci -A -m "a" -u "User One <user1@example.org>" |
|
886 | $ hg ci -A -m "a" -u "User One <user1@example.org>" | |
887 | adding a |
|
887 | adding a | |
888 | $ echo b > b |
|
888 | $ echo b > b | |
889 | $ hg ci -A -m "b" -u "User Two <user2@example.org>" |
|
889 | $ hg ci -A -m "b" -u "User Two <user2@example.org>" | |
890 | adding b |
|
890 | adding b | |
891 |
|
891 | |||
892 | $ hg log -u "User One <user1@example.org>" |
|
892 | $ hg log -u "User One <user1@example.org>" | |
893 | changeset: 0:29a4c94f1924 |
|
893 | changeset: 0:29a4c94f1924 | |
894 | user: User One <user1@example.org> |
|
894 | user: User One <user1@example.org> | |
895 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
895 | date: Thu Jan 01 00:00:00 1970 +0000 | |
896 | summary: a |
|
896 | summary: a | |
897 |
|
897 | |||
898 | $ hg log -u "user1" -u "user2" |
|
898 | $ hg log -u "user1" -u "user2" | |
899 | changeset: 1:e834b5e69c0e |
|
899 | changeset: 1:e834b5e69c0e | |
900 | tag: tip |
|
900 | tag: tip | |
901 | user: User Two <user2@example.org> |
|
901 | user: User Two <user2@example.org> | |
902 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
902 | date: Thu Jan 01 00:00:00 1970 +0000 | |
903 | summary: b |
|
903 | summary: b | |
904 |
|
904 | |||
905 | changeset: 0:29a4c94f1924 |
|
905 | changeset: 0:29a4c94f1924 | |
906 | user: User One <user1@example.org> |
|
906 | user: User One <user1@example.org> | |
907 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
907 | date: Thu Jan 01 00:00:00 1970 +0000 | |
908 | summary: a |
|
908 | summary: a | |
909 |
|
909 | |||
910 | $ hg log -u "user3" |
|
910 | $ hg log -u "user3" | |
911 |
|
911 | |||
912 | $ cd .. |
|
912 | $ cd .. | |
913 |
|
913 | |||
914 | $ hg init branches |
|
914 | $ hg init branches | |
915 | $ cd branches |
|
915 | $ cd branches | |
916 |
|
916 | |||
917 | $ echo a > a |
|
917 | $ echo a > a | |
918 | $ hg ci -A -m "commit on default" |
|
918 | $ hg ci -A -m "commit on default" | |
919 | adding a |
|
919 | adding a | |
920 | $ hg branch test |
|
920 | $ hg branch test | |
921 | marked working directory as branch test |
|
921 | marked working directory as branch test | |
922 | (branches are permanent and global, did you want a bookmark?) |
|
922 | (branches are permanent and global, did you want a bookmark?) | |
923 | $ echo b > b |
|
923 | $ echo b > b | |
924 | $ hg ci -A -m "commit on test" |
|
924 | $ hg ci -A -m "commit on test" | |
925 | adding b |
|
925 | adding b | |
926 |
|
926 | |||
927 | $ hg up default |
|
927 | $ hg up default | |
928 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
928 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
929 | $ echo c > c |
|
929 | $ echo c > c | |
930 | $ hg ci -A -m "commit on default" |
|
930 | $ hg ci -A -m "commit on default" | |
931 | adding c |
|
931 | adding c | |
932 | $ hg up test |
|
932 | $ hg up test | |
933 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
933 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
934 | $ echo c > c |
|
934 | $ echo c > c | |
935 | $ hg ci -A -m "commit on test" |
|
935 | $ hg ci -A -m "commit on test" | |
936 | adding c |
|
936 | adding c | |
937 |
|
937 | |||
938 |
|
938 | |||
939 | log -b default |
|
939 | log -b default | |
940 |
|
940 | |||
941 | $ hg log -b default |
|
941 | $ hg log -b default | |
942 | changeset: 2:c3a4f03cc9a7 |
|
942 | changeset: 2:c3a4f03cc9a7 | |
943 | parent: 0:24427303d56f |
|
943 | parent: 0:24427303d56f | |
944 | user: test |
|
944 | user: test | |
945 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
945 | date: Thu Jan 01 00:00:00 1970 +0000 | |
946 | summary: commit on default |
|
946 | summary: commit on default | |
947 |
|
947 | |||
948 | changeset: 0:24427303d56f |
|
948 | changeset: 0:24427303d56f | |
949 | user: test |
|
949 | user: test | |
950 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
950 | date: Thu Jan 01 00:00:00 1970 +0000 | |
951 | summary: commit on default |
|
951 | summary: commit on default | |
952 |
|
952 | |||
953 |
|
953 | |||
954 |
|
954 | |||
955 | log -b test |
|
955 | log -b test | |
956 |
|
956 | |||
957 | $ hg log -b test |
|
957 | $ hg log -b test | |
958 | changeset: 3:f5d8de11c2e2 |
|
958 | changeset: 3:f5d8de11c2e2 | |
959 | branch: test |
|
959 | branch: test | |
960 | tag: tip |
|
960 | tag: tip | |
961 | parent: 1:d32277701ccb |
|
961 | parent: 1:d32277701ccb | |
962 | user: test |
|
962 | user: test | |
963 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
963 | date: Thu Jan 01 00:00:00 1970 +0000 | |
964 | summary: commit on test |
|
964 | summary: commit on test | |
965 |
|
965 | |||
966 | changeset: 1:d32277701ccb |
|
966 | changeset: 1:d32277701ccb | |
967 | branch: test |
|
967 | branch: test | |
968 | user: test |
|
968 | user: test | |
969 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
969 | date: Thu Jan 01 00:00:00 1970 +0000 | |
970 | summary: commit on test |
|
970 | summary: commit on test | |
971 |
|
971 | |||
972 |
|
972 | |||
973 |
|
973 | |||
974 | log -b dummy |
|
974 | log -b dummy | |
975 |
|
975 | |||
976 | $ hg log -b dummy |
|
976 | $ hg log -b dummy | |
977 | abort: unknown revision 'dummy'! |
|
977 | abort: unknown revision 'dummy'! | |
978 | [255] |
|
978 | [255] | |
979 |
|
979 | |||
980 |
|
980 | |||
981 | log -b . |
|
981 | log -b . | |
982 |
|
982 | |||
983 | $ hg log -b . |
|
983 | $ hg log -b . | |
984 | changeset: 3:f5d8de11c2e2 |
|
984 | changeset: 3:f5d8de11c2e2 | |
985 | branch: test |
|
985 | branch: test | |
986 | tag: tip |
|
986 | tag: tip | |
987 | parent: 1:d32277701ccb |
|
987 | parent: 1:d32277701ccb | |
988 | user: test |
|
988 | user: test | |
989 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
989 | date: Thu Jan 01 00:00:00 1970 +0000 | |
990 | summary: commit on test |
|
990 | summary: commit on test | |
991 |
|
991 | |||
992 | changeset: 1:d32277701ccb |
|
992 | changeset: 1:d32277701ccb | |
993 | branch: test |
|
993 | branch: test | |
994 | user: test |
|
994 | user: test | |
995 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
995 | date: Thu Jan 01 00:00:00 1970 +0000 | |
996 | summary: commit on test |
|
996 | summary: commit on test | |
997 |
|
997 | |||
998 |
|
998 | |||
999 |
|
999 | |||
1000 | log -b default -b test |
|
1000 | log -b default -b test | |
1001 |
|
1001 | |||
1002 | $ hg log -b default -b test |
|
1002 | $ hg log -b default -b test | |
1003 | changeset: 3:f5d8de11c2e2 |
|
1003 | changeset: 3:f5d8de11c2e2 | |
1004 | branch: test |
|
1004 | branch: test | |
1005 | tag: tip |
|
1005 | tag: tip | |
1006 | parent: 1:d32277701ccb |
|
1006 | parent: 1:d32277701ccb | |
1007 | user: test |
|
1007 | user: test | |
1008 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1008 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1009 | summary: commit on test |
|
1009 | summary: commit on test | |
1010 |
|
1010 | |||
1011 | changeset: 2:c3a4f03cc9a7 |
|
1011 | changeset: 2:c3a4f03cc9a7 | |
1012 | parent: 0:24427303d56f |
|
1012 | parent: 0:24427303d56f | |
1013 | user: test |
|
1013 | user: test | |
1014 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1014 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1015 | summary: commit on default |
|
1015 | summary: commit on default | |
1016 |
|
1016 | |||
1017 | changeset: 1:d32277701ccb |
|
1017 | changeset: 1:d32277701ccb | |
1018 | branch: test |
|
1018 | branch: test | |
1019 | user: test |
|
1019 | user: test | |
1020 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1020 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1021 | summary: commit on test |
|
1021 | summary: commit on test | |
1022 |
|
1022 | |||
1023 | changeset: 0:24427303d56f |
|
1023 | changeset: 0:24427303d56f | |
1024 | user: test |
|
1024 | user: test | |
1025 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1025 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1026 | summary: commit on default |
|
1026 | summary: commit on default | |
1027 |
|
1027 | |||
1028 |
|
1028 | |||
1029 |
|
1029 | |||
1030 | log -b default -b . |
|
1030 | log -b default -b . | |
1031 |
|
1031 | |||
1032 | $ hg log -b default -b . |
|
1032 | $ hg log -b default -b . | |
1033 | changeset: 3:f5d8de11c2e2 |
|
1033 | changeset: 3:f5d8de11c2e2 | |
1034 | branch: test |
|
1034 | branch: test | |
1035 | tag: tip |
|
1035 | tag: tip | |
1036 | parent: 1:d32277701ccb |
|
1036 | parent: 1:d32277701ccb | |
1037 | user: test |
|
1037 | user: test | |
1038 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1038 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1039 | summary: commit on test |
|
1039 | summary: commit on test | |
1040 |
|
1040 | |||
1041 | changeset: 2:c3a4f03cc9a7 |
|
1041 | changeset: 2:c3a4f03cc9a7 | |
1042 | parent: 0:24427303d56f |
|
1042 | parent: 0:24427303d56f | |
1043 | user: test |
|
1043 | user: test | |
1044 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1044 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1045 | summary: commit on default |
|
1045 | summary: commit on default | |
1046 |
|
1046 | |||
1047 | changeset: 1:d32277701ccb |
|
1047 | changeset: 1:d32277701ccb | |
1048 | branch: test |
|
1048 | branch: test | |
1049 | user: test |
|
1049 | user: test | |
1050 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1050 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1051 | summary: commit on test |
|
1051 | summary: commit on test | |
1052 |
|
1052 | |||
1053 | changeset: 0:24427303d56f |
|
1053 | changeset: 0:24427303d56f | |
1054 | user: test |
|
1054 | user: test | |
1055 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1055 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1056 | summary: commit on default |
|
1056 | summary: commit on default | |
1057 |
|
1057 | |||
1058 |
|
1058 | |||
1059 |
|
1059 | |||
1060 | log -b . -b test |
|
1060 | log -b . -b test | |
1061 |
|
1061 | |||
1062 | $ hg log -b . -b test |
|
1062 | $ hg log -b . -b test | |
1063 | changeset: 3:f5d8de11c2e2 |
|
1063 | changeset: 3:f5d8de11c2e2 | |
1064 | branch: test |
|
1064 | branch: test | |
1065 | tag: tip |
|
1065 | tag: tip | |
1066 | parent: 1:d32277701ccb |
|
1066 | parent: 1:d32277701ccb | |
1067 | user: test |
|
1067 | user: test | |
1068 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1068 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1069 | summary: commit on test |
|
1069 | summary: commit on test | |
1070 |
|
1070 | |||
1071 | changeset: 1:d32277701ccb |
|
1071 | changeset: 1:d32277701ccb | |
1072 | branch: test |
|
1072 | branch: test | |
1073 | user: test |
|
1073 | user: test | |
1074 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1074 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1075 | summary: commit on test |
|
1075 | summary: commit on test | |
1076 |
|
1076 | |||
1077 |
|
1077 | |||
1078 |
|
1078 | |||
1079 | log -b 2 |
|
1079 | log -b 2 | |
1080 |
|
1080 | |||
1081 | $ hg log -b 2 |
|
1081 | $ hg log -b 2 | |
1082 | changeset: 2:c3a4f03cc9a7 |
|
1082 | changeset: 2:c3a4f03cc9a7 | |
1083 | parent: 0:24427303d56f |
|
1083 | parent: 0:24427303d56f | |
1084 | user: test |
|
1084 | user: test | |
1085 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1085 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1086 | summary: commit on default |
|
1086 | summary: commit on default | |
1087 |
|
1087 | |||
1088 | changeset: 0:24427303d56f |
|
1088 | changeset: 0:24427303d56f | |
1089 | user: test |
|
1089 | user: test | |
1090 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1090 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1091 | summary: commit on default |
|
1091 | summary: commit on default | |
1092 |
|
1092 | |||
1093 | #if gettext |
|
1093 | #if gettext | |
1094 |
|
1094 | |||
1095 | Test that all log names are translated (e.g. branches, bookmarks, tags): |
|
1095 | Test that all log names are translated (e.g. branches, bookmarks, tags): | |
1096 |
|
1096 | |||
1097 | $ hg bookmark babar -r tip |
|
1097 | $ hg bookmark babar -r tip | |
1098 |
|
1098 | |||
1099 | $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip |
|
1099 | $ HGENCODING=UTF-8 LANGUAGE=de hg log -r tip | |
1100 | \xc3\x84nderung: 3:f5d8de11c2e2 (esc) |
|
1100 | \xc3\x84nderung: 3:f5d8de11c2e2 (esc) | |
1101 | Zweig: test |
|
1101 | Zweig: test | |
1102 | Lesezeichen: babar |
|
1102 | Lesezeichen: babar | |
1103 | Marke: tip |
|
1103 | Marke: tip | |
1104 | Vorg\xc3\xa4nger: 1:d32277701ccb (esc) |
|
1104 | Vorg\xc3\xa4nger: 1:d32277701ccb (esc) | |
1105 | Nutzer: test |
|
1105 | Nutzer: test | |
1106 | Datum: Thu Jan 01 00:00:00 1970 +0000 |
|
1106 | Datum: Thu Jan 01 00:00:00 1970 +0000 | |
1107 | Zusammenfassung: commit on test |
|
1107 | Zusammenfassung: commit on test | |
1108 |
|
1108 | |||
1109 | $ hg bookmark -d babar |
|
1109 | $ hg bookmark -d babar | |
1110 |
|
1110 | |||
1111 | #endif |
|
1111 | #endif | |
1112 |
|
1112 | |||
1113 | log -p --cwd dir (in subdir) |
|
1113 | log -p --cwd dir (in subdir) | |
1114 |
|
1114 | |||
1115 | $ mkdir dir |
|
1115 | $ mkdir dir | |
1116 | $ hg log -p --cwd dir |
|
1116 | $ hg log -p --cwd dir | |
1117 | changeset: 3:f5d8de11c2e2 |
|
1117 | changeset: 3:f5d8de11c2e2 | |
1118 | branch: test |
|
1118 | branch: test | |
1119 | tag: tip |
|
1119 | tag: tip | |
1120 | parent: 1:d32277701ccb |
|
1120 | parent: 1:d32277701ccb | |
1121 | user: test |
|
1121 | user: test | |
1122 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1122 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1123 | summary: commit on test |
|
1123 | summary: commit on test | |
1124 |
|
1124 | |||
1125 | diff -r d32277701ccb -r f5d8de11c2e2 c |
|
1125 | diff -r d32277701ccb -r f5d8de11c2e2 c | |
1126 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1126 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1127 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 |
|
1127 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 | |
1128 | @@ -0,0 +1,1 @@ |
|
1128 | @@ -0,0 +1,1 @@ | |
1129 | +c |
|
1129 | +c | |
1130 |
|
1130 | |||
1131 | changeset: 2:c3a4f03cc9a7 |
|
1131 | changeset: 2:c3a4f03cc9a7 | |
1132 | parent: 0:24427303d56f |
|
1132 | parent: 0:24427303d56f | |
1133 | user: test |
|
1133 | user: test | |
1134 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1134 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1135 | summary: commit on default |
|
1135 | summary: commit on default | |
1136 |
|
1136 | |||
1137 | diff -r 24427303d56f -r c3a4f03cc9a7 c |
|
1137 | diff -r 24427303d56f -r c3a4f03cc9a7 c | |
1138 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1138 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1139 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 |
|
1139 | +++ b/c Thu Jan 01 00:00:00 1970 +0000 | |
1140 | @@ -0,0 +1,1 @@ |
|
1140 | @@ -0,0 +1,1 @@ | |
1141 | +c |
|
1141 | +c | |
1142 |
|
1142 | |||
1143 | changeset: 1:d32277701ccb |
|
1143 | changeset: 1:d32277701ccb | |
1144 | branch: test |
|
1144 | branch: test | |
1145 | user: test |
|
1145 | user: test | |
1146 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1146 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1147 | summary: commit on test |
|
1147 | summary: commit on test | |
1148 |
|
1148 | |||
1149 | diff -r 24427303d56f -r d32277701ccb b |
|
1149 | diff -r 24427303d56f -r d32277701ccb b | |
1150 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1150 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1151 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
1151 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
1152 | @@ -0,0 +1,1 @@ |
|
1152 | @@ -0,0 +1,1 @@ | |
1153 | +b |
|
1153 | +b | |
1154 |
|
1154 | |||
1155 | changeset: 0:24427303d56f |
|
1155 | changeset: 0:24427303d56f | |
1156 | user: test |
|
1156 | user: test | |
1157 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1157 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1158 | summary: commit on default |
|
1158 | summary: commit on default | |
1159 |
|
1159 | |||
1160 | diff -r 000000000000 -r 24427303d56f a |
|
1160 | diff -r 000000000000 -r 24427303d56f a | |
1161 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1161 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1162 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
1162 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
1163 | @@ -0,0 +1,1 @@ |
|
1163 | @@ -0,0 +1,1 @@ | |
1164 | +a |
|
1164 | +a | |
1165 |
|
1165 | |||
1166 |
|
1166 | |||
1167 |
|
1167 | |||
1168 | log -p -R repo |
|
1168 | log -p -R repo | |
1169 |
|
1169 | |||
1170 | $ cd dir |
|
1170 | $ cd dir | |
1171 | $ hg log -p -R .. ../a |
|
1171 | $ hg log -p -R .. ../a | |
1172 | changeset: 0:24427303d56f |
|
1172 | changeset: 0:24427303d56f | |
1173 | user: test |
|
1173 | user: test | |
1174 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1174 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1175 | summary: commit on default |
|
1175 | summary: commit on default | |
1176 |
|
1176 | |||
1177 | diff -r 000000000000 -r 24427303d56f a |
|
1177 | diff -r 000000000000 -r 24427303d56f a | |
1178 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1178 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1179 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
1179 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
1180 | @@ -0,0 +1,1 @@ |
|
1180 | @@ -0,0 +1,1 @@ | |
1181 | +a |
|
1181 | +a | |
1182 |
|
1182 | |||
1183 |
|
1183 | |||
1184 | $ cd ../.. |
|
1184 | $ cd ../.. | |
1185 |
|
1185 | |||
1186 | $ hg init follow2 |
|
1186 | $ hg init follow2 | |
1187 | $ cd follow2 |
|
1187 | $ cd follow2 | |
1188 |
|
1188 | |||
1189 | # Build the following history: |
|
1189 | # Build the following history: | |
1190 | # tip - o - x - o - x - x |
|
1190 | # tip - o - x - o - x - x | |
1191 | # \ / |
|
1191 | # \ / | |
1192 | # o - o - o - x |
|
1192 | # o - o - o - x | |
1193 | # \ / |
|
1193 | # \ / | |
1194 | # o |
|
1194 | # o | |
1195 | # |
|
1195 | # | |
1196 | # Where "o" is a revision containing "foo" and |
|
1196 | # Where "o" is a revision containing "foo" and | |
1197 | # "x" is a revision without "foo" |
|
1197 | # "x" is a revision without "foo" | |
1198 |
|
1198 | |||
1199 | $ touch init |
|
1199 | $ touch init | |
1200 | $ hg ci -A -m "init, unrelated" |
|
1200 | $ hg ci -A -m "init, unrelated" | |
1201 | adding init |
|
1201 | adding init | |
1202 | $ echo 'foo' > init |
|
1202 | $ echo 'foo' > init | |
1203 | $ hg ci -m "change, unrelated" |
|
1203 | $ hg ci -m "change, unrelated" | |
1204 | $ echo 'foo' > foo |
|
1204 | $ echo 'foo' > foo | |
1205 | $ hg ci -A -m "add unrelated old foo" |
|
1205 | $ hg ci -A -m "add unrelated old foo" | |
1206 | adding foo |
|
1206 | adding foo | |
1207 | $ hg rm foo |
|
1207 | $ hg rm foo | |
1208 | $ hg ci -m "delete foo, unrelated" |
|
1208 | $ hg ci -m "delete foo, unrelated" | |
1209 | $ echo 'related' > foo |
|
1209 | $ echo 'related' > foo | |
1210 | $ hg ci -A -m "add foo, related" |
|
1210 | $ hg ci -A -m "add foo, related" | |
1211 | adding foo |
|
1211 | adding foo | |
1212 |
|
1212 | |||
1213 | $ hg up 0 |
|
1213 | $ hg up 0 | |
1214 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1214 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1215 | $ touch branch |
|
1215 | $ touch branch | |
1216 | $ hg ci -A -m "first branch, unrelated" |
|
1216 | $ hg ci -A -m "first branch, unrelated" | |
1217 | adding branch |
|
1217 | adding branch | |
1218 | created new head |
|
1218 | created new head | |
1219 | $ touch foo |
|
1219 | $ touch foo | |
1220 | $ hg ci -A -m "create foo, related" |
|
1220 | $ hg ci -A -m "create foo, related" | |
1221 | adding foo |
|
1221 | adding foo | |
1222 | $ echo 'change' > foo |
|
1222 | $ echo 'change' > foo | |
1223 | $ hg ci -m "change foo, related" |
|
1223 | $ hg ci -m "change foo, related" | |
1224 |
|
1224 | |||
1225 | $ hg up 6 |
|
1225 | $ hg up 6 | |
1226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1226 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1227 | $ echo 'change foo in branch' > foo |
|
1227 | $ echo 'change foo in branch' > foo | |
1228 | $ hg ci -m "change foo in branch, related" |
|
1228 | $ hg ci -m "change foo in branch, related" | |
1229 | created new head |
|
1229 | created new head | |
1230 | $ hg merge 7 |
|
1230 | $ hg merge 7 | |
1231 | merging foo |
|
1231 | merging foo | |
1232 | warning: conflicts during merge. |
|
1232 | warning: conflicts during merge. | |
1233 | merging foo incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
1233 | merging foo incomplete! (edit conflicts, then use 'hg resolve --mark') | |
1234 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1234 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1235 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
1235 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
1236 | [1] |
|
1236 | [1] | |
1237 | $ echo 'merge 1' > foo |
|
1237 | $ echo 'merge 1' > foo | |
1238 | $ hg resolve -m foo |
|
1238 | $ hg resolve -m foo | |
1239 | (no more unresolved files) |
|
1239 | (no more unresolved files) | |
1240 | $ hg ci -m "First merge, related" |
|
1240 | $ hg ci -m "First merge, related" | |
1241 |
|
1241 | |||
1242 | $ hg merge 4 |
|
1242 | $ hg merge 4 | |
1243 | merging foo |
|
1243 | merging foo | |
1244 | warning: conflicts during merge. |
|
1244 | warning: conflicts during merge. | |
1245 | merging foo incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
1245 | merging foo incomplete! (edit conflicts, then use 'hg resolve --mark') | |
1246 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
1246 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
1247 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
1247 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
1248 | [1] |
|
1248 | [1] | |
1249 | $ echo 'merge 2' > foo |
|
1249 | $ echo 'merge 2' > foo | |
1250 | $ hg resolve -m foo |
|
1250 | $ hg resolve -m foo | |
1251 | (no more unresolved files) |
|
1251 | (no more unresolved files) | |
1252 | $ hg ci -m "Last merge, related" |
|
1252 | $ hg ci -m "Last merge, related" | |
1253 |
|
1253 | |||
1254 | $ hg log --graph |
|
1254 | $ hg log --graph | |
1255 | @ changeset: 10:4dae8563d2c5 |
|
1255 | @ changeset: 10:4dae8563d2c5 | |
1256 | |\ tag: tip |
|
1256 | |\ tag: tip | |
1257 | | | parent: 9:7b35701b003e |
|
1257 | | | parent: 9:7b35701b003e | |
1258 | | | parent: 4:88176d361b69 |
|
1258 | | | parent: 4:88176d361b69 | |
1259 | | | user: test |
|
1259 | | | user: test | |
1260 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1260 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1261 | | | summary: Last merge, related |
|
1261 | | | summary: Last merge, related | |
1262 | | | |
|
1262 | | | | |
1263 | | o changeset: 9:7b35701b003e |
|
1263 | | o changeset: 9:7b35701b003e | |
1264 | | |\ parent: 8:e5416ad8a855 |
|
1264 | | |\ parent: 8:e5416ad8a855 | |
1265 | | | | parent: 7:87fe3144dcfa |
|
1265 | | | | parent: 7:87fe3144dcfa | |
1266 | | | | user: test |
|
1266 | | | | user: test | |
1267 | | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1267 | | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1268 | | | | summary: First merge, related |
|
1268 | | | | summary: First merge, related | |
1269 | | | | |
|
1269 | | | | | |
1270 | | | o changeset: 8:e5416ad8a855 |
|
1270 | | | o changeset: 8:e5416ad8a855 | |
1271 | | | | parent: 6:dc6c325fe5ee |
|
1271 | | | | parent: 6:dc6c325fe5ee | |
1272 | | | | user: test |
|
1272 | | | | user: test | |
1273 | | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1273 | | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1274 | | | | summary: change foo in branch, related |
|
1274 | | | | summary: change foo in branch, related | |
1275 | | | | |
|
1275 | | | | | |
1276 | | o | changeset: 7:87fe3144dcfa |
|
1276 | | o | changeset: 7:87fe3144dcfa | |
1277 | | |/ user: test |
|
1277 | | |/ user: test | |
1278 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1278 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1279 | | | summary: change foo, related |
|
1279 | | | summary: change foo, related | |
1280 | | | |
|
1280 | | | | |
1281 | | o changeset: 6:dc6c325fe5ee |
|
1281 | | o changeset: 6:dc6c325fe5ee | |
1282 | | | user: test |
|
1282 | | | user: test | |
1283 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1283 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1284 | | | summary: create foo, related |
|
1284 | | | summary: create foo, related | |
1285 | | | |
|
1285 | | | | |
1286 | | o changeset: 5:73db34516eb9 |
|
1286 | | o changeset: 5:73db34516eb9 | |
1287 | | | parent: 0:e87515fd044a |
|
1287 | | | parent: 0:e87515fd044a | |
1288 | | | user: test |
|
1288 | | | user: test | |
1289 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1289 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1290 | | | summary: first branch, unrelated |
|
1290 | | | summary: first branch, unrelated | |
1291 | | | |
|
1291 | | | | |
1292 | o | changeset: 4:88176d361b69 |
|
1292 | o | changeset: 4:88176d361b69 | |
1293 | | | user: test |
|
1293 | | | user: test | |
1294 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1294 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1295 | | | summary: add foo, related |
|
1295 | | | summary: add foo, related | |
1296 | | | |
|
1296 | | | | |
1297 | o | changeset: 3:dd78ae4afb56 |
|
1297 | o | changeset: 3:dd78ae4afb56 | |
1298 | | | user: test |
|
1298 | | | user: test | |
1299 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1299 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1300 | | | summary: delete foo, unrelated |
|
1300 | | | summary: delete foo, unrelated | |
1301 | | | |
|
1301 | | | | |
1302 | o | changeset: 2:c4c64aedf0f7 |
|
1302 | o | changeset: 2:c4c64aedf0f7 | |
1303 | | | user: test |
|
1303 | | | user: test | |
1304 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1304 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1305 | | | summary: add unrelated old foo |
|
1305 | | | summary: add unrelated old foo | |
1306 | | | |
|
1306 | | | | |
1307 | o | changeset: 1:e5faa7440653 |
|
1307 | o | changeset: 1:e5faa7440653 | |
1308 | |/ user: test |
|
1308 | |/ user: test | |
1309 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1309 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1310 | | summary: change, unrelated |
|
1310 | | summary: change, unrelated | |
1311 | | |
|
1311 | | | |
1312 | o changeset: 0:e87515fd044a |
|
1312 | o changeset: 0:e87515fd044a | |
1313 | user: test |
|
1313 | user: test | |
1314 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1314 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1315 | summary: init, unrelated |
|
1315 | summary: init, unrelated | |
1316 |
|
1316 | |||
1317 |
|
1317 | |||
1318 | $ hg --traceback log -f foo |
|
1318 | $ hg --traceback log -f foo | |
1319 | changeset: 10:4dae8563d2c5 |
|
1319 | changeset: 10:4dae8563d2c5 | |
1320 | tag: tip |
|
1320 | tag: tip | |
1321 | parent: 9:7b35701b003e |
|
1321 | parent: 9:7b35701b003e | |
1322 | parent: 4:88176d361b69 |
|
1322 | parent: 4:88176d361b69 | |
1323 | user: test |
|
1323 | user: test | |
1324 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1324 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1325 | summary: Last merge, related |
|
1325 | summary: Last merge, related | |
1326 |
|
1326 | |||
1327 | changeset: 9:7b35701b003e |
|
1327 | changeset: 9:7b35701b003e | |
1328 | parent: 8:e5416ad8a855 |
|
1328 | parent: 8:e5416ad8a855 | |
1329 | parent: 7:87fe3144dcfa |
|
1329 | parent: 7:87fe3144dcfa | |
1330 | user: test |
|
1330 | user: test | |
1331 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1331 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1332 | summary: First merge, related |
|
1332 | summary: First merge, related | |
1333 |
|
1333 | |||
1334 | changeset: 8:e5416ad8a855 |
|
1334 | changeset: 8:e5416ad8a855 | |
1335 | parent: 6:dc6c325fe5ee |
|
1335 | parent: 6:dc6c325fe5ee | |
1336 | user: test |
|
1336 | user: test | |
1337 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1337 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1338 | summary: change foo in branch, related |
|
1338 | summary: change foo in branch, related | |
1339 |
|
1339 | |||
1340 | changeset: 7:87fe3144dcfa |
|
1340 | changeset: 7:87fe3144dcfa | |
1341 | user: test |
|
1341 | user: test | |
1342 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1342 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1343 | summary: change foo, related |
|
1343 | summary: change foo, related | |
1344 |
|
1344 | |||
1345 | changeset: 6:dc6c325fe5ee |
|
1345 | changeset: 6:dc6c325fe5ee | |
1346 | user: test |
|
1346 | user: test | |
1347 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1347 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1348 | summary: create foo, related |
|
1348 | summary: create foo, related | |
1349 |
|
1349 | |||
1350 | changeset: 4:88176d361b69 |
|
1350 | changeset: 4:88176d361b69 | |
1351 | user: test |
|
1351 | user: test | |
1352 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1352 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1353 | summary: add foo, related |
|
1353 | summary: add foo, related | |
1354 |
|
1354 | |||
1355 |
|
1355 | |||
1356 | Also check when maxrev < lastrevfilelog |
|
1356 | Also check when maxrev < lastrevfilelog | |
1357 |
|
1357 | |||
1358 | $ hg --traceback log -f -r4 foo |
|
1358 | $ hg --traceback log -f -r4 foo | |
1359 | changeset: 4:88176d361b69 |
|
1359 | changeset: 4:88176d361b69 | |
1360 | user: test |
|
1360 | user: test | |
1361 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1361 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1362 | summary: add foo, related |
|
1362 | summary: add foo, related | |
1363 |
|
1363 | |||
1364 | changeset: 2:c4c64aedf0f7 |
|
1364 | changeset: 2:c4c64aedf0f7 | |
1365 | user: test |
|
1365 | user: test | |
1366 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1366 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1367 | summary: add unrelated old foo |
|
1367 | summary: add unrelated old foo | |
1368 |
|
1368 | |||
1369 | $ cd .. |
|
1369 | $ cd .. | |
1370 |
|
1370 | |||
1371 | Issue2383: hg log showing _less_ differences than hg diff |
|
1371 | Issue2383: hg log showing _less_ differences than hg diff | |
1372 |
|
1372 | |||
1373 | $ hg init issue2383 |
|
1373 | $ hg init issue2383 | |
1374 | $ cd issue2383 |
|
1374 | $ cd issue2383 | |
1375 |
|
1375 | |||
1376 | Create a test repo: |
|
1376 | Create a test repo: | |
1377 |
|
1377 | |||
1378 | $ echo a > a |
|
1378 | $ echo a > a | |
1379 | $ hg ci -Am0 |
|
1379 | $ hg ci -Am0 | |
1380 | adding a |
|
1380 | adding a | |
1381 | $ echo b > b |
|
1381 | $ echo b > b | |
1382 | $ hg ci -Am1 |
|
1382 | $ hg ci -Am1 | |
1383 | adding b |
|
1383 | adding b | |
1384 | $ hg co 0 |
|
1384 | $ hg co 0 | |
1385 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1385 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1386 | $ echo b > a |
|
1386 | $ echo b > a | |
1387 | $ hg ci -m2 |
|
1387 | $ hg ci -m2 | |
1388 | created new head |
|
1388 | created new head | |
1389 |
|
1389 | |||
1390 | Merge: |
|
1390 | Merge: | |
1391 |
|
1391 | |||
1392 | $ hg merge |
|
1392 | $ hg merge | |
1393 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1393 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1394 | (branch merge, don't forget to commit) |
|
1394 | (branch merge, don't forget to commit) | |
1395 |
|
1395 | |||
1396 | Make sure there's a file listed in the merge to trigger the bug: |
|
1396 | Make sure there's a file listed in the merge to trigger the bug: | |
1397 |
|
1397 | |||
1398 | $ echo c > a |
|
1398 | $ echo c > a | |
1399 | $ hg ci -m3 |
|
1399 | $ hg ci -m3 | |
1400 |
|
1400 | |||
1401 | Two files shown here in diff: |
|
1401 | Two files shown here in diff: | |
1402 |
|
1402 | |||
1403 | $ hg diff --rev 2:3 |
|
1403 | $ hg diff --rev 2:3 | |
1404 | diff -r b09be438c43a -r 8e07aafe1edc a |
|
1404 | diff -r b09be438c43a -r 8e07aafe1edc a | |
1405 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1405 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1406 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
1406 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
1407 | @@ -1,1 +1,1 @@ |
|
1407 | @@ -1,1 +1,1 @@ | |
1408 | -b |
|
1408 | -b | |
1409 | +c |
|
1409 | +c | |
1410 | diff -r b09be438c43a -r 8e07aafe1edc b |
|
1410 | diff -r b09be438c43a -r 8e07aafe1edc b | |
1411 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1411 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1412 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
1412 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
1413 | @@ -0,0 +1,1 @@ |
|
1413 | @@ -0,0 +1,1 @@ | |
1414 | +b |
|
1414 | +b | |
1415 |
|
1415 | |||
1416 | Diff here should be the same: |
|
1416 | Diff here should be the same: | |
1417 |
|
1417 | |||
1418 | $ hg log -vpr 3 |
|
1418 | $ hg log -vpr 3 | |
1419 | changeset: 3:8e07aafe1edc |
|
1419 | changeset: 3:8e07aafe1edc | |
1420 | tag: tip |
|
1420 | tag: tip | |
1421 | parent: 2:b09be438c43a |
|
1421 | parent: 2:b09be438c43a | |
1422 | parent: 1:925d80f479bb |
|
1422 | parent: 1:925d80f479bb | |
1423 | user: test |
|
1423 | user: test | |
1424 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1424 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1425 | files: a |
|
1425 | files: a | |
1426 | description: |
|
1426 | description: | |
1427 | 3 |
|
1427 | 3 | |
1428 |
|
1428 | |||
1429 |
|
1429 | |||
1430 | diff -r b09be438c43a -r 8e07aafe1edc a |
|
1430 | diff -r b09be438c43a -r 8e07aafe1edc a | |
1431 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1431 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1432 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
1432 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
1433 | @@ -1,1 +1,1 @@ |
|
1433 | @@ -1,1 +1,1 @@ | |
1434 | -b |
|
1434 | -b | |
1435 | +c |
|
1435 | +c | |
1436 | diff -r b09be438c43a -r 8e07aafe1edc b |
|
1436 | diff -r b09be438c43a -r 8e07aafe1edc b | |
1437 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1437 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1438 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
1438 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
1439 | @@ -0,0 +1,1 @@ |
|
1439 | @@ -0,0 +1,1 @@ | |
1440 | +b |
|
1440 | +b | |
1441 |
|
1441 | |||
1442 | $ cd .. |
|
1442 | $ cd .. | |
1443 |
|
1443 | |||
1444 | 'hg log -r rev fn' when last(filelog(fn)) != rev |
|
1444 | 'hg log -r rev fn' when last(filelog(fn)) != rev | |
1445 |
|
1445 | |||
1446 | $ hg init simplelog |
|
1446 | $ hg init simplelog | |
1447 | $ cd simplelog |
|
1447 | $ cd simplelog | |
1448 | $ echo f > a |
|
1448 | $ echo f > a | |
1449 | $ hg ci -Am'a' -d '0 0' |
|
1449 | $ hg ci -Am'a' -d '0 0' | |
1450 | adding a |
|
1450 | adding a | |
1451 | $ echo f >> a |
|
1451 | $ echo f >> a | |
1452 | $ hg ci -Am'a bis' -d '1 0' |
|
1452 | $ hg ci -Am'a bis' -d '1 0' | |
1453 |
|
1453 | |||
1454 | $ hg log -r0 a |
|
1454 | $ hg log -r0 a | |
1455 | changeset: 0:9f758d63dcde |
|
1455 | changeset: 0:9f758d63dcde | |
1456 | user: test |
|
1456 | user: test | |
1457 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1457 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1458 | summary: a |
|
1458 | summary: a | |
1459 |
|
1459 | |||
1460 | enable obsolete to test hidden feature |
|
1460 | enable obsolete to test hidden feature | |
1461 |
|
1461 | |||
1462 | $ cat >> $HGRCPATH << EOF |
|
1462 | $ cat >> $HGRCPATH << EOF | |
1463 | > [experimental] |
|
1463 | > [experimental] | |
1464 | > evolution=createmarkers |
|
1464 | > evolution=createmarkers | |
1465 | > EOF |
|
1465 | > EOF | |
1466 |
|
1466 | |||
1467 | $ hg log --template='{rev}:{node}\n' |
|
1467 | $ hg log --template='{rev}:{node}\n' | |
1468 | 1:a765632148dc55d38c35c4f247c618701886cb2f |
|
1468 | 1:a765632148dc55d38c35c4f247c618701886cb2f | |
1469 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1469 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1470 | $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f |
|
1470 | $ hg debugobsolete a765632148dc55d38c35c4f247c618701886cb2f | |
1471 | $ hg up null -q |
|
1471 | $ hg up null -q | |
1472 | $ hg log --template='{rev}:{node}\n' |
|
1472 | $ hg log --template='{rev}:{node}\n' | |
1473 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1473 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1474 | $ hg log --template='{rev}:{node}\n' --hidden |
|
1474 | $ hg log --template='{rev}:{node}\n' --hidden | |
1475 | 1:a765632148dc55d38c35c4f247c618701886cb2f |
|
1475 | 1:a765632148dc55d38c35c4f247c618701886cb2f | |
1476 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1476 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1477 | $ hg log -r a |
|
1477 | $ hg log -r a | |
1478 | abort: hidden revision 'a'! |
|
1478 | abort: hidden revision 'a'! | |
1479 | (use --hidden to access hidden revisions) |
|
1479 | (use --hidden to access hidden revisions) | |
1480 | [255] |
|
1480 | [255] | |
1481 |
|
1481 | |||
1482 | test that parent prevent a changeset to be hidden |
|
1482 | test that parent prevent a changeset to be hidden | |
1483 |
|
1483 | |||
1484 | $ hg up 1 -q --hidden |
|
1484 | $ hg up 1 -q --hidden | |
1485 | $ hg log --template='{rev}:{node}\n' |
|
1485 | $ hg log --template='{rev}:{node}\n' | |
1486 | 1:a765632148dc55d38c35c4f247c618701886cb2f |
|
1486 | 1:a765632148dc55d38c35c4f247c618701886cb2f | |
1487 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1487 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1488 |
|
1488 | |||
1489 | test that second parent prevent a changeset to be hidden too |
|
1489 | test that second parent prevent a changeset to be hidden too | |
1490 |
|
1490 | |||
1491 | $ hg debugsetparents 0 1 # nothing suitable to merge here |
|
1491 | $ hg debugsetparents 0 1 # nothing suitable to merge here | |
1492 | $ hg log --template='{rev}:{node}\n' |
|
1492 | $ hg log --template='{rev}:{node}\n' | |
1493 | 1:a765632148dc55d38c35c4f247c618701886cb2f |
|
1493 | 1:a765632148dc55d38c35c4f247c618701886cb2f | |
1494 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1494 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1495 | $ hg debugsetparents 1 |
|
1495 | $ hg debugsetparents 1 | |
1496 | $ hg up -q null |
|
1496 | $ hg up -q null | |
1497 |
|
1497 | |||
1498 | bookmarks prevent a changeset being hidden |
|
1498 | bookmarks prevent a changeset being hidden | |
1499 |
|
1499 | |||
1500 | $ hg bookmark --hidden -r 1 X |
|
1500 | $ hg bookmark --hidden -r 1 X | |
1501 | $ hg log --template '{rev}:{node}\n' |
|
1501 | $ hg log --template '{rev}:{node}\n' | |
1502 | 1:a765632148dc55d38c35c4f247c618701886cb2f |
|
1502 | 1:a765632148dc55d38c35c4f247c618701886cb2f | |
1503 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1503 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1504 | $ hg bookmark -d X |
|
1504 | $ hg bookmark -d X | |
1505 |
|
1505 | |||
1506 | divergent bookmarks are not hidden |
|
1506 | divergent bookmarks are not hidden | |
1507 |
|
1507 | |||
1508 | $ hg bookmark --hidden -r 1 X@foo |
|
1508 | $ hg bookmark --hidden -r 1 X@foo | |
1509 | $ hg log --template '{rev}:{node}\n' |
|
1509 | $ hg log --template '{rev}:{node}\n' | |
1510 | 1:a765632148dc55d38c35c4f247c618701886cb2f |
|
1510 | 1:a765632148dc55d38c35c4f247c618701886cb2f | |
1511 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 |
|
1511 | 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 | |
1512 |
|
1512 | |||
1513 | clear extensions configuration |
|
1513 | clear extensions configuration | |
1514 | $ echo '[extensions]' >> $HGRCPATH |
|
1514 | $ echo '[extensions]' >> $HGRCPATH | |
1515 | $ echo "obs=!" >> $HGRCPATH |
|
1515 | $ echo "obs=!" >> $HGRCPATH | |
1516 | $ cd .. |
|
1516 | $ cd .. | |
1517 |
|
1517 | |||
1518 | test -u/-k for problematic encoding |
|
1518 | test -u/-k for problematic encoding | |
1519 | # unicode: cp932: |
|
1519 | # unicode: cp932: | |
1520 | # u30A2 0x83 0x41(= 'A') |
|
1520 | # u30A2 0x83 0x41(= 'A') | |
1521 | # u30C2 0x83 0x61(= 'a') |
|
1521 | # u30C2 0x83 0x61(= 'a') | |
1522 |
|
1522 | |||
1523 | $ hg init problematicencoding |
|
1523 | $ hg init problematicencoding | |
1524 | $ cd problematicencoding |
|
1524 | $ cd problematicencoding | |
1525 |
|
1525 | |||
1526 | $ python > setup.sh <<EOF |
|
1526 | $ python > setup.sh <<EOF | |
1527 | > print u''' |
|
1527 | > print u''' | |
1528 | > echo a > text |
|
1528 | > echo a > text | |
1529 | > hg add text |
|
1529 | > hg add text | |
1530 | > hg --encoding utf-8 commit -u '\u30A2' -m none |
|
1530 | > hg --encoding utf-8 commit -u '\u30A2' -m none | |
1531 | > echo b > text |
|
1531 | > echo b > text | |
1532 | > hg --encoding utf-8 commit -u '\u30C2' -m none |
|
1532 | > hg --encoding utf-8 commit -u '\u30C2' -m none | |
1533 | > echo c > text |
|
1533 | > echo c > text | |
1534 | > hg --encoding utf-8 commit -u none -m '\u30A2' |
|
1534 | > hg --encoding utf-8 commit -u none -m '\u30A2' | |
1535 | > echo d > text |
|
1535 | > echo d > text | |
1536 | > hg --encoding utf-8 commit -u none -m '\u30C2' |
|
1536 | > hg --encoding utf-8 commit -u none -m '\u30C2' | |
1537 | > '''.encode('utf-8') |
|
1537 | > '''.encode('utf-8') | |
1538 | > EOF |
|
1538 | > EOF | |
1539 | $ sh < setup.sh |
|
1539 | $ sh < setup.sh | |
1540 |
|
1540 | |||
1541 | test in problematic encoding |
|
1541 | test in problematic encoding | |
1542 | $ python > test.sh <<EOF |
|
1542 | $ python > test.sh <<EOF | |
1543 | > print u''' |
|
1543 | > print u''' | |
1544 | > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2' |
|
1544 | > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2' | |
1545 | > echo ==== |
|
1545 | > echo ==== | |
1546 | > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2' |
|
1546 | > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2' | |
1547 | > echo ==== |
|
1547 | > echo ==== | |
1548 | > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2' |
|
1548 | > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2' | |
1549 | > echo ==== |
|
1549 | > echo ==== | |
1550 | > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2' |
|
1550 | > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2' | |
1551 | > '''.encode('cp932') |
|
1551 | > '''.encode('cp932') | |
1552 | > EOF |
|
1552 | > EOF | |
1553 | $ sh < test.sh |
|
1553 | $ sh < test.sh | |
1554 | 0 |
|
1554 | 0 | |
1555 | ==== |
|
1555 | ==== | |
1556 | 1 |
|
1556 | 1 | |
1557 | ==== |
|
1557 | ==== | |
1558 | 2 |
|
1558 | 2 | |
1559 | 0 |
|
1559 | 0 | |
1560 | ==== |
|
1560 | ==== | |
1561 | 3 |
|
1561 | 3 | |
1562 | 1 |
|
1562 | 1 | |
1563 |
|
1563 | |||
1564 | $ cd .. |
|
1564 | $ cd .. | |
1565 |
|
1565 | |||
1566 | test hg log on non-existent files and on directories |
|
1566 | test hg log on non-existent files and on directories | |
1567 | $ hg init issue1340 |
|
1567 | $ hg init issue1340 | |
1568 | $ cd issue1340 |
|
1568 | $ cd issue1340 | |
1569 | $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6 |
|
1569 | $ mkdir d1; mkdir D2; mkdir D3.i; mkdir d4.hg; mkdir d5.d; mkdir .d6 | |
1570 | $ echo 1 > d1/f1 |
|
1570 | $ echo 1 > d1/f1 | |
1571 | $ echo 1 > D2/f1 |
|
1571 | $ echo 1 > D2/f1 | |
1572 | $ echo 1 > D3.i/f1 |
|
1572 | $ echo 1 > D3.i/f1 | |
1573 | $ echo 1 > d4.hg/f1 |
|
1573 | $ echo 1 > d4.hg/f1 | |
1574 | $ echo 1 > d5.d/f1 |
|
1574 | $ echo 1 > d5.d/f1 | |
1575 | $ echo 1 > .d6/f1 |
|
1575 | $ echo 1 > .d6/f1 | |
1576 | $ hg -q add . |
|
1576 | $ hg -q add . | |
1577 | $ hg commit -m "a bunch of weird directories" |
|
1577 | $ hg commit -m "a bunch of weird directories" | |
1578 | $ hg log -l1 d1/f1 | grep changeset |
|
1578 | $ hg log -l1 d1/f1 | grep changeset | |
1579 | changeset: 0:65624cd9070a |
|
1579 | changeset: 0:65624cd9070a | |
1580 | $ hg log -l1 f1 |
|
1580 | $ hg log -l1 f1 | |
1581 | $ hg log -l1 . | grep changeset |
|
1581 | $ hg log -l1 . | grep changeset | |
1582 | changeset: 0:65624cd9070a |
|
1582 | changeset: 0:65624cd9070a | |
1583 | $ hg log -l1 ./ | grep changeset |
|
1583 | $ hg log -l1 ./ | grep changeset | |
1584 | changeset: 0:65624cd9070a |
|
1584 | changeset: 0:65624cd9070a | |
1585 | $ hg log -l1 d1 | grep changeset |
|
1585 | $ hg log -l1 d1 | grep changeset | |
1586 | changeset: 0:65624cd9070a |
|
1586 | changeset: 0:65624cd9070a | |
1587 | $ hg log -l1 D2 | grep changeset |
|
1587 | $ hg log -l1 D2 | grep changeset | |
1588 | changeset: 0:65624cd9070a |
|
1588 | changeset: 0:65624cd9070a | |
1589 | $ hg log -l1 D2/f1 | grep changeset |
|
1589 | $ hg log -l1 D2/f1 | grep changeset | |
1590 | changeset: 0:65624cd9070a |
|
1590 | changeset: 0:65624cd9070a | |
1591 | $ hg log -l1 D3.i | grep changeset |
|
1591 | $ hg log -l1 D3.i | grep changeset | |
1592 | changeset: 0:65624cd9070a |
|
1592 | changeset: 0:65624cd9070a | |
1593 | $ hg log -l1 D3.i/f1 | grep changeset |
|
1593 | $ hg log -l1 D3.i/f1 | grep changeset | |
1594 | changeset: 0:65624cd9070a |
|
1594 | changeset: 0:65624cd9070a | |
1595 | $ hg log -l1 d4.hg | grep changeset |
|
1595 | $ hg log -l1 d4.hg | grep changeset | |
1596 | changeset: 0:65624cd9070a |
|
1596 | changeset: 0:65624cd9070a | |
1597 | $ hg log -l1 d4.hg/f1 | grep changeset |
|
1597 | $ hg log -l1 d4.hg/f1 | grep changeset | |
1598 | changeset: 0:65624cd9070a |
|
1598 | changeset: 0:65624cd9070a | |
1599 | $ hg log -l1 d5.d | grep changeset |
|
1599 | $ hg log -l1 d5.d | grep changeset | |
1600 | changeset: 0:65624cd9070a |
|
1600 | changeset: 0:65624cd9070a | |
1601 | $ hg log -l1 d5.d/f1 | grep changeset |
|
1601 | $ hg log -l1 d5.d/f1 | grep changeset | |
1602 | changeset: 0:65624cd9070a |
|
1602 | changeset: 0:65624cd9070a | |
1603 | $ hg log -l1 .d6 | grep changeset |
|
1603 | $ hg log -l1 .d6 | grep changeset | |
1604 | changeset: 0:65624cd9070a |
|
1604 | changeset: 0:65624cd9070a | |
1605 | $ hg log -l1 .d6/f1 | grep changeset |
|
1605 | $ hg log -l1 .d6/f1 | grep changeset | |
1606 | changeset: 0:65624cd9070a |
|
1606 | changeset: 0:65624cd9070a | |
1607 |
|
1607 | |||
1608 | issue3772: hg log -r :null showing revision 0 as well |
|
1608 | issue3772: hg log -r :null showing revision 0 as well | |
1609 |
|
1609 | |||
1610 | $ hg log -r :null |
|
1610 | $ hg log -r :null | |
1611 | changeset: 0:65624cd9070a |
|
1611 | changeset: 0:65624cd9070a | |
1612 | tag: tip |
|
1612 | tag: tip | |
1613 | user: test |
|
1613 | user: test | |
1614 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1614 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1615 | summary: a bunch of weird directories |
|
1615 | summary: a bunch of weird directories | |
1616 |
|
1616 | |||
1617 | changeset: -1:000000000000 |
|
1617 | changeset: -1:000000000000 | |
1618 | user: |
|
1618 | user: | |
1619 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1619 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1620 |
|
1620 | |||
1621 | $ hg log -r null:null |
|
1621 | $ hg log -r null:null | |
1622 | changeset: -1:000000000000 |
|
1622 | changeset: -1:000000000000 | |
1623 | user: |
|
1623 | user: | |
1624 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1624 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1625 |
|
1625 | |||
1626 | working-directory revision requires special treatment |
|
1626 | working-directory revision requires special treatment | |
1627 |
|
1627 | |||
1628 | $ hg log -r 'wdir()' |
|
1628 | $ hg log -r 'wdir()' | |
1629 | changeset: 0:65624cd9070a+ |
|
1629 | changeset: 0:65624cd9070a+ | |
1630 | user: test |
|
1630 | user: test | |
1631 | date: [A-Za-z0-9:+ ]+ (re) |
|
1631 | date: [A-Za-z0-9:+ ]+ (re) | |
1632 |
|
1632 | |||
1633 | $ hg log -r 'wdir()' -q |
|
1633 | $ hg log -r 'wdir()' -q | |
1634 | 0:65624cd9070a+ |
|
1634 | 0:65624cd9070a+ | |
1635 |
|
1635 | |||
1636 | $ hg log -r 'wdir()' --debug |
|
1636 | $ hg log -r 'wdir()' --debug | |
1637 | changeset: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08+ |
|
1637 | changeset: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08+ | |
1638 | phase: draft |
|
1638 | phase: draft | |
1639 | parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08 |
|
1639 | parent: 0:65624cd9070a035fa7191a54f2b8af39f16b0c08 | |
1640 | parent: -1:0000000000000000000000000000000000000000 |
|
1640 | parent: -1:0000000000000000000000000000000000000000 | |
1641 | user: test |
|
1641 | user: test | |
1642 | date: [A-Za-z0-9:+ ]+ (re) |
|
1642 | date: [A-Za-z0-9:+ ]+ (re) | |
1643 | extra: branch=default |
|
1643 | extra: branch=default | |
1644 |
|
1644 | |||
1645 | $ hg log -r 'wdir()' -Tjson |
|
1645 | $ hg log -r 'wdir()' -Tjson | |
1646 | [ |
|
1646 | [ | |
1647 | { |
|
1647 | { | |
1648 | "rev": null, |
|
1648 | "rev": null, | |
1649 | "node": null, |
|
1649 | "node": null, | |
1650 | "branch": "default", |
|
1650 | "branch": "default", | |
1651 | "phase": "draft", |
|
1651 | "phase": "draft", | |
1652 | "user": "test", |
|
1652 | "user": "test", | |
1653 | "date": [*, 0], (glob) |
|
1653 | "date": [*, 0], (glob) | |
1654 | "desc": "", |
|
1654 | "desc": "", | |
1655 | "bookmarks": [], |
|
1655 | "bookmarks": [], | |
1656 |
"tags": [ |
|
1656 | "tags": [], | |
1657 | "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"] |
|
1657 | "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"] | |
1658 | } |
|
1658 | } | |
1659 | ] |
|
1659 | ] | |
1660 |
|
1660 | |||
1661 | $ hg log -r 'wdir()' -Tjson -q |
|
1661 | $ hg log -r 'wdir()' -Tjson -q | |
1662 | [ |
|
1662 | [ | |
1663 | { |
|
1663 | { | |
1664 | "rev": null, |
|
1664 | "rev": null, | |
1665 | "node": null |
|
1665 | "node": null | |
1666 | } |
|
1666 | } | |
1667 | ] |
|
1667 | ] | |
1668 |
|
1668 | |||
1669 | $ hg log -r 'wdir()' -Tjson --debug |
|
1669 | $ hg log -r 'wdir()' -Tjson --debug | |
1670 | [ |
|
1670 | [ | |
1671 | { |
|
1671 | { | |
1672 | "rev": null, |
|
1672 | "rev": null, | |
1673 | "node": null, |
|
1673 | "node": null, | |
1674 | "branch": "default", |
|
1674 | "branch": "default", | |
1675 | "phase": "draft", |
|
1675 | "phase": "draft", | |
1676 | "user": "test", |
|
1676 | "user": "test", | |
1677 | "date": [*, 0], (glob) |
|
1677 | "date": [*, 0], (glob) | |
1678 | "desc": "", |
|
1678 | "desc": "", | |
1679 | "bookmarks": [], |
|
1679 | "bookmarks": [], | |
1680 |
"tags": [ |
|
1680 | "tags": [], | |
1681 | "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"], |
|
1681 | "parents": ["65624cd9070a035fa7191a54f2b8af39f16b0c08"], | |
1682 | "manifest": null, |
|
1682 | "manifest": null, | |
1683 | "extra": {"branch": "default"}, |
|
1683 | "extra": {"branch": "default"}, | |
1684 | "modified": [], |
|
1684 | "modified": [], | |
1685 | "added": [], |
|
1685 | "added": [], | |
1686 | "removed": [] |
|
1686 | "removed": [] | |
1687 | } |
|
1687 | } | |
1688 | ] |
|
1688 | ] | |
1689 |
|
1689 | |||
1690 | Check that adding an arbitrary name shows up in log automatically |
|
1690 | Check that adding an arbitrary name shows up in log automatically | |
1691 |
|
1691 | |||
1692 | $ cat > ../names.py <<EOF |
|
1692 | $ cat > ../names.py <<EOF | |
1693 | > """A small extension to test adding arbitrary names to a repo""" |
|
1693 | > """A small extension to test adding arbitrary names to a repo""" | |
1694 | > from mercurial.namespaces import namespace |
|
1694 | > from mercurial.namespaces import namespace | |
1695 | > |
|
1695 | > | |
1696 | > def reposetup(ui, repo): |
|
1696 | > def reposetup(ui, repo): | |
1697 | > foo = {'foo': repo[0].node()} |
|
1697 | > foo = {'foo': repo[0].node()} | |
1698 | > names = lambda r: foo.keys() |
|
1698 | > names = lambda r: foo.keys() | |
1699 | > namemap = lambda r, name: foo.get(name) |
|
1699 | > namemap = lambda r, name: foo.get(name) | |
1700 | > nodemap = lambda r, node: [name for name, n in foo.iteritems() |
|
1700 | > nodemap = lambda r, node: [name for name, n in foo.iteritems() | |
1701 | > if n == node] |
|
1701 | > if n == node] | |
1702 | > ns = namespace("bars", templatename="bar", logname="barlog", |
|
1702 | > ns = namespace("bars", templatename="bar", logname="barlog", | |
1703 | > colorname="barcolor", listnames=names, namemap=namemap, |
|
1703 | > colorname="barcolor", listnames=names, namemap=namemap, | |
1704 | > nodemap=nodemap) |
|
1704 | > nodemap=nodemap) | |
1705 | > |
|
1705 | > | |
1706 | > repo.names.addnamespace(ns) |
|
1706 | > repo.names.addnamespace(ns) | |
1707 | > EOF |
|
1707 | > EOF | |
1708 |
|
1708 | |||
1709 | $ hg --config extensions.names=../names.py log -r 0 |
|
1709 | $ hg --config extensions.names=../names.py log -r 0 | |
1710 | changeset: 0:65624cd9070a |
|
1710 | changeset: 0:65624cd9070a | |
1711 | tag: tip |
|
1711 | tag: tip | |
1712 | barlog: foo |
|
1712 | barlog: foo | |
1713 | user: test |
|
1713 | user: test | |
1714 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1714 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1715 | summary: a bunch of weird directories |
|
1715 | summary: a bunch of weird directories | |
1716 |
|
1716 | |||
1717 | $ hg --config extensions.names=../names.py \ |
|
1717 | $ hg --config extensions.names=../names.py \ | |
1718 | > --config extensions.color= --config color.log.barcolor=red \ |
|
1718 | > --config extensions.color= --config color.log.barcolor=red \ | |
1719 | > --color=always log -r 0 |
|
1719 | > --color=always log -r 0 | |
1720 | \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc) |
|
1720 | \x1b[0;33mchangeset: 0:65624cd9070a\x1b[0m (esc) | |
1721 | tag: tip |
|
1721 | tag: tip | |
1722 | \x1b[0;31mbarlog: foo\x1b[0m (esc) |
|
1722 | \x1b[0;31mbarlog: foo\x1b[0m (esc) | |
1723 | user: test |
|
1723 | user: test | |
1724 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1724 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1725 | summary: a bunch of weird directories |
|
1725 | summary: a bunch of weird directories | |
1726 |
|
1726 | |||
1727 | $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n' |
|
1727 | $ hg --config extensions.names=../names.py log -r 0 --template '{bars}\n' | |
1728 | foo |
|
1728 | foo | |
1729 |
|
1729 | |||
1730 | $ cd .. |
|
1730 | $ cd .. | |
1731 |
|
1731 | |||
1732 | hg log -f dir across branches |
|
1732 | hg log -f dir across branches | |
1733 |
|
1733 | |||
1734 | $ hg init acrossbranches |
|
1734 | $ hg init acrossbranches | |
1735 | $ cd acrossbranches |
|
1735 | $ cd acrossbranches | |
1736 | $ mkdir d |
|
1736 | $ mkdir d | |
1737 | $ echo a > d/a && hg ci -Aqm a |
|
1737 | $ echo a > d/a && hg ci -Aqm a | |
1738 | $ echo b > d/a && hg ci -Aqm b |
|
1738 | $ echo b > d/a && hg ci -Aqm b | |
1739 | $ hg up -q 0 |
|
1739 | $ hg up -q 0 | |
1740 | $ echo b > d/a && hg ci -Aqm c |
|
1740 | $ echo b > d/a && hg ci -Aqm c | |
1741 | $ hg log -f d -T '{desc}' -G |
|
1741 | $ hg log -f d -T '{desc}' -G | |
1742 | @ c |
|
1742 | @ c | |
1743 | | |
|
1743 | | | |
1744 | o a |
|
1744 | o a | |
1745 |
|
1745 | |||
1746 | Ensure that largefiles doesn't interfere with following a normal file |
|
1746 | Ensure that largefiles doesn't interfere with following a normal file | |
1747 | $ hg --config extensions.largefiles= log -f d -T '{desc}' -G |
|
1747 | $ hg --config extensions.largefiles= log -f d -T '{desc}' -G | |
1748 | @ c |
|
1748 | @ c | |
1749 | | |
|
1749 | | | |
1750 | o a |
|
1750 | o a | |
1751 |
|
1751 | |||
1752 | $ hg log -f d/a -T '{desc}' -G |
|
1752 | $ hg log -f d/a -T '{desc}' -G | |
1753 | @ c |
|
1753 | @ c | |
1754 | | |
|
1754 | | | |
1755 | o a |
|
1755 | o a | |
1756 |
|
1756 | |||
1757 | $ cd .. |
|
1757 | $ cd .. | |
1758 |
|
1758 | |||
1759 | hg log -f with linkrev pointing to another branch |
|
1759 | hg log -f with linkrev pointing to another branch | |
1760 | ------------------------------------------------- |
|
1760 | ------------------------------------------------- | |
1761 |
|
1761 | |||
1762 | create history with a filerev whose linkrev points to another branch |
|
1762 | create history with a filerev whose linkrev points to another branch | |
1763 |
|
1763 | |||
1764 | $ hg init branchedlinkrev |
|
1764 | $ hg init branchedlinkrev | |
1765 | $ cd branchedlinkrev |
|
1765 | $ cd branchedlinkrev | |
1766 | $ echo 1 > a |
|
1766 | $ echo 1 > a | |
1767 | $ hg commit -Am 'content1' |
|
1767 | $ hg commit -Am 'content1' | |
1768 | adding a |
|
1768 | adding a | |
1769 | $ echo 2 > a |
|
1769 | $ echo 2 > a | |
1770 | $ hg commit -m 'content2' |
|
1770 | $ hg commit -m 'content2' | |
1771 | $ hg up --rev 'desc(content1)' |
|
1771 | $ hg up --rev 'desc(content1)' | |
1772 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1772 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1773 | $ echo unrelated > unrelated |
|
1773 | $ echo unrelated > unrelated | |
1774 | $ hg commit -Am 'unrelated' |
|
1774 | $ hg commit -Am 'unrelated' | |
1775 | adding unrelated |
|
1775 | adding unrelated | |
1776 | created new head |
|
1776 | created new head | |
1777 | $ hg graft -r 'desc(content2)' |
|
1777 | $ hg graft -r 'desc(content2)' | |
1778 | grafting 1:2294ae80ad84 "content2" |
|
1778 | grafting 1:2294ae80ad84 "content2" | |
1779 | $ echo 3 > a |
|
1779 | $ echo 3 > a | |
1780 | $ hg commit -m 'content3' |
|
1780 | $ hg commit -m 'content3' | |
1781 | $ hg log -G |
|
1781 | $ hg log -G | |
1782 | @ changeset: 4:50b9b36e9c5d |
|
1782 | @ changeset: 4:50b9b36e9c5d | |
1783 | | tag: tip |
|
1783 | | tag: tip | |
1784 | | user: test |
|
1784 | | user: test | |
1785 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1785 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1786 | | summary: content3 |
|
1786 | | summary: content3 | |
1787 | | |
|
1787 | | | |
1788 | o changeset: 3:15b2327059e5 |
|
1788 | o changeset: 3:15b2327059e5 | |
1789 | | user: test |
|
1789 | | user: test | |
1790 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1790 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1791 | | summary: content2 |
|
1791 | | summary: content2 | |
1792 | | |
|
1792 | | | |
1793 | o changeset: 2:2029acd1168c |
|
1793 | o changeset: 2:2029acd1168c | |
1794 | | parent: 0:ae0a3c9f9e95 |
|
1794 | | parent: 0:ae0a3c9f9e95 | |
1795 | | user: test |
|
1795 | | user: test | |
1796 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1796 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1797 | | summary: unrelated |
|
1797 | | summary: unrelated | |
1798 | | |
|
1798 | | | |
1799 | | o changeset: 1:2294ae80ad84 |
|
1799 | | o changeset: 1:2294ae80ad84 | |
1800 | |/ user: test |
|
1800 | |/ user: test | |
1801 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1801 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1802 | | summary: content2 |
|
1802 | | summary: content2 | |
1803 | | |
|
1803 | | | |
1804 | o changeset: 0:ae0a3c9f9e95 |
|
1804 | o changeset: 0:ae0a3c9f9e95 | |
1805 | user: test |
|
1805 | user: test | |
1806 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1806 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1807 | summary: content1 |
|
1807 | summary: content1 | |
1808 |
|
1808 | |||
1809 |
|
1809 | |||
1810 | log -f on the file should list the graft result. |
|
1810 | log -f on the file should list the graft result. | |
1811 |
|
1811 | |||
1812 | $ hg log -Gf a |
|
1812 | $ hg log -Gf a | |
1813 | @ changeset: 4:50b9b36e9c5d |
|
1813 | @ changeset: 4:50b9b36e9c5d | |
1814 | | tag: tip |
|
1814 | | tag: tip | |
1815 | | user: test |
|
1815 | | user: test | |
1816 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1816 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1817 | | summary: content3 |
|
1817 | | summary: content3 | |
1818 | | |
|
1818 | | | |
1819 | o changeset: 3:15b2327059e5 |
|
1819 | o changeset: 3:15b2327059e5 | |
1820 | | user: test |
|
1820 | | user: test | |
1821 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1821 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1822 | | summary: content2 |
|
1822 | | summary: content2 | |
1823 | | |
|
1823 | | | |
1824 | o changeset: 0:ae0a3c9f9e95 |
|
1824 | o changeset: 0:ae0a3c9f9e95 | |
1825 | user: test |
|
1825 | user: test | |
1826 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1826 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1827 | summary: content1 |
|
1827 | summary: content1 | |
1828 |
|
1828 | |||
1829 |
|
1829 | |||
1830 | plain log lists the original version |
|
1830 | plain log lists the original version | |
1831 | (XXX we should probably list both) |
|
1831 | (XXX we should probably list both) | |
1832 |
|
1832 | |||
1833 | $ hg log -G a |
|
1833 | $ hg log -G a | |
1834 | @ changeset: 4:50b9b36e9c5d |
|
1834 | @ changeset: 4:50b9b36e9c5d | |
1835 | | tag: tip |
|
1835 | | tag: tip | |
1836 | | user: test |
|
1836 | | user: test | |
1837 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1837 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1838 | | summary: content3 |
|
1838 | | summary: content3 | |
1839 | | |
|
1839 | | | |
1840 | | o changeset: 1:2294ae80ad84 |
|
1840 | | o changeset: 1:2294ae80ad84 | |
1841 | |/ user: test |
|
1841 | |/ user: test | |
1842 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1842 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1843 | | summary: content2 |
|
1843 | | summary: content2 | |
1844 | | |
|
1844 | | | |
1845 | o changeset: 0:ae0a3c9f9e95 |
|
1845 | o changeset: 0:ae0a3c9f9e95 | |
1846 | user: test |
|
1846 | user: test | |
1847 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1847 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1848 | summary: content1 |
|
1848 | summary: content1 | |
1849 |
|
1849 | |||
1850 |
|
1850 | |||
1851 | hg log -f from the grafted changeset |
|
1851 | hg log -f from the grafted changeset | |
1852 | (The bootstrap should properly take the topology in account) |
|
1852 | (The bootstrap should properly take the topology in account) | |
1853 |
|
1853 | |||
1854 | $ hg up 'desc(content3)^' |
|
1854 | $ hg up 'desc(content3)^' | |
1855 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1855 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1856 | $ hg log -Gf a |
|
1856 | $ hg log -Gf a | |
1857 | @ changeset: 3:15b2327059e5 |
|
1857 | @ changeset: 3:15b2327059e5 | |
1858 | | user: test |
|
1858 | | user: test | |
1859 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1859 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1860 | | summary: content2 |
|
1860 | | summary: content2 | |
1861 | | |
|
1861 | | | |
1862 | o changeset: 0:ae0a3c9f9e95 |
|
1862 | o changeset: 0:ae0a3c9f9e95 | |
1863 | user: test |
|
1863 | user: test | |
1864 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1864 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1865 | summary: content1 |
|
1865 | summary: content1 | |
1866 |
|
1866 | |||
1867 |
|
1867 | |||
1868 | Test that we use the first non-hidden changeset in that case. |
|
1868 | Test that we use the first non-hidden changeset in that case. | |
1869 |
|
1869 | |||
1870 | (hide the changeset) |
|
1870 | (hide the changeset) | |
1871 |
|
1871 | |||
1872 | $ hg log -T '{node}\n' -r 1 |
|
1872 | $ hg log -T '{node}\n' -r 1 | |
1873 | 2294ae80ad8447bc78383182eeac50cb049df623 |
|
1873 | 2294ae80ad8447bc78383182eeac50cb049df623 | |
1874 | $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623 |
|
1874 | $ hg debugobsolete 2294ae80ad8447bc78383182eeac50cb049df623 | |
1875 | $ hg log -G |
|
1875 | $ hg log -G | |
1876 | o changeset: 4:50b9b36e9c5d |
|
1876 | o changeset: 4:50b9b36e9c5d | |
1877 | | tag: tip |
|
1877 | | tag: tip | |
1878 | | user: test |
|
1878 | | user: test | |
1879 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1879 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1880 | | summary: content3 |
|
1880 | | summary: content3 | |
1881 | | |
|
1881 | | | |
1882 | @ changeset: 3:15b2327059e5 |
|
1882 | @ changeset: 3:15b2327059e5 | |
1883 | | user: test |
|
1883 | | user: test | |
1884 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1884 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1885 | | summary: content2 |
|
1885 | | summary: content2 | |
1886 | | |
|
1886 | | | |
1887 | o changeset: 2:2029acd1168c |
|
1887 | o changeset: 2:2029acd1168c | |
1888 | | parent: 0:ae0a3c9f9e95 |
|
1888 | | parent: 0:ae0a3c9f9e95 | |
1889 | | user: test |
|
1889 | | user: test | |
1890 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1890 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1891 | | summary: unrelated |
|
1891 | | summary: unrelated | |
1892 | | |
|
1892 | | | |
1893 | o changeset: 0:ae0a3c9f9e95 |
|
1893 | o changeset: 0:ae0a3c9f9e95 | |
1894 | user: test |
|
1894 | user: test | |
1895 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1895 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1896 | summary: content1 |
|
1896 | summary: content1 | |
1897 |
|
1897 | |||
1898 |
|
1898 | |||
1899 | Check that log on the file does not drop the file revision. |
|
1899 | Check that log on the file does not drop the file revision. | |
1900 |
|
1900 | |||
1901 | $ hg log -G a |
|
1901 | $ hg log -G a | |
1902 | o changeset: 4:50b9b36e9c5d |
|
1902 | o changeset: 4:50b9b36e9c5d | |
1903 | | tag: tip |
|
1903 | | tag: tip | |
1904 | | user: test |
|
1904 | | user: test | |
1905 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1905 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1906 | | summary: content3 |
|
1906 | | summary: content3 | |
1907 | | |
|
1907 | | | |
1908 | @ changeset: 3:15b2327059e5 |
|
1908 | @ changeset: 3:15b2327059e5 | |
1909 | | user: test |
|
1909 | | user: test | |
1910 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1910 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1911 | | summary: content2 |
|
1911 | | summary: content2 | |
1912 | | |
|
1912 | | | |
1913 | o changeset: 0:ae0a3c9f9e95 |
|
1913 | o changeset: 0:ae0a3c9f9e95 | |
1914 | user: test |
|
1914 | user: test | |
1915 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1915 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1916 | summary: content1 |
|
1916 | summary: content1 | |
1917 |
|
1917 | |||
1918 |
|
1918 | |||
1919 | Even when a head revision is linkrev-shadowed. |
|
1919 | Even when a head revision is linkrev-shadowed. | |
1920 |
|
1920 | |||
1921 | $ hg log -T '{node}\n' -r 4 |
|
1921 | $ hg log -T '{node}\n' -r 4 | |
1922 | 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2 |
|
1922 | 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2 | |
1923 | $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2 |
|
1923 | $ hg debugobsolete 50b9b36e9c5df2c6fc6dcefa8ad0da929e84aed2 | |
1924 | $ hg log -G a |
|
1924 | $ hg log -G a | |
1925 | @ changeset: 3:15b2327059e5 |
|
1925 | @ changeset: 3:15b2327059e5 | |
1926 | | tag: tip |
|
1926 | | tag: tip | |
1927 | | user: test |
|
1927 | | user: test | |
1928 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1928 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1929 | | summary: content2 |
|
1929 | | summary: content2 | |
1930 | | |
|
1930 | | | |
1931 | o changeset: 0:ae0a3c9f9e95 |
|
1931 | o changeset: 0:ae0a3c9f9e95 | |
1932 | user: test |
|
1932 | user: test | |
1933 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1933 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1934 | summary: content1 |
|
1934 | summary: content1 | |
1935 |
|
1935 | |||
1936 |
|
1936 | |||
1937 | $ cd .. |
|
1937 | $ cd .. | |
1938 |
|
1938 | |||
1939 | Even when the file revision is missing from some head: |
|
1939 | Even when the file revision is missing from some head: | |
1940 |
|
1940 | |||
1941 | $ hg init issue4490 |
|
1941 | $ hg init issue4490 | |
1942 | $ cd issue4490 |
|
1942 | $ cd issue4490 | |
1943 | $ echo '[experimental]' >> .hg/hgrc |
|
1943 | $ echo '[experimental]' >> .hg/hgrc | |
1944 | $ echo 'evolution=createmarkers' >> .hg/hgrc |
|
1944 | $ echo 'evolution=createmarkers' >> .hg/hgrc | |
1945 | $ echo a > a |
|
1945 | $ echo a > a | |
1946 | $ hg ci -Am0 |
|
1946 | $ hg ci -Am0 | |
1947 | adding a |
|
1947 | adding a | |
1948 | $ echo b > b |
|
1948 | $ echo b > b | |
1949 | $ hg ci -Am1 |
|
1949 | $ hg ci -Am1 | |
1950 | adding b |
|
1950 | adding b | |
1951 | $ echo B > b |
|
1951 | $ echo B > b | |
1952 | $ hg ci --amend -m 1 |
|
1952 | $ hg ci --amend -m 1 | |
1953 | $ hg up 0 |
|
1953 | $ hg up 0 | |
1954 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1954 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1955 | $ echo c > c |
|
1955 | $ echo c > c | |
1956 | $ hg ci -Am2 |
|
1956 | $ hg ci -Am2 | |
1957 | adding c |
|
1957 | adding c | |
1958 | created new head |
|
1958 | created new head | |
1959 | $ hg up 'head() and not .' |
|
1959 | $ hg up 'head() and not .' | |
1960 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1960 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1961 | $ hg log -G |
|
1961 | $ hg log -G | |
1962 | o changeset: 4:db815d6d32e6 |
|
1962 | o changeset: 4:db815d6d32e6 | |
1963 | | tag: tip |
|
1963 | | tag: tip | |
1964 | | parent: 0:f7b1eb17ad24 |
|
1964 | | parent: 0:f7b1eb17ad24 | |
1965 | | user: test |
|
1965 | | user: test | |
1966 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1966 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1967 | | summary: 2 |
|
1967 | | summary: 2 | |
1968 | | |
|
1968 | | | |
1969 | | @ changeset: 3:9bc8ce7f9356 |
|
1969 | | @ changeset: 3:9bc8ce7f9356 | |
1970 | |/ parent: 0:f7b1eb17ad24 |
|
1970 | |/ parent: 0:f7b1eb17ad24 | |
1971 | | user: test |
|
1971 | | user: test | |
1972 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1972 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1973 | | summary: 1 |
|
1973 | | summary: 1 | |
1974 | | |
|
1974 | | | |
1975 | o changeset: 0:f7b1eb17ad24 |
|
1975 | o changeset: 0:f7b1eb17ad24 | |
1976 | user: test |
|
1976 | user: test | |
1977 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1977 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1978 | summary: 0 |
|
1978 | summary: 0 | |
1979 |
|
1979 | |||
1980 | $ hg log -f -G b |
|
1980 | $ hg log -f -G b | |
1981 | @ changeset: 3:9bc8ce7f9356 |
|
1981 | @ changeset: 3:9bc8ce7f9356 | |
1982 | | parent: 0:f7b1eb17ad24 |
|
1982 | | parent: 0:f7b1eb17ad24 | |
1983 | | user: test |
|
1983 | | user: test | |
1984 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1984 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1985 | | summary: 1 |
|
1985 | | summary: 1 | |
1986 | | |
|
1986 | | | |
1987 | $ hg log -G b |
|
1987 | $ hg log -G b | |
1988 | @ changeset: 3:9bc8ce7f9356 |
|
1988 | @ changeset: 3:9bc8ce7f9356 | |
1989 | | parent: 0:f7b1eb17ad24 |
|
1989 | | parent: 0:f7b1eb17ad24 | |
1990 | | user: test |
|
1990 | | user: test | |
1991 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1991 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1992 | | summary: 1 |
|
1992 | | summary: 1 | |
1993 | | |
|
1993 | | | |
1994 | $ cd .. |
|
1994 | $ cd .. | |
1995 |
|
1995 | |||
1996 | Check proper report when the manifest changes but not the file issue4499 |
|
1996 | Check proper report when the manifest changes but not the file issue4499 | |
1997 | ------------------------------------------------------------------------ |
|
1997 | ------------------------------------------------------------------------ | |
1998 |
|
1998 | |||
1999 | $ hg init issue4499 |
|
1999 | $ hg init issue4499 | |
2000 | $ cd issue4499 |
|
2000 | $ cd issue4499 | |
2001 | $ for f in A B C D F E G H I J K L M N O P Q R S T U; do |
|
2001 | $ for f in A B C D F E G H I J K L M N O P Q R S T U; do | |
2002 | > echo 1 > $f; |
|
2002 | > echo 1 > $f; | |
2003 | > hg add $f; |
|
2003 | > hg add $f; | |
2004 | > done |
|
2004 | > done | |
2005 | $ hg commit -m 'A1B1C1' |
|
2005 | $ hg commit -m 'A1B1C1' | |
2006 | $ echo 2 > A |
|
2006 | $ echo 2 > A | |
2007 | $ echo 2 > B |
|
2007 | $ echo 2 > B | |
2008 | $ echo 2 > C |
|
2008 | $ echo 2 > C | |
2009 | $ hg commit -m 'A2B2C2' |
|
2009 | $ hg commit -m 'A2B2C2' | |
2010 | $ hg up 0 |
|
2010 | $ hg up 0 | |
2011 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2011 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2012 | $ echo 3 > A |
|
2012 | $ echo 3 > A | |
2013 | $ echo 2 > B |
|
2013 | $ echo 2 > B | |
2014 | $ echo 2 > C |
|
2014 | $ echo 2 > C | |
2015 | $ hg commit -m 'A3B2C2' |
|
2015 | $ hg commit -m 'A3B2C2' | |
2016 | created new head |
|
2016 | created new head | |
2017 |
|
2017 | |||
2018 | $ hg log -G |
|
2018 | $ hg log -G | |
2019 | @ changeset: 2:fe5fc3d0eb17 |
|
2019 | @ changeset: 2:fe5fc3d0eb17 | |
2020 | | tag: tip |
|
2020 | | tag: tip | |
2021 | | parent: 0:abf4f0e38563 |
|
2021 | | parent: 0:abf4f0e38563 | |
2022 | | user: test |
|
2022 | | user: test | |
2023 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2023 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
2024 | | summary: A3B2C2 |
|
2024 | | summary: A3B2C2 | |
2025 | | |
|
2025 | | | |
2026 | | o changeset: 1:07dcc6b312c0 |
|
2026 | | o changeset: 1:07dcc6b312c0 | |
2027 | |/ user: test |
|
2027 | |/ user: test | |
2028 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2028 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
2029 | | summary: A2B2C2 |
|
2029 | | summary: A2B2C2 | |
2030 | | |
|
2030 | | | |
2031 | o changeset: 0:abf4f0e38563 |
|
2031 | o changeset: 0:abf4f0e38563 | |
2032 | user: test |
|
2032 | user: test | |
2033 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2033 | date: Thu Jan 01 00:00:00 1970 +0000 | |
2034 | summary: A1B1C1 |
|
2034 | summary: A1B1C1 | |
2035 |
|
2035 | |||
2036 |
|
2036 | |||
2037 | Log -f on B should reports current changesets |
|
2037 | Log -f on B should reports current changesets | |
2038 |
|
2038 | |||
2039 | $ hg log -fG B |
|
2039 | $ hg log -fG B | |
2040 | @ changeset: 2:fe5fc3d0eb17 |
|
2040 | @ changeset: 2:fe5fc3d0eb17 | |
2041 | | tag: tip |
|
2041 | | tag: tip | |
2042 | | parent: 0:abf4f0e38563 |
|
2042 | | parent: 0:abf4f0e38563 | |
2043 | | user: test |
|
2043 | | user: test | |
2044 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2044 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
2045 | | summary: A3B2C2 |
|
2045 | | summary: A3B2C2 | |
2046 | | |
|
2046 | | | |
2047 | o changeset: 0:abf4f0e38563 |
|
2047 | o changeset: 0:abf4f0e38563 | |
2048 | user: test |
|
2048 | user: test | |
2049 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2049 | date: Thu Jan 01 00:00:00 1970 +0000 | |
2050 | summary: A1B1C1 |
|
2050 | summary: A1B1C1 | |
2051 |
|
2051 | |||
2052 | $ cd .. |
|
2052 | $ cd .. |
@@ -1,615 +1,621 | |||||
1 | $ hg init test |
|
1 | $ hg init test | |
2 | $ cd test |
|
2 | $ cd test | |
3 |
|
3 | |||
4 | $ echo a > a |
|
4 | $ echo a > a | |
5 | $ hg add a |
|
5 | $ hg add a | |
6 | $ hg commit -m "test" |
|
6 | $ hg commit -m "test" | |
7 | $ hg history |
|
7 | $ hg history | |
8 | changeset: 0:acb14030fe0a |
|
8 | changeset: 0:acb14030fe0a | |
9 | tag: tip |
|
9 | tag: tip | |
10 | user: test |
|
10 | user: test | |
11 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
11 | date: Thu Jan 01 00:00:00 1970 +0000 | |
12 | summary: test |
|
12 | summary: test | |
13 |
|
13 | |||
14 |
|
14 | |||
15 | $ hg tag ' ' |
|
15 | $ hg tag ' ' | |
16 | abort: tag names cannot consist entirely of whitespace |
|
16 | abort: tag names cannot consist entirely of whitespace | |
17 | [255] |
|
17 | [255] | |
18 |
|
18 | |||
19 | (this tests also that editor is not invoked, if '--edit' is not |
|
19 | (this tests also that editor is not invoked, if '--edit' is not | |
20 | specified) |
|
20 | specified) | |
21 |
|
21 | |||
22 | $ HGEDITOR=cat hg tag "bleah" |
|
22 | $ HGEDITOR=cat hg tag "bleah" | |
23 | $ hg history |
|
23 | $ hg history | |
24 | changeset: 1:d4f0d2909abc |
|
24 | changeset: 1:d4f0d2909abc | |
25 | tag: tip |
|
25 | tag: tip | |
26 | user: test |
|
26 | user: test | |
27 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
27 | date: Thu Jan 01 00:00:00 1970 +0000 | |
28 | summary: Added tag bleah for changeset acb14030fe0a |
|
28 | summary: Added tag bleah for changeset acb14030fe0a | |
29 |
|
29 | |||
30 | changeset: 0:acb14030fe0a |
|
30 | changeset: 0:acb14030fe0a | |
31 | tag: bleah |
|
31 | tag: bleah | |
32 | user: test |
|
32 | user: test | |
33 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
33 | date: Thu Jan 01 00:00:00 1970 +0000 | |
34 | summary: test |
|
34 | summary: test | |
35 |
|
35 | |||
36 |
|
36 | |||
37 | $ echo foo >> .hgtags |
|
37 | $ echo foo >> .hgtags | |
38 | $ hg tag "bleah2" |
|
38 | $ hg tag "bleah2" | |
39 | abort: working copy of .hgtags is changed |
|
39 | abort: working copy of .hgtags is changed | |
40 | (please commit .hgtags manually) |
|
40 | (please commit .hgtags manually) | |
41 | [255] |
|
41 | [255] | |
42 |
|
42 | |||
43 | $ hg revert .hgtags |
|
43 | $ hg revert .hgtags | |
44 | $ hg tag -r 0 x y z y y z |
|
44 | $ hg tag -r 0 x y z y y z | |
45 | abort: tag names must be unique |
|
45 | abort: tag names must be unique | |
46 | [255] |
|
46 | [255] | |
47 | $ hg tag tap nada dot tip |
|
47 | $ hg tag tap nada dot tip | |
48 | abort: the name 'tip' is reserved |
|
48 | abort: the name 'tip' is reserved | |
49 | [255] |
|
49 | [255] | |
50 | $ hg tag . |
|
50 | $ hg tag . | |
51 | abort: the name '.' is reserved |
|
51 | abort: the name '.' is reserved | |
52 | [255] |
|
52 | [255] | |
53 | $ hg tag null |
|
53 | $ hg tag null | |
54 | abort: the name 'null' is reserved |
|
54 | abort: the name 'null' is reserved | |
55 | [255] |
|
55 | [255] | |
56 | $ hg tag "bleah" |
|
56 | $ hg tag "bleah" | |
57 | abort: tag 'bleah' already exists (use -f to force) |
|
57 | abort: tag 'bleah' already exists (use -f to force) | |
58 | [255] |
|
58 | [255] | |
59 | $ hg tag "blecch" "bleah" |
|
59 | $ hg tag "blecch" "bleah" | |
60 | abort: tag 'bleah' already exists (use -f to force) |
|
60 | abort: tag 'bleah' already exists (use -f to force) | |
61 | [255] |
|
61 | [255] | |
62 |
|
62 | |||
63 | $ hg tag --remove "blecch" |
|
63 | $ hg tag --remove "blecch" | |
64 | abort: tag 'blecch' does not exist |
|
64 | abort: tag 'blecch' does not exist | |
65 | [255] |
|
65 | [255] | |
66 | $ hg tag --remove "bleah" "blecch" "blough" |
|
66 | $ hg tag --remove "bleah" "blecch" "blough" | |
67 | abort: tag 'blecch' does not exist |
|
67 | abort: tag 'blecch' does not exist | |
68 | [255] |
|
68 | [255] | |
69 |
|
69 | |||
70 | $ hg tag -r 0 "bleah0" |
|
70 | $ hg tag -r 0 "bleah0" | |
71 | $ hg tag -l -r 1 "bleah1" |
|
71 | $ hg tag -l -r 1 "bleah1" | |
72 | $ hg tag gack gawk gorp |
|
72 | $ hg tag gack gawk gorp | |
73 | $ hg tag -f gack |
|
73 | $ hg tag -f gack | |
74 | $ hg tag --remove gack gorp |
|
74 | $ hg tag --remove gack gorp | |
75 |
|
75 | |||
76 | $ hg tag "bleah " |
|
76 | $ hg tag "bleah " | |
77 | abort: tag 'bleah' already exists (use -f to force) |
|
77 | abort: tag 'bleah' already exists (use -f to force) | |
78 | [255] |
|
78 | [255] | |
79 | $ hg tag " bleah" |
|
79 | $ hg tag " bleah" | |
80 | abort: tag 'bleah' already exists (use -f to force) |
|
80 | abort: tag 'bleah' already exists (use -f to force) | |
81 | [255] |
|
81 | [255] | |
82 | $ hg tag " bleah" |
|
82 | $ hg tag " bleah" | |
83 | abort: tag 'bleah' already exists (use -f to force) |
|
83 | abort: tag 'bleah' already exists (use -f to force) | |
84 | [255] |
|
84 | [255] | |
85 | $ hg tag -r 0 " bleahbleah " |
|
85 | $ hg tag -r 0 " bleahbleah " | |
86 | $ hg tag -r 0 " bleah bleah " |
|
86 | $ hg tag -r 0 " bleah bleah " | |
87 |
|
87 | |||
88 | $ cat .hgtags |
|
88 | $ cat .hgtags | |
89 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah |
|
89 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah | |
90 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 |
|
90 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 | |
91 | 336fccc858a4eb69609a291105009e484a6b6b8d gack |
|
91 | 336fccc858a4eb69609a291105009e484a6b6b8d gack | |
92 | 336fccc858a4eb69609a291105009e484a6b6b8d gawk |
|
92 | 336fccc858a4eb69609a291105009e484a6b6b8d gawk | |
93 | 336fccc858a4eb69609a291105009e484a6b6b8d gorp |
|
93 | 336fccc858a4eb69609a291105009e484a6b6b8d gorp | |
94 | 336fccc858a4eb69609a291105009e484a6b6b8d gack |
|
94 | 336fccc858a4eb69609a291105009e484a6b6b8d gack | |
95 | 799667b6f2d9b957f73fa644a918c2df22bab58f gack |
|
95 | 799667b6f2d9b957f73fa644a918c2df22bab58f gack | |
96 | 799667b6f2d9b957f73fa644a918c2df22bab58f gack |
|
96 | 799667b6f2d9b957f73fa644a918c2df22bab58f gack | |
97 | 0000000000000000000000000000000000000000 gack |
|
97 | 0000000000000000000000000000000000000000 gack | |
98 | 336fccc858a4eb69609a291105009e484a6b6b8d gorp |
|
98 | 336fccc858a4eb69609a291105009e484a6b6b8d gorp | |
99 | 0000000000000000000000000000000000000000 gorp |
|
99 | 0000000000000000000000000000000000000000 gorp | |
100 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah |
|
100 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleahbleah | |
101 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah |
|
101 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah bleah | |
102 |
|
102 | |||
103 | $ cat .hg/localtags |
|
103 | $ cat .hg/localtags | |
104 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
104 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 | |
105 |
|
105 | |||
106 | tagging on a non-head revision |
|
106 | tagging on a non-head revision | |
107 |
|
107 | |||
108 | $ hg update 0 |
|
108 | $ hg update 0 | |
109 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
109 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
110 | $ hg tag -l localblah |
|
110 | $ hg tag -l localblah | |
111 | $ hg tag "foobar" |
|
111 | $ hg tag "foobar" | |
112 | abort: not at a branch head (use -f to force) |
|
112 | abort: not at a branch head (use -f to force) | |
113 | [255] |
|
113 | [255] | |
114 | $ hg tag -f "foobar" |
|
114 | $ hg tag -f "foobar" | |
115 | $ cat .hgtags |
|
115 | $ cat .hgtags | |
116 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
116 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar | |
117 | $ cat .hg/localtags |
|
117 | $ cat .hg/localtags | |
118 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 |
|
118 | d4f0d2909abc9290e2773c08837d70c1794e3f5a bleah1 | |
119 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah |
|
119 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah | |
120 |
|
120 | |||
121 | $ hg tag -l 'xx |
|
121 | $ hg tag -l 'xx | |
122 | > newline' |
|
122 | > newline' | |
123 | abort: '\n' cannot be used in a name |
|
123 | abort: '\n' cannot be used in a name | |
124 | [255] |
|
124 | [255] | |
125 | $ hg tag -l 'xx:xx' |
|
125 | $ hg tag -l 'xx:xx' | |
126 | abort: ':' cannot be used in a name |
|
126 | abort: ':' cannot be used in a name | |
127 | [255] |
|
127 | [255] | |
128 |
|
128 | |||
129 | cloning local tags |
|
129 | cloning local tags | |
130 |
|
130 | |||
131 | $ cd .. |
|
131 | $ cd .. | |
132 | $ hg -R test log -r0:5 |
|
132 | $ hg -R test log -r0:5 | |
133 | changeset: 0:acb14030fe0a |
|
133 | changeset: 0:acb14030fe0a | |
134 | tag: bleah |
|
134 | tag: bleah | |
135 | tag: bleah bleah |
|
135 | tag: bleah bleah | |
136 | tag: bleah0 |
|
136 | tag: bleah0 | |
137 | tag: bleahbleah |
|
137 | tag: bleahbleah | |
138 | tag: foobar |
|
138 | tag: foobar | |
139 | tag: localblah |
|
139 | tag: localblah | |
140 | user: test |
|
140 | user: test | |
141 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
141 | date: Thu Jan 01 00:00:00 1970 +0000 | |
142 | summary: test |
|
142 | summary: test | |
143 |
|
143 | |||
144 | changeset: 1:d4f0d2909abc |
|
144 | changeset: 1:d4f0d2909abc | |
145 | tag: bleah1 |
|
145 | tag: bleah1 | |
146 | user: test |
|
146 | user: test | |
147 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
147 | date: Thu Jan 01 00:00:00 1970 +0000 | |
148 | summary: Added tag bleah for changeset acb14030fe0a |
|
148 | summary: Added tag bleah for changeset acb14030fe0a | |
149 |
|
149 | |||
150 | changeset: 2:336fccc858a4 |
|
150 | changeset: 2:336fccc858a4 | |
151 | tag: gawk |
|
151 | tag: gawk | |
152 | user: test |
|
152 | user: test | |
153 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
153 | date: Thu Jan 01 00:00:00 1970 +0000 | |
154 | summary: Added tag bleah0 for changeset acb14030fe0a |
|
154 | summary: Added tag bleah0 for changeset acb14030fe0a | |
155 |
|
155 | |||
156 | changeset: 3:799667b6f2d9 |
|
156 | changeset: 3:799667b6f2d9 | |
157 | user: test |
|
157 | user: test | |
158 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
158 | date: Thu Jan 01 00:00:00 1970 +0000 | |
159 | summary: Added tag gack, gawk, gorp for changeset 336fccc858a4 |
|
159 | summary: Added tag gack, gawk, gorp for changeset 336fccc858a4 | |
160 |
|
160 | |||
161 | changeset: 4:154eeb7c0138 |
|
161 | changeset: 4:154eeb7c0138 | |
162 | user: test |
|
162 | user: test | |
163 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
163 | date: Thu Jan 01 00:00:00 1970 +0000 | |
164 | summary: Added tag gack for changeset 799667b6f2d9 |
|
164 | summary: Added tag gack for changeset 799667b6f2d9 | |
165 |
|
165 | |||
166 | changeset: 5:b4bb47aaff09 |
|
166 | changeset: 5:b4bb47aaff09 | |
167 | user: test |
|
167 | user: test | |
168 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
168 | date: Thu Jan 01 00:00:00 1970 +0000 | |
169 | summary: Removed tag gack, gorp |
|
169 | summary: Removed tag gack, gorp | |
170 |
|
170 | |||
171 | $ hg clone -q -rbleah1 test test1 |
|
171 | $ hg clone -q -rbleah1 test test1 | |
172 | $ hg -R test1 parents --style=compact |
|
172 | $ hg -R test1 parents --style=compact | |
173 | 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test |
|
173 | 1[tip] d4f0d2909abc 1970-01-01 00:00 +0000 test | |
174 | Added tag bleah for changeset acb14030fe0a |
|
174 | Added tag bleah for changeset acb14030fe0a | |
175 |
|
175 | |||
176 | $ hg clone -q -r5 test#bleah1 test2 |
|
176 | $ hg clone -q -r5 test#bleah1 test2 | |
177 | $ hg -R test2 parents --style=compact |
|
177 | $ hg -R test2 parents --style=compact | |
178 | 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test |
|
178 | 5[tip] b4bb47aaff09 1970-01-01 00:00 +0000 test | |
179 | Removed tag gack, gorp |
|
179 | Removed tag gack, gorp | |
180 |
|
180 | |||
181 | $ hg clone -q -U test#bleah1 test3 |
|
181 | $ hg clone -q -U test#bleah1 test3 | |
182 | $ hg -R test3 parents --style=compact |
|
182 | $ hg -R test3 parents --style=compact | |
183 |
|
183 | |||
184 | $ cd test |
|
184 | $ cd test | |
185 |
|
185 | |||
186 | Issue601: hg tag doesn't do the right thing if .hgtags or localtags |
|
186 | Issue601: hg tag doesn't do the right thing if .hgtags or localtags | |
187 | doesn't end with EOL |
|
187 | doesn't end with EOL | |
188 |
|
188 | |||
189 | $ python << EOF |
|
189 | $ python << EOF | |
190 | > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close() |
|
190 | > f = file('.hg/localtags'); last = f.readlines()[-1][:-1]; f.close() | |
191 | > f = file('.hg/localtags', 'w'); f.write(last); f.close() |
|
191 | > f = file('.hg/localtags', 'w'); f.write(last); f.close() | |
192 | > EOF |
|
192 | > EOF | |
193 | $ cat .hg/localtags; echo |
|
193 | $ cat .hg/localtags; echo | |
194 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah |
|
194 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah | |
195 | $ hg tag -l localnewline |
|
195 | $ hg tag -l localnewline | |
196 | $ cat .hg/localtags; echo |
|
196 | $ cat .hg/localtags; echo | |
197 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah |
|
197 | acb14030fe0a21b60322c440ad2d20cf7685a376 localblah | |
198 | c2899151f4e76890c602a2597a650a72666681bf localnewline |
|
198 | c2899151f4e76890c602a2597a650a72666681bf localnewline | |
199 |
|
199 | |||
200 |
|
200 | |||
201 | $ python << EOF |
|
201 | $ python << EOF | |
202 | > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close() |
|
202 | > f = file('.hgtags'); last = f.readlines()[-1][:-1]; f.close() | |
203 | > f = file('.hgtags', 'w'); f.write(last); f.close() |
|
203 | > f = file('.hgtags', 'w'); f.write(last); f.close() | |
204 | > EOF |
|
204 | > EOF | |
205 | $ hg ci -m'broken manual edit of .hgtags' |
|
205 | $ hg ci -m'broken manual edit of .hgtags' | |
206 | $ cat .hgtags; echo |
|
206 | $ cat .hgtags; echo | |
207 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
207 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar | |
208 | $ hg tag newline |
|
208 | $ hg tag newline | |
209 | $ cat .hgtags; echo |
|
209 | $ cat .hgtags; echo | |
210 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar |
|
210 | acb14030fe0a21b60322c440ad2d20cf7685a376 foobar | |
211 | a0eea09de1eeec777b46f2085260a373b2fbc293 newline |
|
211 | a0eea09de1eeec777b46f2085260a373b2fbc293 newline | |
212 |
|
212 | |||
213 |
|
213 | |||
214 | tag and branch using same name |
|
214 | tag and branch using same name | |
215 |
|
215 | |||
216 | $ hg branch tag-and-branch-same-name |
|
216 | $ hg branch tag-and-branch-same-name | |
217 | marked working directory as branch tag-and-branch-same-name |
|
217 | marked working directory as branch tag-and-branch-same-name | |
218 | (branches are permanent and global, did you want a bookmark?) |
|
218 | (branches are permanent and global, did you want a bookmark?) | |
219 | $ hg ci -m"discouraged" |
|
219 | $ hg ci -m"discouraged" | |
220 | $ hg tag tag-and-branch-same-name |
|
220 | $ hg tag tag-and-branch-same-name | |
221 | warning: tag tag-and-branch-same-name conflicts with existing branch name |
|
221 | warning: tag tag-and-branch-same-name conflicts with existing branch name | |
222 |
|
222 | |||
223 | test custom commit messages |
|
223 | test custom commit messages | |
224 |
|
224 | |||
225 | $ cat > editor.sh << '__EOF__' |
|
225 | $ cat > editor.sh << '__EOF__' | |
226 | > echo "==== before editing" |
|
226 | > echo "==== before editing" | |
227 | > cat "$1" |
|
227 | > cat "$1" | |
228 | > echo "====" |
|
228 | > echo "====" | |
229 | > echo "custom tag message" > "$1" |
|
229 | > echo "custom tag message" > "$1" | |
230 | > echo "second line" >> "$1" |
|
230 | > echo "second line" >> "$1" | |
231 | > __EOF__ |
|
231 | > __EOF__ | |
232 |
|
232 | |||
233 | at first, test saving last-message.txt |
|
233 | at first, test saving last-message.txt | |
234 |
|
234 | |||
235 | (test that editor is not invoked before transaction starting) |
|
235 | (test that editor is not invoked before transaction starting) | |
236 |
|
236 | |||
237 | $ cat > .hg/hgrc << '__EOF__' |
|
237 | $ cat > .hg/hgrc << '__EOF__' | |
238 | > [hooks] |
|
238 | > [hooks] | |
239 | > # this failure occurs before editor invocation |
|
239 | > # this failure occurs before editor invocation | |
240 | > pretag.test-saving-lastmessage = false |
|
240 | > pretag.test-saving-lastmessage = false | |
241 | > __EOF__ |
|
241 | > __EOF__ | |
242 | $ rm -f .hg/last-message.txt |
|
242 | $ rm -f .hg/last-message.txt | |
243 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e |
|
243 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e | |
244 | abort: pretag.test-saving-lastmessage hook exited with status 1 |
|
244 | abort: pretag.test-saving-lastmessage hook exited with status 1 | |
245 | [255] |
|
245 | [255] | |
246 | $ test -f .hg/last-message.txt |
|
246 | $ test -f .hg/last-message.txt | |
247 | [1] |
|
247 | [1] | |
248 |
|
248 | |||
249 | (test that editor is invoked and commit message is saved into |
|
249 | (test that editor is invoked and commit message is saved into | |
250 | "last-message.txt") |
|
250 | "last-message.txt") | |
251 |
|
251 | |||
252 | $ cat >> .hg/hgrc << '__EOF__' |
|
252 | $ cat >> .hg/hgrc << '__EOF__' | |
253 | > [hooks] |
|
253 | > [hooks] | |
254 | > pretag.test-saving-lastmessage = |
|
254 | > pretag.test-saving-lastmessage = | |
255 | > # this failure occurs after editor invocation |
|
255 | > # this failure occurs after editor invocation | |
256 | > pretxncommit.unexpectedabort = false |
|
256 | > pretxncommit.unexpectedabort = false | |
257 | > __EOF__ |
|
257 | > __EOF__ | |
258 |
|
258 | |||
259 | (this tests also that editor is invoked, if '--edit' is specified, |
|
259 | (this tests also that editor is invoked, if '--edit' is specified, | |
260 | regardless of '--message') |
|
260 | regardless of '--message') | |
261 |
|
261 | |||
262 | $ rm -f .hg/last-message.txt |
|
262 | $ rm -f .hg/last-message.txt | |
263 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar" |
|
263 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e -m "foo bar" | |
264 | ==== before editing |
|
264 | ==== before editing | |
265 | foo bar |
|
265 | foo bar | |
266 |
|
266 | |||
267 |
|
267 | |||
268 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
268 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
269 | HG: Leave message empty to abort commit. |
|
269 | HG: Leave message empty to abort commit. | |
270 | HG: -- |
|
270 | HG: -- | |
271 | HG: user: test |
|
271 | HG: user: test | |
272 | HG: branch 'tag-and-branch-same-name' |
|
272 | HG: branch 'tag-and-branch-same-name' | |
273 | HG: changed .hgtags |
|
273 | HG: changed .hgtags | |
274 | ==== |
|
274 | ==== | |
275 | transaction abort! |
|
275 | transaction abort! | |
276 | rollback completed |
|
276 | rollback completed | |
277 | note: commit message saved in .hg/last-message.txt |
|
277 | note: commit message saved in .hg/last-message.txt | |
278 | abort: pretxncommit.unexpectedabort hook exited with status 1 |
|
278 | abort: pretxncommit.unexpectedabort hook exited with status 1 | |
279 | [255] |
|
279 | [255] | |
280 | $ cat .hg/last-message.txt |
|
280 | $ cat .hg/last-message.txt | |
281 | custom tag message |
|
281 | custom tag message | |
282 | second line |
|
282 | second line | |
283 |
|
283 | |||
284 | $ cat >> .hg/hgrc << '__EOF__' |
|
284 | $ cat >> .hg/hgrc << '__EOF__' | |
285 | > [hooks] |
|
285 | > [hooks] | |
286 | > pretxncommit.unexpectedabort = |
|
286 | > pretxncommit.unexpectedabort = | |
287 | > __EOF__ |
|
287 | > __EOF__ | |
288 | $ hg status .hgtags |
|
288 | $ hg status .hgtags | |
289 | M .hgtags |
|
289 | M .hgtags | |
290 | $ hg revert --no-backup -q .hgtags |
|
290 | $ hg revert --no-backup -q .hgtags | |
291 |
|
291 | |||
292 | then, test custom commit message itself |
|
292 | then, test custom commit message itself | |
293 |
|
293 | |||
294 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e |
|
294 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e | |
295 | ==== before editing |
|
295 | ==== before editing | |
296 | Added tag custom-tag for changeset 75a534207be6 |
|
296 | Added tag custom-tag for changeset 75a534207be6 | |
297 |
|
297 | |||
298 |
|
298 | |||
299 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
299 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
300 | HG: Leave message empty to abort commit. |
|
300 | HG: Leave message empty to abort commit. | |
301 | HG: -- |
|
301 | HG: -- | |
302 | HG: user: test |
|
302 | HG: user: test | |
303 | HG: branch 'tag-and-branch-same-name' |
|
303 | HG: branch 'tag-and-branch-same-name' | |
304 | HG: changed .hgtags |
|
304 | HG: changed .hgtags | |
305 | ==== |
|
305 | ==== | |
306 | $ hg log -l1 --template "{desc}\n" |
|
306 | $ hg log -l1 --template "{desc}\n" | |
307 | custom tag message |
|
307 | custom tag message | |
308 | second line |
|
308 | second line | |
309 |
|
309 | |||
310 |
|
310 | |||
311 | local tag with .hgtags modified |
|
311 | local tag with .hgtags modified | |
312 |
|
312 | |||
313 | $ hg tag hgtags-modified |
|
313 | $ hg tag hgtags-modified | |
314 | $ hg rollback |
|
314 | $ hg rollback | |
315 | repository tip rolled back to revision 13 (undo commit) |
|
315 | repository tip rolled back to revision 13 (undo commit) | |
316 | working directory now based on revision 13 |
|
316 | working directory now based on revision 13 | |
317 | $ hg st |
|
317 | $ hg st | |
318 | M .hgtags |
|
318 | M .hgtags | |
319 | ? .hgtags.orig |
|
319 | ? .hgtags.orig | |
320 | ? editor.sh |
|
320 | ? editor.sh | |
321 | $ hg tag --local baz |
|
321 | $ hg tag --local baz | |
322 | $ hg revert --no-backup .hgtags |
|
322 | $ hg revert --no-backup .hgtags | |
323 |
|
323 | |||
324 |
|
324 | |||
325 | tagging when at named-branch-head that's not a topo-head |
|
325 | tagging when at named-branch-head that's not a topo-head | |
326 |
|
326 | |||
327 | $ hg up default |
|
327 | $ hg up default | |
328 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
328 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
329 | $ hg merge -t internal:local |
|
329 | $ hg merge -t internal:local | |
330 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
330 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
331 | (branch merge, don't forget to commit) |
|
331 | (branch merge, don't forget to commit) | |
332 | $ hg ci -m 'merge named branch' |
|
332 | $ hg ci -m 'merge named branch' | |
333 | $ hg up 13 |
|
333 | $ hg up 13 | |
334 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
334 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
335 | $ hg tag new-topo-head |
|
335 | $ hg tag new-topo-head | |
336 |
|
336 | |||
337 | tagging on null rev |
|
337 | tagging on null rev | |
338 |
|
338 | |||
339 | $ hg up null |
|
339 | $ hg up null | |
340 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
340 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
341 | $ hg tag nullrev |
|
341 | $ hg tag nullrev | |
342 | abort: not at a branch head (use -f to force) |
|
342 | abort: not at a branch head (use -f to force) | |
343 | [255] |
|
343 | [255] | |
344 |
|
344 | |||
345 | $ hg init empty |
|
345 | $ hg init empty | |
346 | $ hg tag -R empty nullrev |
|
346 | $ hg tag -R empty nullrev | |
347 | abort: cannot tag null revision |
|
347 | abort: cannot tag null revision | |
348 | [255] |
|
348 | [255] | |
349 |
|
349 | |||
350 | $ hg tag -R empty -r 00000000000 -f nulltag |
|
350 | $ hg tag -R empty -r 00000000000 -f nulltag | |
351 | abort: cannot tag null revision |
|
351 | abort: cannot tag null revision | |
352 | [255] |
|
352 | [255] | |
353 |
|
353 | |||
354 | $ cd .. |
|
354 | $ cd .. | |
355 |
|
355 | |||
356 | tagging on an uncommitted merge (issue2542) |
|
356 | tagging on an uncommitted merge (issue2542) | |
357 |
|
357 | |||
358 | $ hg init repo-tag-uncommitted-merge |
|
358 | $ hg init repo-tag-uncommitted-merge | |
359 | $ cd repo-tag-uncommitted-merge |
|
359 | $ cd repo-tag-uncommitted-merge | |
360 | $ echo c1 > f1 |
|
360 | $ echo c1 > f1 | |
361 | $ hg ci -Am0 |
|
361 | $ hg ci -Am0 | |
362 | adding f1 |
|
362 | adding f1 | |
363 | $ echo c2 > f2 |
|
363 | $ echo c2 > f2 | |
364 | $ hg ci -Am1 |
|
364 | $ hg ci -Am1 | |
365 | adding f2 |
|
365 | adding f2 | |
366 | $ hg co -q 0 |
|
366 | $ hg co -q 0 | |
367 | $ hg branch b1 |
|
367 | $ hg branch b1 | |
368 | marked working directory as branch b1 |
|
368 | marked working directory as branch b1 | |
369 | (branches are permanent and global, did you want a bookmark?) |
|
369 | (branches are permanent and global, did you want a bookmark?) | |
370 | $ hg ci -m2 |
|
370 | $ hg ci -m2 | |
371 | $ hg up default |
|
371 | $ hg up default | |
372 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
372 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
373 | $ hg merge b1 |
|
373 | $ hg merge b1 | |
374 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
374 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
375 | (branch merge, don't forget to commit) |
|
375 | (branch merge, don't forget to commit) | |
376 |
|
376 | |||
377 | $ hg tag t1 |
|
377 | $ hg tag t1 | |
378 | abort: uncommitted merge |
|
378 | abort: uncommitted merge | |
379 | [255] |
|
379 | [255] | |
380 | $ hg status |
|
380 | $ hg status | |
381 | $ hg tag --rev 1 t2 |
|
381 | $ hg tag --rev 1 t2 | |
382 | abort: uncommitted merge |
|
382 | abort: uncommitted merge | |
383 | [255] |
|
383 | [255] | |
384 | $ hg tag --rev 1 --local t3 |
|
384 | $ hg tag --rev 1 --local t3 | |
385 | $ hg tags -v |
|
385 | $ hg tags -v | |
386 | tip 2:2a156e8887cc |
|
386 | tip 2:2a156e8887cc | |
387 | t3 1:c3adabd1a5f4 local |
|
387 | t3 1:c3adabd1a5f4 local | |
388 |
|
388 | |||
389 | $ cd .. |
|
389 | $ cd .. | |
390 |
|
390 | |||
391 | commit hook on tag used to be run without write lock - issue3344 |
|
391 | commit hook on tag used to be run without write lock - issue3344 | |
392 |
|
392 | |||
393 | $ hg init repo-tag |
|
393 | $ hg init repo-tag | |
394 | $ touch repo-tag/test |
|
394 | $ touch repo-tag/test | |
395 | $ hg -R repo-tag commit -A -m "test" |
|
395 | $ hg -R repo-tag commit -A -m "test" | |
396 | adding test |
|
396 | adding test | |
397 | $ hg init repo-tag-target |
|
397 | $ hg init repo-tag-target | |
398 | $ cat > "$TESTTMP/issue3344.sh" <<EOF |
|
398 | $ cat > "$TESTTMP/issue3344.sh" <<EOF | |
399 | > hg push "$TESTTMP/repo-tag-target" |
|
399 | > hg push "$TESTTMP/repo-tag-target" | |
400 | > EOF |
|
400 | > EOF | |
401 | $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag |
|
401 | $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag | |
402 | pushing to $TESTTMP/repo-tag-target (glob) |
|
402 | pushing to $TESTTMP/repo-tag-target (glob) | |
403 | searching for changes |
|
403 | searching for changes | |
404 | adding changesets |
|
404 | adding changesets | |
405 | adding manifests |
|
405 | adding manifests | |
406 | adding file changes |
|
406 | adding file changes | |
407 | added 2 changesets with 2 changes to 2 files |
|
407 | added 2 changesets with 2 changes to 2 files | |
408 |
|
408 | |||
409 | automatically merge resolvable tag conflicts (i.e. tags that differ in rank) |
|
409 | automatically merge resolvable tag conflicts (i.e. tags that differ in rank) | |
410 | create two clones with some different tags as well as some common tags |
|
410 | create two clones with some different tags as well as some common tags | |
411 | check that we can merge tags that differ in rank |
|
411 | check that we can merge tags that differ in rank | |
412 |
|
412 | |||
413 | $ hg init repo-automatic-tag-merge |
|
413 | $ hg init repo-automatic-tag-merge | |
414 | $ cd repo-automatic-tag-merge |
|
414 | $ cd repo-automatic-tag-merge | |
415 | $ echo c0 > f0 |
|
415 | $ echo c0 > f0 | |
416 | $ hg ci -A -m0 |
|
416 | $ hg ci -A -m0 | |
417 | adding f0 |
|
417 | adding f0 | |
418 | $ hg tag tbase |
|
418 | $ hg tag tbase | |
|
419 | $ hg up -qr '.^' | |||
|
420 | $ hg log -r 'wdir()' -T "{latesttagdistance}\n" | |||
|
421 | 1 | |||
|
422 | $ hg up -q | |||
|
423 | $ hg log -r 'wdir()' -T "{latesttagdistance}\n" | |||
|
424 | 2 | |||
419 | $ cd .. |
|
425 | $ cd .. | |
420 | $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone |
|
426 | $ hg clone repo-automatic-tag-merge repo-automatic-tag-merge-clone | |
421 | updating to branch default |
|
427 | updating to branch default | |
422 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
428 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
423 | $ cd repo-automatic-tag-merge-clone |
|
429 | $ cd repo-automatic-tag-merge-clone | |
424 | $ echo c1 > f1 |
|
430 | $ echo c1 > f1 | |
425 | $ hg ci -A -m1 |
|
431 | $ hg ci -A -m1 | |
426 | adding f1 |
|
432 | adding f1 | |
427 | $ hg tag t1 t2 t3 |
|
433 | $ hg tag t1 t2 t3 | |
428 | $ hg tag --remove t2 |
|
434 | $ hg tag --remove t2 | |
429 | $ hg tag t5 |
|
435 | $ hg tag t5 | |
430 | $ echo c2 > f2 |
|
436 | $ echo c2 > f2 | |
431 | $ hg ci -A -m2 |
|
437 | $ hg ci -A -m2 | |
432 | adding f2 |
|
438 | adding f2 | |
433 | $ hg tag -f t3 |
|
439 | $ hg tag -f t3 | |
434 |
|
440 | |||
435 | $ cd ../repo-automatic-tag-merge |
|
441 | $ cd ../repo-automatic-tag-merge | |
436 | $ echo c3 > f3 |
|
442 | $ echo c3 > f3 | |
437 | $ hg ci -A -m3 |
|
443 | $ hg ci -A -m3 | |
438 | adding f3 |
|
444 | adding f3 | |
439 | $ hg tag -f t4 t5 t6 |
|
445 | $ hg tag -f t4 t5 t6 | |
440 | $ hg tag --remove t5 |
|
446 | $ hg tag --remove t5 | |
441 | $ echo c4 > f4 |
|
447 | $ echo c4 > f4 | |
442 | $ hg ci -A -m4 |
|
448 | $ hg ci -A -m4 | |
443 | adding f4 |
|
449 | adding f4 | |
444 | $ hg tag t2 |
|
450 | $ hg tag t2 | |
445 | $ hg tag -f t6 |
|
451 | $ hg tag -f t6 | |
446 |
|
452 | |||
447 | $ cd ../repo-automatic-tag-merge-clone |
|
453 | $ cd ../repo-automatic-tag-merge-clone | |
448 | $ hg pull |
|
454 | $ hg pull | |
449 | pulling from $TESTTMP/repo-automatic-tag-merge (glob) |
|
455 | pulling from $TESTTMP/repo-automatic-tag-merge (glob) | |
450 | searching for changes |
|
456 | searching for changes | |
451 | adding changesets |
|
457 | adding changesets | |
452 | adding manifests |
|
458 | adding manifests | |
453 | adding file changes |
|
459 | adding file changes | |
454 | added 6 changesets with 6 changes to 3 files (+1 heads) |
|
460 | added 6 changesets with 6 changes to 3 files (+1 heads) | |
455 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
461 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
456 | $ hg merge --tool internal:tagmerge |
|
462 | $ hg merge --tool internal:tagmerge | |
457 | merging .hgtags |
|
463 | merging .hgtags | |
458 | 2 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
464 | 2 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
459 | (branch merge, don't forget to commit) |
|
465 | (branch merge, don't forget to commit) | |
460 | $ hg status |
|
466 | $ hg status | |
461 | M .hgtags |
|
467 | M .hgtags | |
462 | M f3 |
|
468 | M f3 | |
463 | M f4 |
|
469 | M f4 | |
464 | $ hg resolve -l |
|
470 | $ hg resolve -l | |
465 | R .hgtags |
|
471 | R .hgtags | |
466 | $ cat .hgtags |
|
472 | $ cat .hgtags | |
467 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t4 |
|
473 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t4 | |
468 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
474 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 | |
469 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
475 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t6 | |
470 | 09af2ce14077a94effef208b49a718f4836d4338 t6 |
|
476 | 09af2ce14077a94effef208b49a718f4836d4338 t6 | |
471 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
477 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase | |
472 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
478 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 | |
473 | 929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
479 | 929bca7b18d067cbf3844c3896319a940059d748 t2 | |
474 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
480 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
475 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
481 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
476 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
482 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
477 | 0000000000000000000000000000000000000000 t2 |
|
483 | 0000000000000000000000000000000000000000 t2 | |
478 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
484 | 875517b4806a848f942811a315a5bce30804ae85 t5 | |
479 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
485 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 | |
480 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
486 | 9aa4e1292a27a248f8d07339bed9931d54907be7 t5 | |
481 | 0000000000000000000000000000000000000000 t5 |
|
487 | 0000000000000000000000000000000000000000 t5 | |
482 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
488 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
483 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
489 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 | |
484 |
|
490 | |||
485 | check that the merge tried to minimize the diff with the first merge parent |
|
491 | check that the merge tried to minimize the diff with the first merge parent | |
486 |
|
492 | |||
487 | $ hg diff --git -r 'p1()' .hgtags |
|
493 | $ hg diff --git -r 'p1()' .hgtags | |
488 | diff --git a/.hgtags b/.hgtags |
|
494 | diff --git a/.hgtags b/.hgtags | |
489 | --- a/.hgtags |
|
495 | --- a/.hgtags | |
490 | +++ b/.hgtags |
|
496 | +++ b/.hgtags | |
491 | @@ -1,9 +1,17 @@ |
|
497 | @@ -1,9 +1,17 @@ | |
492 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t4 |
|
498 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t4 | |
493 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
499 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t6 | |
494 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t6 |
|
500 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t6 | |
495 | +09af2ce14077a94effef208b49a718f4836d4338 t6 |
|
501 | +09af2ce14077a94effef208b49a718f4836d4338 t6 | |
496 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
502 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase | |
497 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
503 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 | |
498 | +929bca7b18d067cbf3844c3896319a940059d748 t2 |
|
504 | +929bca7b18d067cbf3844c3896319a940059d748 t2 | |
499 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
505 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
500 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
506 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
501 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
507 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
502 | 0000000000000000000000000000000000000000 t2 |
|
508 | 0000000000000000000000000000000000000000 t2 | |
503 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
509 | 875517b4806a848f942811a315a5bce30804ae85 t5 | |
504 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
510 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t5 | |
505 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t5 |
|
511 | +9aa4e1292a27a248f8d07339bed9931d54907be7 t5 | |
506 | +0000000000000000000000000000000000000000 t5 |
|
512 | +0000000000000000000000000000000000000000 t5 | |
507 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
513 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
508 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
514 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 | |
509 |
|
515 | |||
510 | detect merge tag conflicts |
|
516 | detect merge tag conflicts | |
511 |
|
517 | |||
512 | $ hg update -C -r tip |
|
518 | $ hg update -C -r tip | |
513 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
519 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
514 | $ hg tag t7 |
|
520 | $ hg tag t7 | |
515 | $ hg update -C -r 'first(sort(head()))' |
|
521 | $ hg update -C -r 'first(sort(head()))' | |
516 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
522 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
517 | $ printf "%s %s\n" `hg log -r . --template "{node} t7"` >> .hgtags |
|
523 | $ printf "%s %s\n" `hg log -r . --template "{node} t7"` >> .hgtags | |
518 | $ hg commit -m "manually add conflicting t7 tag" |
|
524 | $ hg commit -m "manually add conflicting t7 tag" | |
519 | $ hg merge --tool internal:tagmerge |
|
525 | $ hg merge --tool internal:tagmerge | |
520 | merging .hgtags |
|
526 | merging .hgtags | |
521 | automatic .hgtags merge failed |
|
527 | automatic .hgtags merge failed | |
522 | the following 1 tags are in conflict: t7 |
|
528 | the following 1 tags are in conflict: t7 | |
523 | automatic tag merging of .hgtags failed! (use 'hg resolve --tool :merge' or another merge tool of your choice) |
|
529 | automatic tag merging of .hgtags failed! (use 'hg resolve --tool :merge' or another merge tool of your choice) | |
524 | 2 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
530 | 2 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
525 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
531 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon | |
526 | [1] |
|
532 | [1] | |
527 | $ hg resolve -l |
|
533 | $ hg resolve -l | |
528 | U .hgtags |
|
534 | U .hgtags | |
529 | $ cat .hgtags |
|
535 | $ cat .hgtags | |
530 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
536 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase | |
531 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
537 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 | |
532 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
538 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
533 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
539 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
534 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
540 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
535 | 0000000000000000000000000000000000000000 t2 |
|
541 | 0000000000000000000000000000000000000000 t2 | |
536 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
542 | 875517b4806a848f942811a315a5bce30804ae85 t5 | |
537 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
543 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
538 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
544 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 | |
539 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
545 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 | |
540 |
|
546 | |||
541 | $ cd .. |
|
547 | $ cd .. | |
542 |
|
548 | |||
543 | handle the loss of tags |
|
549 | handle the loss of tags | |
544 |
|
550 | |||
545 | $ hg clone repo-automatic-tag-merge-clone repo-merge-lost-tags |
|
551 | $ hg clone repo-automatic-tag-merge-clone repo-merge-lost-tags | |
546 | updating to branch default |
|
552 | updating to branch default | |
547 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
553 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
548 | $ cd repo-merge-lost-tags |
|
554 | $ cd repo-merge-lost-tags | |
549 | $ echo c5 > f5 |
|
555 | $ echo c5 > f5 | |
550 | $ hg ci -A -m5 |
|
556 | $ hg ci -A -m5 | |
551 | adding f5 |
|
557 | adding f5 | |
552 | $ hg tag -f t7 |
|
558 | $ hg tag -f t7 | |
553 | $ hg update -r 'p1(t7)' |
|
559 | $ hg update -r 'p1(t7)' | |
554 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
560 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
555 | $ printf '' > .hgtags |
|
561 | $ printf '' > .hgtags | |
556 | $ hg commit -m 'delete all tags' |
|
562 | $ hg commit -m 'delete all tags' | |
557 | created new head |
|
563 | created new head | |
558 | $ hg log -r 'max(t7::)' |
|
564 | $ hg log -r 'max(t7::)' | |
559 | changeset: 17:ffe462b50880 |
|
565 | changeset: 17:ffe462b50880 | |
560 | user: test |
|
566 | user: test | |
561 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
567 | date: Thu Jan 01 00:00:00 1970 +0000 | |
562 | summary: Added tag t7 for changeset fd3a9e394ce3 |
|
568 | summary: Added tag t7 for changeset fd3a9e394ce3 | |
563 |
|
569 | |||
564 | $ hg update -r 'max(t7::)' |
|
570 | $ hg update -r 'max(t7::)' | |
565 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
571 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
566 | $ hg merge -r tip --tool internal:tagmerge |
|
572 | $ hg merge -r tip --tool internal:tagmerge | |
567 | merging .hgtags |
|
573 | merging .hgtags | |
568 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
574 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
569 | (branch merge, don't forget to commit) |
|
575 | (branch merge, don't forget to commit) | |
570 | $ hg resolve -l |
|
576 | $ hg resolve -l | |
571 | R .hgtags |
|
577 | R .hgtags | |
572 | $ cat .hgtags |
|
578 | $ cat .hgtags | |
573 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
579 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase | |
574 | 0000000000000000000000000000000000000000 tbase |
|
580 | 0000000000000000000000000000000000000000 tbase | |
575 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
581 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 | |
576 | 0000000000000000000000000000000000000000 t1 |
|
582 | 0000000000000000000000000000000000000000 t1 | |
577 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
583 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
578 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
584 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
579 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
585 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
580 | 0000000000000000000000000000000000000000 t2 |
|
586 | 0000000000000000000000000000000000000000 t2 | |
581 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
587 | 875517b4806a848f942811a315a5bce30804ae85 t5 | |
582 | 0000000000000000000000000000000000000000 t5 |
|
588 | 0000000000000000000000000000000000000000 t5 | |
583 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
589 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
584 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
590 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 | |
585 | 0000000000000000000000000000000000000000 t3 |
|
591 | 0000000000000000000000000000000000000000 t3 | |
586 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
592 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 | |
587 | 0000000000000000000000000000000000000000 t7 |
|
593 | 0000000000000000000000000000000000000000 t7 | |
588 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
594 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 | |
589 | fd3a9e394ce3afb354a496323bf68ac1755a30de t7 |
|
595 | fd3a9e394ce3afb354a496323bf68ac1755a30de t7 | |
590 |
|
596 | |||
591 | also check that we minimize the diff with the 1st merge parent |
|
597 | also check that we minimize the diff with the 1st merge parent | |
592 |
|
598 | |||
593 | $ hg diff --git -r 'p1()' .hgtags |
|
599 | $ hg diff --git -r 'p1()' .hgtags | |
594 | diff --git a/.hgtags b/.hgtags |
|
600 | diff --git a/.hgtags b/.hgtags | |
595 | --- a/.hgtags |
|
601 | --- a/.hgtags | |
596 | +++ b/.hgtags |
|
602 | +++ b/.hgtags | |
597 | @@ -1,12 +1,17 @@ |
|
603 | @@ -1,12 +1,17 @@ | |
598 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase |
|
604 | 6cee5c8f3e5b4ae1a3996d2f6489c3e08eb5aea7 tbase | |
599 | +0000000000000000000000000000000000000000 tbase |
|
605 | +0000000000000000000000000000000000000000 tbase | |
600 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 |
|
606 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t1 | |
601 | +0000000000000000000000000000000000000000 t1 |
|
607 | +0000000000000000000000000000000000000000 t1 | |
602 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
608 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
603 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
609 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
604 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 |
|
610 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t2 | |
605 | 0000000000000000000000000000000000000000 t2 |
|
611 | 0000000000000000000000000000000000000000 t2 | |
606 | 875517b4806a848f942811a315a5bce30804ae85 t5 |
|
612 | 875517b4806a848f942811a315a5bce30804ae85 t5 | |
607 | +0000000000000000000000000000000000000000 t5 |
|
613 | +0000000000000000000000000000000000000000 t5 | |
608 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 |
|
614 | 4f3e9b90005b68b4d8a3f4355cedc302a8364f5c t3 | |
609 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 |
|
615 | 79505d5360b07e3e79d1052e347e73c02b8afa5b t3 | |
610 | +0000000000000000000000000000000000000000 t3 |
|
616 | +0000000000000000000000000000000000000000 t3 | |
611 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
617 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 | |
612 | +0000000000000000000000000000000000000000 t7 |
|
618 | +0000000000000000000000000000000000000000 t7 | |
613 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 |
|
619 | ea918d56be86a4afc5a95312e8b6750e1428d9d2 t7 | |
614 | fd3a9e394ce3afb354a496323bf68ac1755a30de t7 |
|
620 | fd3a9e394ce3afb354a496323bf68ac1755a30de t7 | |
615 |
|
621 |
General Comments 0
You need to be logged in to leave comments.
Login now