Show More
@@ -1,3541 +1,3545 b'' | |||||
1 | # cmdutil.py - help for command processing in mercurial |
|
1 | # cmdutil.py - help for command processing in mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-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 __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import errno |
|
10 | import errno | |
11 | import os |
|
11 | import os | |
12 | import re |
|
12 | import re | |
13 | import sys |
|
13 | import sys | |
14 | import tempfile |
|
14 | import tempfile | |
15 |
|
15 | |||
16 | from .i18n import _ |
|
16 | from .i18n import _ | |
17 | from .node import ( |
|
17 | from .node import ( | |
18 | bin, |
|
18 | bin, | |
19 | hex, |
|
19 | hex, | |
20 | nullid, |
|
20 | nullid, | |
21 | nullrev, |
|
21 | nullrev, | |
22 | short, |
|
22 | short, | |
23 | ) |
|
23 | ) | |
24 |
|
24 | |||
25 | from . import ( |
|
25 | from . import ( | |
26 | bookmarks, |
|
26 | bookmarks, | |
27 | changelog, |
|
27 | changelog, | |
28 | copies, |
|
28 | copies, | |
29 | crecord as crecordmod, |
|
29 | crecord as crecordmod, | |
30 | encoding, |
|
30 | encoding, | |
31 | error, |
|
31 | error, | |
32 | formatter, |
|
32 | formatter, | |
33 | graphmod, |
|
33 | graphmod, | |
34 | lock as lockmod, |
|
34 | lock as lockmod, | |
35 | match as matchmod, |
|
35 | match as matchmod, | |
36 | obsolete, |
|
36 | obsolete, | |
37 | patch, |
|
37 | patch, | |
38 | pathutil, |
|
38 | pathutil, | |
39 | phases, |
|
39 | phases, | |
40 | repair, |
|
40 | repair, | |
41 | revlog, |
|
41 | revlog, | |
42 | revset, |
|
42 | revset, | |
43 | scmutil, |
|
43 | scmutil, | |
44 | templatekw, |
|
44 | templatekw, | |
45 | templater, |
|
45 | templater, | |
46 | util, |
|
46 | util, | |
47 | ) |
|
47 | ) | |
48 | stringio = util.stringio |
|
48 | stringio = util.stringio | |
49 |
|
49 | |||
50 | def ishunk(x): |
|
50 | def ishunk(x): | |
51 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) |
|
51 | hunkclasses = (crecordmod.uihunk, patch.recordhunk) | |
52 | return isinstance(x, hunkclasses) |
|
52 | return isinstance(x, hunkclasses) | |
53 |
|
53 | |||
54 | def newandmodified(chunks, originalchunks): |
|
54 | def newandmodified(chunks, originalchunks): | |
55 | newlyaddedandmodifiedfiles = set() |
|
55 | newlyaddedandmodifiedfiles = set() | |
56 | for chunk in chunks: |
|
56 | for chunk in chunks: | |
57 | if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \ |
|
57 | if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \ | |
58 | originalchunks: |
|
58 | originalchunks: | |
59 | newlyaddedandmodifiedfiles.add(chunk.header.filename()) |
|
59 | newlyaddedandmodifiedfiles.add(chunk.header.filename()) | |
60 | return newlyaddedandmodifiedfiles |
|
60 | return newlyaddedandmodifiedfiles | |
61 |
|
61 | |||
62 | def parsealiases(cmd): |
|
62 | def parsealiases(cmd): | |
63 | return cmd.lstrip("^").split("|") |
|
63 | return cmd.lstrip("^").split("|") | |
64 |
|
64 | |||
65 | def setupwrapcolorwrite(ui): |
|
65 | def setupwrapcolorwrite(ui): | |
66 | # wrap ui.write so diff output can be labeled/colorized |
|
66 | # wrap ui.write so diff output can be labeled/colorized | |
67 | def wrapwrite(orig, *args, **kw): |
|
67 | def wrapwrite(orig, *args, **kw): | |
68 | label = kw.pop('label', '') |
|
68 | label = kw.pop('label', '') | |
69 | for chunk, l in patch.difflabel(lambda: args): |
|
69 | for chunk, l in patch.difflabel(lambda: args): | |
70 | orig(chunk, label=label + l) |
|
70 | orig(chunk, label=label + l) | |
71 |
|
71 | |||
72 | oldwrite = ui.write |
|
72 | oldwrite = ui.write | |
73 | def wrap(*args, **kwargs): |
|
73 | def wrap(*args, **kwargs): | |
74 | return wrapwrite(oldwrite, *args, **kwargs) |
|
74 | return wrapwrite(oldwrite, *args, **kwargs) | |
75 | setattr(ui, 'write', wrap) |
|
75 | setattr(ui, 'write', wrap) | |
76 | return oldwrite |
|
76 | return oldwrite | |
77 |
|
77 | |||
78 | def filterchunks(ui, originalhunks, usecurses, testfile, operation=None): |
|
78 | def filterchunks(ui, originalhunks, usecurses, testfile, operation=None): | |
79 | if usecurses: |
|
79 | if usecurses: | |
80 | if testfile: |
|
80 | if testfile: | |
81 | recordfn = crecordmod.testdecorator(testfile, |
|
81 | recordfn = crecordmod.testdecorator(testfile, | |
82 | crecordmod.testchunkselector) |
|
82 | crecordmod.testchunkselector) | |
83 | else: |
|
83 | else: | |
84 | recordfn = crecordmod.chunkselector |
|
84 | recordfn = crecordmod.chunkselector | |
85 |
|
85 | |||
86 | return crecordmod.filterpatch(ui, originalhunks, recordfn, operation) |
|
86 | return crecordmod.filterpatch(ui, originalhunks, recordfn, operation) | |
87 |
|
87 | |||
88 | else: |
|
88 | else: | |
89 | return patch.filterpatch(ui, originalhunks, operation) |
|
89 | return patch.filterpatch(ui, originalhunks, operation) | |
90 |
|
90 | |||
91 | def recordfilter(ui, originalhunks, operation=None): |
|
91 | def recordfilter(ui, originalhunks, operation=None): | |
92 | """ Prompts the user to filter the originalhunks and return a list of |
|
92 | """ Prompts the user to filter the originalhunks and return a list of | |
93 | selected hunks. |
|
93 | selected hunks. | |
94 | *operation* is used for ui purposes to indicate the user |
|
94 | *operation* is used for ui purposes to indicate the user | |
95 | what kind of filtering they are doing: reverting, committing, shelving, etc. |
|
95 | what kind of filtering they are doing: reverting, committing, shelving, etc. | |
96 | *operation* has to be a translated string. |
|
96 | *operation* has to be a translated string. | |
97 | """ |
|
97 | """ | |
98 | usecurses = crecordmod.checkcurses(ui) |
|
98 | usecurses = crecordmod.checkcurses(ui) | |
99 | testfile = ui.config('experimental', 'crecordtest', None) |
|
99 | testfile = ui.config('experimental', 'crecordtest', None) | |
100 | oldwrite = setupwrapcolorwrite(ui) |
|
100 | oldwrite = setupwrapcolorwrite(ui) | |
101 | try: |
|
101 | try: | |
102 | newchunks, newopts = filterchunks(ui, originalhunks, usecurses, |
|
102 | newchunks, newopts = filterchunks(ui, originalhunks, usecurses, | |
103 | testfile, operation) |
|
103 | testfile, operation) | |
104 | finally: |
|
104 | finally: | |
105 | ui.write = oldwrite |
|
105 | ui.write = oldwrite | |
106 | return newchunks, newopts |
|
106 | return newchunks, newopts | |
107 |
|
107 | |||
108 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, |
|
108 | def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, | |
109 | filterfn, *pats, **opts): |
|
109 | filterfn, *pats, **opts): | |
110 | from . import merge as mergemod |
|
110 | from . import merge as mergemod | |
111 | if not ui.interactive(): |
|
111 | if not ui.interactive(): | |
112 | if cmdsuggest: |
|
112 | if cmdsuggest: | |
113 | msg = _('running non-interactively, use %s instead') % cmdsuggest |
|
113 | msg = _('running non-interactively, use %s instead') % cmdsuggest | |
114 | else: |
|
114 | else: | |
115 | msg = _('running non-interactively') |
|
115 | msg = _('running non-interactively') | |
116 | raise error.Abort(msg) |
|
116 | raise error.Abort(msg) | |
117 |
|
117 | |||
118 | # make sure username is set before going interactive |
|
118 | # make sure username is set before going interactive | |
119 | if not opts.get('user'): |
|
119 | if not opts.get('user'): | |
120 | ui.username() # raise exception, username not provided |
|
120 | ui.username() # raise exception, username not provided | |
121 |
|
121 | |||
122 | def recordfunc(ui, repo, message, match, opts): |
|
122 | def recordfunc(ui, repo, message, match, opts): | |
123 | """This is generic record driver. |
|
123 | """This is generic record driver. | |
124 |
|
124 | |||
125 | Its job is to interactively filter local changes, and |
|
125 | Its job is to interactively filter local changes, and | |
126 | accordingly prepare working directory into a state in which the |
|
126 | accordingly prepare working directory into a state in which the | |
127 | job can be delegated to a non-interactive commit command such as |
|
127 | job can be delegated to a non-interactive commit command such as | |
128 | 'commit' or 'qrefresh'. |
|
128 | 'commit' or 'qrefresh'. | |
129 |
|
129 | |||
130 | After the actual job is done by non-interactive command, the |
|
130 | After the actual job is done by non-interactive command, the | |
131 | working directory is restored to its original state. |
|
131 | working directory is restored to its original state. | |
132 |
|
132 | |||
133 | In the end we'll record interesting changes, and everything else |
|
133 | In the end we'll record interesting changes, and everything else | |
134 | will be left in place, so the user can continue working. |
|
134 | will be left in place, so the user can continue working. | |
135 | """ |
|
135 | """ | |
136 |
|
136 | |||
137 | checkunfinished(repo, commit=True) |
|
137 | checkunfinished(repo, commit=True) | |
138 | wctx = repo[None] |
|
138 | wctx = repo[None] | |
139 | merge = len(wctx.parents()) > 1 |
|
139 | merge = len(wctx.parents()) > 1 | |
140 | if merge: |
|
140 | if merge: | |
141 | raise error.Abort(_('cannot partially commit a merge ' |
|
141 | raise error.Abort(_('cannot partially commit a merge ' | |
142 | '(use "hg commit" instead)')) |
|
142 | '(use "hg commit" instead)')) | |
143 |
|
143 | |||
144 | def fail(f, msg): |
|
144 | def fail(f, msg): | |
145 | raise error.Abort('%s: %s' % (f, msg)) |
|
145 | raise error.Abort('%s: %s' % (f, msg)) | |
146 |
|
146 | |||
147 | force = opts.get('force') |
|
147 | force = opts.get('force') | |
148 | if not force: |
|
148 | if not force: | |
149 | vdirs = [] |
|
149 | vdirs = [] | |
150 | match.explicitdir = vdirs.append |
|
150 | match.explicitdir = vdirs.append | |
151 | match.bad = fail |
|
151 | match.bad = fail | |
152 |
|
152 | |||
153 | status = repo.status(match=match) |
|
153 | status = repo.status(match=match) | |
154 | if not force: |
|
154 | if not force: | |
155 | repo.checkcommitpatterns(wctx, vdirs, match, status, fail) |
|
155 | repo.checkcommitpatterns(wctx, vdirs, match, status, fail) | |
156 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) |
|
156 | diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True) | |
157 | diffopts.nodates = True |
|
157 | diffopts.nodates = True | |
158 | diffopts.git = True |
|
158 | diffopts.git = True | |
159 | diffopts.showfunc = True |
|
159 | diffopts.showfunc = True | |
160 | originaldiff = patch.diff(repo, changes=status, opts=diffopts) |
|
160 | originaldiff = patch.diff(repo, changes=status, opts=diffopts) | |
161 | originalchunks = patch.parsepatch(originaldiff) |
|
161 | originalchunks = patch.parsepatch(originaldiff) | |
162 |
|
162 | |||
163 | # 1. filter patch, since we are intending to apply subset of it |
|
163 | # 1. filter patch, since we are intending to apply subset of it | |
164 | try: |
|
164 | try: | |
165 | chunks, newopts = filterfn(ui, originalchunks) |
|
165 | chunks, newopts = filterfn(ui, originalchunks) | |
166 | except patch.PatchError as err: |
|
166 | except patch.PatchError as err: | |
167 | raise error.Abort(_('error parsing patch: %s') % err) |
|
167 | raise error.Abort(_('error parsing patch: %s') % err) | |
168 | opts.update(newopts) |
|
168 | opts.update(newopts) | |
169 |
|
169 | |||
170 | # We need to keep a backup of files that have been newly added and |
|
170 | # We need to keep a backup of files that have been newly added and | |
171 | # modified during the recording process because there is a previous |
|
171 | # modified during the recording process because there is a previous | |
172 | # version without the edit in the workdir |
|
172 | # version without the edit in the workdir | |
173 | newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) |
|
173 | newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) | |
174 | contenders = set() |
|
174 | contenders = set() | |
175 | for h in chunks: |
|
175 | for h in chunks: | |
176 | try: |
|
176 | try: | |
177 | contenders.update(set(h.files())) |
|
177 | contenders.update(set(h.files())) | |
178 | except AttributeError: |
|
178 | except AttributeError: | |
179 | pass |
|
179 | pass | |
180 |
|
180 | |||
181 | changed = status.modified + status.added + status.removed |
|
181 | changed = status.modified + status.added + status.removed | |
182 | newfiles = [f for f in changed if f in contenders] |
|
182 | newfiles = [f for f in changed if f in contenders] | |
183 | if not newfiles: |
|
183 | if not newfiles: | |
184 | ui.status(_('no changes to record\n')) |
|
184 | ui.status(_('no changes to record\n')) | |
185 | return 0 |
|
185 | return 0 | |
186 |
|
186 | |||
187 | modified = set(status.modified) |
|
187 | modified = set(status.modified) | |
188 |
|
188 | |||
189 | # 2. backup changed files, so we can restore them in the end |
|
189 | # 2. backup changed files, so we can restore them in the end | |
190 |
|
190 | |||
191 | if backupall: |
|
191 | if backupall: | |
192 | tobackup = changed |
|
192 | tobackup = changed | |
193 | else: |
|
193 | else: | |
194 | tobackup = [f for f in newfiles if f in modified or f in \ |
|
194 | tobackup = [f for f in newfiles if f in modified or f in \ | |
195 | newlyaddedandmodifiedfiles] |
|
195 | newlyaddedandmodifiedfiles] | |
196 | backups = {} |
|
196 | backups = {} | |
197 | if tobackup: |
|
197 | if tobackup: | |
198 | backupdir = repo.join('record-backups') |
|
198 | backupdir = repo.join('record-backups') | |
199 | try: |
|
199 | try: | |
200 | os.mkdir(backupdir) |
|
200 | os.mkdir(backupdir) | |
201 | except OSError as err: |
|
201 | except OSError as err: | |
202 | if err.errno != errno.EEXIST: |
|
202 | if err.errno != errno.EEXIST: | |
203 | raise |
|
203 | raise | |
204 | try: |
|
204 | try: | |
205 | # backup continues |
|
205 | # backup continues | |
206 | for f in tobackup: |
|
206 | for f in tobackup: | |
207 | fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.', |
|
207 | fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.', | |
208 | dir=backupdir) |
|
208 | dir=backupdir) | |
209 | os.close(fd) |
|
209 | os.close(fd) | |
210 | ui.debug('backup %r as %r\n' % (f, tmpname)) |
|
210 | ui.debug('backup %r as %r\n' % (f, tmpname)) | |
211 | util.copyfile(repo.wjoin(f), tmpname, copystat=True) |
|
211 | util.copyfile(repo.wjoin(f), tmpname, copystat=True) | |
212 | backups[f] = tmpname |
|
212 | backups[f] = tmpname | |
213 |
|
213 | |||
214 | fp = stringio() |
|
214 | fp = stringio() | |
215 | for c in chunks: |
|
215 | for c in chunks: | |
216 | fname = c.filename() |
|
216 | fname = c.filename() | |
217 | if fname in backups: |
|
217 | if fname in backups: | |
218 | c.write(fp) |
|
218 | c.write(fp) | |
219 | dopatch = fp.tell() |
|
219 | dopatch = fp.tell() | |
220 | fp.seek(0) |
|
220 | fp.seek(0) | |
221 |
|
221 | |||
222 | # 2.5 optionally review / modify patch in text editor |
|
222 | # 2.5 optionally review / modify patch in text editor | |
223 | if opts.get('review', False): |
|
223 | if opts.get('review', False): | |
224 | patchtext = (crecordmod.diffhelptext |
|
224 | patchtext = (crecordmod.diffhelptext | |
225 | + crecordmod.patchhelptext |
|
225 | + crecordmod.patchhelptext | |
226 | + fp.read()) |
|
226 | + fp.read()) | |
227 | reviewedpatch = ui.edit(patchtext, "", |
|
227 | reviewedpatch = ui.edit(patchtext, "", | |
228 | extra={"suffix": ".diff"}) |
|
228 | extra={"suffix": ".diff"}) | |
229 | fp.truncate(0) |
|
229 | fp.truncate(0) | |
230 | fp.write(reviewedpatch) |
|
230 | fp.write(reviewedpatch) | |
231 | fp.seek(0) |
|
231 | fp.seek(0) | |
232 |
|
232 | |||
233 | [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles] |
|
233 | [os.unlink(repo.wjoin(c)) for c in newlyaddedandmodifiedfiles] | |
234 | # 3a. apply filtered patch to clean repo (clean) |
|
234 | # 3a. apply filtered patch to clean repo (clean) | |
235 | if backups: |
|
235 | if backups: | |
236 | # Equivalent to hg.revert |
|
236 | # Equivalent to hg.revert | |
237 | m = scmutil.matchfiles(repo, backups.keys()) |
|
237 | m = scmutil.matchfiles(repo, backups.keys()) | |
238 | mergemod.update(repo, repo.dirstate.p1(), |
|
238 | mergemod.update(repo, repo.dirstate.p1(), | |
239 | False, True, matcher=m) |
|
239 | False, True, matcher=m) | |
240 |
|
240 | |||
241 | # 3b. (apply) |
|
241 | # 3b. (apply) | |
242 | if dopatch: |
|
242 | if dopatch: | |
243 | try: |
|
243 | try: | |
244 | ui.debug('applying patch\n') |
|
244 | ui.debug('applying patch\n') | |
245 | ui.debug(fp.getvalue()) |
|
245 | ui.debug(fp.getvalue()) | |
246 | patch.internalpatch(ui, repo, fp, 1, eolmode=None) |
|
246 | patch.internalpatch(ui, repo, fp, 1, eolmode=None) | |
247 | except patch.PatchError as err: |
|
247 | except patch.PatchError as err: | |
248 | raise error.Abort(str(err)) |
|
248 | raise error.Abort(str(err)) | |
249 | del fp |
|
249 | del fp | |
250 |
|
250 | |||
251 | # 4. We prepared working directory according to filtered |
|
251 | # 4. We prepared working directory according to filtered | |
252 | # patch. Now is the time to delegate the job to |
|
252 | # patch. Now is the time to delegate the job to | |
253 | # commit/qrefresh or the like! |
|
253 | # commit/qrefresh or the like! | |
254 |
|
254 | |||
255 | # Make all of the pathnames absolute. |
|
255 | # Make all of the pathnames absolute. | |
256 | newfiles = [repo.wjoin(nf) for nf in newfiles] |
|
256 | newfiles = [repo.wjoin(nf) for nf in newfiles] | |
257 | return commitfunc(ui, repo, *newfiles, **opts) |
|
257 | return commitfunc(ui, repo, *newfiles, **opts) | |
258 | finally: |
|
258 | finally: | |
259 | # 5. finally restore backed-up files |
|
259 | # 5. finally restore backed-up files | |
260 | try: |
|
260 | try: | |
261 | dirstate = repo.dirstate |
|
261 | dirstate = repo.dirstate | |
262 | for realname, tmpname in backups.iteritems(): |
|
262 | for realname, tmpname in backups.iteritems(): | |
263 | ui.debug('restoring %r to %r\n' % (tmpname, realname)) |
|
263 | ui.debug('restoring %r to %r\n' % (tmpname, realname)) | |
264 |
|
264 | |||
265 | if dirstate[realname] == 'n': |
|
265 | if dirstate[realname] == 'n': | |
266 | # without normallookup, restoring timestamp |
|
266 | # without normallookup, restoring timestamp | |
267 | # may cause partially committed files |
|
267 | # may cause partially committed files | |
268 | # to be treated as unmodified |
|
268 | # to be treated as unmodified | |
269 | dirstate.normallookup(realname) |
|
269 | dirstate.normallookup(realname) | |
270 |
|
270 | |||
271 | # copystat=True here and above are a hack to trick any |
|
271 | # copystat=True here and above are a hack to trick any | |
272 | # editors that have f open that we haven't modified them. |
|
272 | # editors that have f open that we haven't modified them. | |
273 | # |
|
273 | # | |
274 | # Also note that this racy as an editor could notice the |
|
274 | # Also note that this racy as an editor could notice the | |
275 | # file's mtime before we've finished writing it. |
|
275 | # file's mtime before we've finished writing it. | |
276 | util.copyfile(tmpname, repo.wjoin(realname), copystat=True) |
|
276 | util.copyfile(tmpname, repo.wjoin(realname), copystat=True) | |
277 | os.unlink(tmpname) |
|
277 | os.unlink(tmpname) | |
278 | if tobackup: |
|
278 | if tobackup: | |
279 | os.rmdir(backupdir) |
|
279 | os.rmdir(backupdir) | |
280 | except OSError: |
|
280 | except OSError: | |
281 | pass |
|
281 | pass | |
282 |
|
282 | |||
283 | def recordinwlock(ui, repo, message, match, opts): |
|
283 | def recordinwlock(ui, repo, message, match, opts): | |
284 | with repo.wlock(): |
|
284 | with repo.wlock(): | |
285 | return recordfunc(ui, repo, message, match, opts) |
|
285 | return recordfunc(ui, repo, message, match, opts) | |
286 |
|
286 | |||
287 | return commit(ui, repo, recordinwlock, pats, opts) |
|
287 | return commit(ui, repo, recordinwlock, pats, opts) | |
288 |
|
288 | |||
289 | def findpossible(cmd, table, strict=False): |
|
289 | def findpossible(cmd, table, strict=False): | |
290 | """ |
|
290 | """ | |
291 | Return cmd -> (aliases, command table entry) |
|
291 | Return cmd -> (aliases, command table entry) | |
292 | for each matching command. |
|
292 | for each matching command. | |
293 | Return debug commands (or their aliases) only if no normal command matches. |
|
293 | Return debug commands (or their aliases) only if no normal command matches. | |
294 | """ |
|
294 | """ | |
295 | choice = {} |
|
295 | choice = {} | |
296 | debugchoice = {} |
|
296 | debugchoice = {} | |
297 |
|
297 | |||
298 | if cmd in table: |
|
298 | if cmd in table: | |
299 | # short-circuit exact matches, "log" alias beats "^log|history" |
|
299 | # short-circuit exact matches, "log" alias beats "^log|history" | |
300 | keys = [cmd] |
|
300 | keys = [cmd] | |
301 | else: |
|
301 | else: | |
302 | keys = table.keys() |
|
302 | keys = table.keys() | |
303 |
|
303 | |||
304 | allcmds = [] |
|
304 | allcmds = [] | |
305 | for e in keys: |
|
305 | for e in keys: | |
306 | aliases = parsealiases(e) |
|
306 | aliases = parsealiases(e) | |
307 | allcmds.extend(aliases) |
|
307 | allcmds.extend(aliases) | |
308 | found = None |
|
308 | found = None | |
309 | if cmd in aliases: |
|
309 | if cmd in aliases: | |
310 | found = cmd |
|
310 | found = cmd | |
311 | elif not strict: |
|
311 | elif not strict: | |
312 | for a in aliases: |
|
312 | for a in aliases: | |
313 | if a.startswith(cmd): |
|
313 | if a.startswith(cmd): | |
314 | found = a |
|
314 | found = a | |
315 | break |
|
315 | break | |
316 | if found is not None: |
|
316 | if found is not None: | |
317 | if aliases[0].startswith("debug") or found.startswith("debug"): |
|
317 | if aliases[0].startswith("debug") or found.startswith("debug"): | |
318 | debugchoice[found] = (aliases, table[e]) |
|
318 | debugchoice[found] = (aliases, table[e]) | |
319 | else: |
|
319 | else: | |
320 | choice[found] = (aliases, table[e]) |
|
320 | choice[found] = (aliases, table[e]) | |
321 |
|
321 | |||
322 | if not choice and debugchoice: |
|
322 | if not choice and debugchoice: | |
323 | choice = debugchoice |
|
323 | choice = debugchoice | |
324 |
|
324 | |||
325 | return choice, allcmds |
|
325 | return choice, allcmds | |
326 |
|
326 | |||
327 | def findcmd(cmd, table, strict=True): |
|
327 | def findcmd(cmd, table, strict=True): | |
328 | """Return (aliases, command table entry) for command string.""" |
|
328 | """Return (aliases, command table entry) for command string.""" | |
329 | choice, allcmds = findpossible(cmd, table, strict) |
|
329 | choice, allcmds = findpossible(cmd, table, strict) | |
330 |
|
330 | |||
331 | if cmd in choice: |
|
331 | if cmd in choice: | |
332 | return choice[cmd] |
|
332 | return choice[cmd] | |
333 |
|
333 | |||
334 | if len(choice) > 1: |
|
334 | if len(choice) > 1: | |
335 | clist = choice.keys() |
|
335 | clist = choice.keys() | |
336 | clist.sort() |
|
336 | clist.sort() | |
337 | raise error.AmbiguousCommand(cmd, clist) |
|
337 | raise error.AmbiguousCommand(cmd, clist) | |
338 |
|
338 | |||
339 | if choice: |
|
339 | if choice: | |
340 | return choice.values()[0] |
|
340 | return choice.values()[0] | |
341 |
|
341 | |||
342 | raise error.UnknownCommand(cmd, allcmds) |
|
342 | raise error.UnknownCommand(cmd, allcmds) | |
343 |
|
343 | |||
344 | def findrepo(p): |
|
344 | def findrepo(p): | |
345 | while not os.path.isdir(os.path.join(p, ".hg")): |
|
345 | while not os.path.isdir(os.path.join(p, ".hg")): | |
346 | oldp, p = p, os.path.dirname(p) |
|
346 | oldp, p = p, os.path.dirname(p) | |
347 | if p == oldp: |
|
347 | if p == oldp: | |
348 | return None |
|
348 | return None | |
349 |
|
349 | |||
350 | return p |
|
350 | return p | |
351 |
|
351 | |||
352 | def bailifchanged(repo, merge=True): |
|
352 | def bailifchanged(repo, merge=True): | |
353 | if merge and repo.dirstate.p2() != nullid: |
|
353 | if merge and repo.dirstate.p2() != nullid: | |
354 | raise error.Abort(_('outstanding uncommitted merge')) |
|
354 | raise error.Abort(_('outstanding uncommitted merge')) | |
355 | modified, added, removed, deleted = repo.status()[:4] |
|
355 | modified, added, removed, deleted = repo.status()[:4] | |
356 | if modified or added or removed or deleted: |
|
356 | if modified or added or removed or deleted: | |
357 | raise error.Abort(_('uncommitted changes')) |
|
357 | raise error.Abort(_('uncommitted changes')) | |
358 | ctx = repo[None] |
|
358 | ctx = repo[None] | |
359 | for s in sorted(ctx.substate): |
|
359 | for s in sorted(ctx.substate): | |
360 | ctx.sub(s).bailifchanged() |
|
360 | ctx.sub(s).bailifchanged() | |
361 |
|
361 | |||
362 | def logmessage(ui, opts): |
|
362 | def logmessage(ui, opts): | |
363 | """ get the log message according to -m and -l option """ |
|
363 | """ get the log message according to -m and -l option """ | |
364 | message = opts.get('message') |
|
364 | message = opts.get('message') | |
365 | logfile = opts.get('logfile') |
|
365 | logfile = opts.get('logfile') | |
366 |
|
366 | |||
367 | if message and logfile: |
|
367 | if message and logfile: | |
368 | raise error.Abort(_('options --message and --logfile are mutually ' |
|
368 | raise error.Abort(_('options --message and --logfile are mutually ' | |
369 | 'exclusive')) |
|
369 | 'exclusive')) | |
370 | if not message and logfile: |
|
370 | if not message and logfile: | |
371 | try: |
|
371 | try: | |
372 | if logfile == '-': |
|
372 | if logfile == '-': | |
373 | message = ui.fin.read() |
|
373 | message = ui.fin.read() | |
374 | else: |
|
374 | else: | |
375 | message = '\n'.join(util.readfile(logfile).splitlines()) |
|
375 | message = '\n'.join(util.readfile(logfile).splitlines()) | |
376 | except IOError as inst: |
|
376 | except IOError as inst: | |
377 | raise error.Abort(_("can't read commit message '%s': %s") % |
|
377 | raise error.Abort(_("can't read commit message '%s': %s") % | |
378 | (logfile, inst.strerror)) |
|
378 | (logfile, inst.strerror)) | |
379 | return message |
|
379 | return message | |
380 |
|
380 | |||
381 | def mergeeditform(ctxorbool, baseformname): |
|
381 | def mergeeditform(ctxorbool, baseformname): | |
382 | """return appropriate editform name (referencing a committemplate) |
|
382 | """return appropriate editform name (referencing a committemplate) | |
383 |
|
383 | |||
384 | 'ctxorbool' is either a ctx to be committed, or a bool indicating whether |
|
384 | 'ctxorbool' is either a ctx to be committed, or a bool indicating whether | |
385 | merging is committed. |
|
385 | merging is committed. | |
386 |
|
386 | |||
387 | This returns baseformname with '.merge' appended if it is a merge, |
|
387 | This returns baseformname with '.merge' appended if it is a merge, | |
388 | otherwise '.normal' is appended. |
|
388 | otherwise '.normal' is appended. | |
389 | """ |
|
389 | """ | |
390 | if isinstance(ctxorbool, bool): |
|
390 | if isinstance(ctxorbool, bool): | |
391 | if ctxorbool: |
|
391 | if ctxorbool: | |
392 | return baseformname + ".merge" |
|
392 | return baseformname + ".merge" | |
393 | elif 1 < len(ctxorbool.parents()): |
|
393 | elif 1 < len(ctxorbool.parents()): | |
394 | return baseformname + ".merge" |
|
394 | return baseformname + ".merge" | |
395 |
|
395 | |||
396 | return baseformname + ".normal" |
|
396 | return baseformname + ".normal" | |
397 |
|
397 | |||
398 | def getcommiteditor(edit=False, finishdesc=None, extramsg=None, |
|
398 | def getcommiteditor(edit=False, finishdesc=None, extramsg=None, | |
399 | editform='', **opts): |
|
399 | editform='', **opts): | |
400 | """get appropriate commit message editor according to '--edit' option |
|
400 | """get appropriate commit message editor according to '--edit' option | |
401 |
|
401 | |||
402 | 'finishdesc' is a function to be called with edited commit message |
|
402 | 'finishdesc' is a function to be called with edited commit message | |
403 | (= 'description' of the new changeset) just after editing, but |
|
403 | (= 'description' of the new changeset) just after editing, but | |
404 | before checking empty-ness. It should return actual text to be |
|
404 | before checking empty-ness. It should return actual text to be | |
405 | stored into history. This allows to change description before |
|
405 | stored into history. This allows to change description before | |
406 | storing. |
|
406 | storing. | |
407 |
|
407 | |||
408 | 'extramsg' is a extra message to be shown in the editor instead of |
|
408 | 'extramsg' is a extra message to be shown in the editor instead of | |
409 | 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL |
|
409 | 'Leave message empty to abort commit' line. 'HG: ' prefix and EOL | |
410 | is automatically added. |
|
410 | is automatically added. | |
411 |
|
411 | |||
412 | 'editform' is a dot-separated list of names, to distinguish |
|
412 | 'editform' is a dot-separated list of names, to distinguish | |
413 | the purpose of commit text editing. |
|
413 | the purpose of commit text editing. | |
414 |
|
414 | |||
415 | 'getcommiteditor' returns 'commitforceeditor' regardless of |
|
415 | 'getcommiteditor' returns 'commitforceeditor' regardless of | |
416 | 'edit', if one of 'finishdesc' or 'extramsg' is specified, because |
|
416 | 'edit', if one of 'finishdesc' or 'extramsg' is specified, because | |
417 | they are specific for usage in MQ. |
|
417 | they are specific for usage in MQ. | |
418 | """ |
|
418 | """ | |
419 | if edit or finishdesc or extramsg: |
|
419 | if edit or finishdesc or extramsg: | |
420 | return lambda r, c, s: commitforceeditor(r, c, s, |
|
420 | return lambda r, c, s: commitforceeditor(r, c, s, | |
421 | finishdesc=finishdesc, |
|
421 | finishdesc=finishdesc, | |
422 | extramsg=extramsg, |
|
422 | extramsg=extramsg, | |
423 | editform=editform) |
|
423 | editform=editform) | |
424 | elif editform: |
|
424 | elif editform: | |
425 | return lambda r, c, s: commiteditor(r, c, s, editform=editform) |
|
425 | return lambda r, c, s: commiteditor(r, c, s, editform=editform) | |
426 | else: |
|
426 | else: | |
427 | return commiteditor |
|
427 | return commiteditor | |
428 |
|
428 | |||
429 | def loglimit(opts): |
|
429 | def loglimit(opts): | |
430 | """get the log limit according to option -l/--limit""" |
|
430 | """get the log limit according to option -l/--limit""" | |
431 | limit = opts.get('limit') |
|
431 | limit = opts.get('limit') | |
432 | if limit: |
|
432 | if limit: | |
433 | try: |
|
433 | try: | |
434 | limit = int(limit) |
|
434 | limit = int(limit) | |
435 | except ValueError: |
|
435 | except ValueError: | |
436 | raise error.Abort(_('limit must be a positive integer')) |
|
436 | raise error.Abort(_('limit must be a positive integer')) | |
437 | if limit <= 0: |
|
437 | if limit <= 0: | |
438 | raise error.Abort(_('limit must be positive')) |
|
438 | raise error.Abort(_('limit must be positive')) | |
439 | else: |
|
439 | else: | |
440 | limit = None |
|
440 | limit = None | |
441 | return limit |
|
441 | return limit | |
442 |
|
442 | |||
443 | def makefilename(repo, pat, node, desc=None, |
|
443 | def makefilename(repo, pat, node, desc=None, | |
444 | total=None, seqno=None, revwidth=None, pathname=None): |
|
444 | total=None, seqno=None, revwidth=None, pathname=None): | |
445 | node_expander = { |
|
445 | node_expander = { | |
446 | 'H': lambda: hex(node), |
|
446 | 'H': lambda: hex(node), | |
447 | 'R': lambda: str(repo.changelog.rev(node)), |
|
447 | 'R': lambda: str(repo.changelog.rev(node)), | |
448 | 'h': lambda: short(node), |
|
448 | 'h': lambda: short(node), | |
449 | 'm': lambda: re.sub('[^\w]', '_', str(desc)) |
|
449 | 'm': lambda: re.sub('[^\w]', '_', str(desc)) | |
450 | } |
|
450 | } | |
451 | expander = { |
|
451 | expander = { | |
452 | '%': lambda: '%', |
|
452 | '%': lambda: '%', | |
453 | 'b': lambda: os.path.basename(repo.root), |
|
453 | 'b': lambda: os.path.basename(repo.root), | |
454 | } |
|
454 | } | |
455 |
|
455 | |||
456 | try: |
|
456 | try: | |
457 | if node: |
|
457 | if node: | |
458 | expander.update(node_expander) |
|
458 | expander.update(node_expander) | |
459 | if node: |
|
459 | if node: | |
460 | expander['r'] = (lambda: |
|
460 | expander['r'] = (lambda: | |
461 | str(repo.changelog.rev(node)).zfill(revwidth or 0)) |
|
461 | str(repo.changelog.rev(node)).zfill(revwidth or 0)) | |
462 | if total is not None: |
|
462 | if total is not None: | |
463 | expander['N'] = lambda: str(total) |
|
463 | expander['N'] = lambda: str(total) | |
464 | if seqno is not None: |
|
464 | if seqno is not None: | |
465 | expander['n'] = lambda: str(seqno) |
|
465 | expander['n'] = lambda: str(seqno) | |
466 | if total is not None and seqno is not None: |
|
466 | if total is not None and seqno is not None: | |
467 | expander['n'] = lambda: str(seqno).zfill(len(str(total))) |
|
467 | expander['n'] = lambda: str(seqno).zfill(len(str(total))) | |
468 | if pathname is not None: |
|
468 | if pathname is not None: | |
469 | expander['s'] = lambda: os.path.basename(pathname) |
|
469 | expander['s'] = lambda: os.path.basename(pathname) | |
470 | expander['d'] = lambda: os.path.dirname(pathname) or '.' |
|
470 | expander['d'] = lambda: os.path.dirname(pathname) or '.' | |
471 | expander['p'] = lambda: pathname |
|
471 | expander['p'] = lambda: pathname | |
472 |
|
472 | |||
473 | newname = [] |
|
473 | newname = [] | |
474 | patlen = len(pat) |
|
474 | patlen = len(pat) | |
475 | i = 0 |
|
475 | i = 0 | |
476 | while i < patlen: |
|
476 | while i < patlen: | |
477 | c = pat[i] |
|
477 | c = pat[i] | |
478 | if c == '%': |
|
478 | if c == '%': | |
479 | i += 1 |
|
479 | i += 1 | |
480 | c = pat[i] |
|
480 | c = pat[i] | |
481 | c = expander[c]() |
|
481 | c = expander[c]() | |
482 | newname.append(c) |
|
482 | newname.append(c) | |
483 | i += 1 |
|
483 | i += 1 | |
484 | return ''.join(newname) |
|
484 | return ''.join(newname) | |
485 | except KeyError as inst: |
|
485 | except KeyError as inst: | |
486 | raise error.Abort(_("invalid format spec '%%%s' in output filename") % |
|
486 | raise error.Abort(_("invalid format spec '%%%s' in output filename") % | |
487 | inst.args[0]) |
|
487 | inst.args[0]) | |
488 |
|
488 | |||
489 | class _unclosablefile(object): |
|
489 | class _unclosablefile(object): | |
490 | def __init__(self, fp): |
|
490 | def __init__(self, fp): | |
491 | self._fp = fp |
|
491 | self._fp = fp | |
492 |
|
492 | |||
493 | def close(self): |
|
493 | def close(self): | |
494 | pass |
|
494 | pass | |
495 |
|
495 | |||
496 | def __iter__(self): |
|
496 | def __iter__(self): | |
497 | return iter(self._fp) |
|
497 | return iter(self._fp) | |
498 |
|
498 | |||
499 | def __getattr__(self, attr): |
|
499 | def __getattr__(self, attr): | |
500 | return getattr(self._fp, attr) |
|
500 | return getattr(self._fp, attr) | |
501 |
|
501 | |||
502 | def makefileobj(repo, pat, node=None, desc=None, total=None, |
|
502 | def makefileobj(repo, pat, node=None, desc=None, total=None, | |
503 | seqno=None, revwidth=None, mode='wb', modemap=None, |
|
503 | seqno=None, revwidth=None, mode='wb', modemap=None, | |
504 | pathname=None): |
|
504 | pathname=None): | |
505 |
|
505 | |||
506 | writable = mode not in ('r', 'rb') |
|
506 | writable = mode not in ('r', 'rb') | |
507 |
|
507 | |||
508 | if not pat or pat == '-': |
|
508 | if not pat or pat == '-': | |
509 | if writable: |
|
509 | if writable: | |
510 | fp = repo.ui.fout |
|
510 | fp = repo.ui.fout | |
511 | else: |
|
511 | else: | |
512 | fp = repo.ui.fin |
|
512 | fp = repo.ui.fin | |
513 | return _unclosablefile(fp) |
|
513 | return _unclosablefile(fp) | |
514 | if util.safehasattr(pat, 'write') and writable: |
|
514 | if util.safehasattr(pat, 'write') and writable: | |
515 | return pat |
|
515 | return pat | |
516 | if util.safehasattr(pat, 'read') and 'r' in mode: |
|
516 | if util.safehasattr(pat, 'read') and 'r' in mode: | |
517 | return pat |
|
517 | return pat | |
518 | fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) |
|
518 | fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) | |
519 | if modemap is not None: |
|
519 | if modemap is not None: | |
520 | mode = modemap.get(fn, mode) |
|
520 | mode = modemap.get(fn, mode) | |
521 | if mode == 'wb': |
|
521 | if mode == 'wb': | |
522 | modemap[fn] = 'ab' |
|
522 | modemap[fn] = 'ab' | |
523 | return open(fn, mode) |
|
523 | return open(fn, mode) | |
524 |
|
524 | |||
525 | def openrevlog(repo, cmd, file_, opts): |
|
525 | def openrevlog(repo, cmd, file_, opts): | |
526 | """opens the changelog, manifest, a filelog or a given revlog""" |
|
526 | """opens the changelog, manifest, a filelog or a given revlog""" | |
527 | cl = opts['changelog'] |
|
527 | cl = opts['changelog'] | |
528 | mf = opts['manifest'] |
|
528 | mf = opts['manifest'] | |
529 | dir = opts['dir'] |
|
529 | dir = opts['dir'] | |
530 | msg = None |
|
530 | msg = None | |
531 | if cl and mf: |
|
531 | if cl and mf: | |
532 | msg = _('cannot specify --changelog and --manifest at the same time') |
|
532 | msg = _('cannot specify --changelog and --manifest at the same time') | |
533 | elif cl and dir: |
|
533 | elif cl and dir: | |
534 | msg = _('cannot specify --changelog and --dir at the same time') |
|
534 | msg = _('cannot specify --changelog and --dir at the same time') | |
535 | elif cl or mf: |
|
535 | elif cl or mf: | |
536 | if file_: |
|
536 | if file_: | |
537 | msg = _('cannot specify filename with --changelog or --manifest') |
|
537 | msg = _('cannot specify filename with --changelog or --manifest') | |
538 | elif not repo: |
|
538 | elif not repo: | |
539 | msg = _('cannot specify --changelog or --manifest or --dir ' |
|
539 | msg = _('cannot specify --changelog or --manifest or --dir ' | |
540 | 'without a repository') |
|
540 | 'without a repository') | |
541 | if msg: |
|
541 | if msg: | |
542 | raise error.Abort(msg) |
|
542 | raise error.Abort(msg) | |
543 |
|
543 | |||
544 | r = None |
|
544 | r = None | |
545 | if repo: |
|
545 | if repo: | |
546 | if cl: |
|
546 | if cl: | |
547 | r = repo.unfiltered().changelog |
|
547 | r = repo.unfiltered().changelog | |
548 | elif dir: |
|
548 | elif dir: | |
549 | if 'treemanifest' not in repo.requirements: |
|
549 | if 'treemanifest' not in repo.requirements: | |
550 | raise error.Abort(_("--dir can only be used on repos with " |
|
550 | raise error.Abort(_("--dir can only be used on repos with " | |
551 | "treemanifest enabled")) |
|
551 | "treemanifest enabled")) | |
552 | dirlog = repo.dirlog(file_) |
|
552 | dirlog = repo.dirlog(file_) | |
553 | if len(dirlog): |
|
553 | if len(dirlog): | |
554 | r = dirlog |
|
554 | r = dirlog | |
555 | elif mf: |
|
555 | elif mf: | |
556 | r = repo.manifest |
|
556 | r = repo.manifest | |
557 | elif file_: |
|
557 | elif file_: | |
558 | filelog = repo.file(file_) |
|
558 | filelog = repo.file(file_) | |
559 | if len(filelog): |
|
559 | if len(filelog): | |
560 | r = filelog |
|
560 | r = filelog | |
561 | if not r: |
|
561 | if not r: | |
562 | if not file_: |
|
562 | if not file_: | |
563 | raise error.CommandError(cmd, _('invalid arguments')) |
|
563 | raise error.CommandError(cmd, _('invalid arguments')) | |
564 | if not os.path.isfile(file_): |
|
564 | if not os.path.isfile(file_): | |
565 | raise error.Abort(_("revlog '%s' not found") % file_) |
|
565 | raise error.Abort(_("revlog '%s' not found") % file_) | |
566 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), |
|
566 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), | |
567 | file_[:-2] + ".i") |
|
567 | file_[:-2] + ".i") | |
568 | return r |
|
568 | return r | |
569 |
|
569 | |||
570 | def copy(ui, repo, pats, opts, rename=False): |
|
570 | def copy(ui, repo, pats, opts, rename=False): | |
571 | # called with the repo lock held |
|
571 | # called with the repo lock held | |
572 | # |
|
572 | # | |
573 | # hgsep => pathname that uses "/" to separate directories |
|
573 | # hgsep => pathname that uses "/" to separate directories | |
574 | # ossep => pathname that uses os.sep to separate directories |
|
574 | # ossep => pathname that uses os.sep to separate directories | |
575 | cwd = repo.getcwd() |
|
575 | cwd = repo.getcwd() | |
576 | targets = {} |
|
576 | targets = {} | |
577 | after = opts.get("after") |
|
577 | after = opts.get("after") | |
578 | dryrun = opts.get("dry_run") |
|
578 | dryrun = opts.get("dry_run") | |
579 | wctx = repo[None] |
|
579 | wctx = repo[None] | |
580 |
|
580 | |||
581 | def walkpat(pat): |
|
581 | def walkpat(pat): | |
582 | srcs = [] |
|
582 | srcs = [] | |
583 | if after: |
|
583 | if after: | |
584 | badstates = '?' |
|
584 | badstates = '?' | |
585 | else: |
|
585 | else: | |
586 | badstates = '?r' |
|
586 | badstates = '?r' | |
587 | m = scmutil.match(repo[None], [pat], opts, globbed=True) |
|
587 | m = scmutil.match(repo[None], [pat], opts, globbed=True) | |
588 | for abs in repo.walk(m): |
|
588 | for abs in repo.walk(m): | |
589 | state = repo.dirstate[abs] |
|
589 | state = repo.dirstate[abs] | |
590 | rel = m.rel(abs) |
|
590 | rel = m.rel(abs) | |
591 | exact = m.exact(abs) |
|
591 | exact = m.exact(abs) | |
592 | if state in badstates: |
|
592 | if state in badstates: | |
593 | if exact and state == '?': |
|
593 | if exact and state == '?': | |
594 | ui.warn(_('%s: not copying - file is not managed\n') % rel) |
|
594 | ui.warn(_('%s: not copying - file is not managed\n') % rel) | |
595 | if exact and state == 'r': |
|
595 | if exact and state == 'r': | |
596 | ui.warn(_('%s: not copying - file has been marked for' |
|
596 | ui.warn(_('%s: not copying - file has been marked for' | |
597 | ' remove\n') % rel) |
|
597 | ' remove\n') % rel) | |
598 | continue |
|
598 | continue | |
599 | # abs: hgsep |
|
599 | # abs: hgsep | |
600 | # rel: ossep |
|
600 | # rel: ossep | |
601 | srcs.append((abs, rel, exact)) |
|
601 | srcs.append((abs, rel, exact)) | |
602 | return srcs |
|
602 | return srcs | |
603 |
|
603 | |||
604 | # abssrc: hgsep |
|
604 | # abssrc: hgsep | |
605 | # relsrc: ossep |
|
605 | # relsrc: ossep | |
606 | # otarget: ossep |
|
606 | # otarget: ossep | |
607 | def copyfile(abssrc, relsrc, otarget, exact): |
|
607 | def copyfile(abssrc, relsrc, otarget, exact): | |
608 | abstarget = pathutil.canonpath(repo.root, cwd, otarget) |
|
608 | abstarget = pathutil.canonpath(repo.root, cwd, otarget) | |
609 | if '/' in abstarget: |
|
609 | if '/' in abstarget: | |
610 | # We cannot normalize abstarget itself, this would prevent |
|
610 | # We cannot normalize abstarget itself, this would prevent | |
611 | # case only renames, like a => A. |
|
611 | # case only renames, like a => A. | |
612 | abspath, absname = abstarget.rsplit('/', 1) |
|
612 | abspath, absname = abstarget.rsplit('/', 1) | |
613 | abstarget = repo.dirstate.normalize(abspath) + '/' + absname |
|
613 | abstarget = repo.dirstate.normalize(abspath) + '/' + absname | |
614 | reltarget = repo.pathto(abstarget, cwd) |
|
614 | reltarget = repo.pathto(abstarget, cwd) | |
615 | target = repo.wjoin(abstarget) |
|
615 | target = repo.wjoin(abstarget) | |
616 | src = repo.wjoin(abssrc) |
|
616 | src = repo.wjoin(abssrc) | |
617 | state = repo.dirstate[abstarget] |
|
617 | state = repo.dirstate[abstarget] | |
618 |
|
618 | |||
619 | scmutil.checkportable(ui, abstarget) |
|
619 | scmutil.checkportable(ui, abstarget) | |
620 |
|
620 | |||
621 | # check for collisions |
|
621 | # check for collisions | |
622 | prevsrc = targets.get(abstarget) |
|
622 | prevsrc = targets.get(abstarget) | |
623 | if prevsrc is not None: |
|
623 | if prevsrc is not None: | |
624 | ui.warn(_('%s: not overwriting - %s collides with %s\n') % |
|
624 | ui.warn(_('%s: not overwriting - %s collides with %s\n') % | |
625 | (reltarget, repo.pathto(abssrc, cwd), |
|
625 | (reltarget, repo.pathto(abssrc, cwd), | |
626 | repo.pathto(prevsrc, cwd))) |
|
626 | repo.pathto(prevsrc, cwd))) | |
627 | return |
|
627 | return | |
628 |
|
628 | |||
629 | # check for overwrites |
|
629 | # check for overwrites | |
630 | exists = os.path.lexists(target) |
|
630 | exists = os.path.lexists(target) | |
631 | samefile = False |
|
631 | samefile = False | |
632 | if exists and abssrc != abstarget: |
|
632 | if exists and abssrc != abstarget: | |
633 | if (repo.dirstate.normalize(abssrc) == |
|
633 | if (repo.dirstate.normalize(abssrc) == | |
634 | repo.dirstate.normalize(abstarget)): |
|
634 | repo.dirstate.normalize(abstarget)): | |
635 | if not rename: |
|
635 | if not rename: | |
636 | ui.warn(_("%s: can't copy - same file\n") % reltarget) |
|
636 | ui.warn(_("%s: can't copy - same file\n") % reltarget) | |
637 | return |
|
637 | return | |
638 | exists = False |
|
638 | exists = False | |
639 | samefile = True |
|
639 | samefile = True | |
640 |
|
640 | |||
641 | if not after and exists or after and state in 'mn': |
|
641 | if not after and exists or after and state in 'mn': | |
642 | if not opts['force']: |
|
642 | if not opts['force']: | |
643 | ui.warn(_('%s: not overwriting - file exists\n') % |
|
643 | ui.warn(_('%s: not overwriting - file exists\n') % | |
644 | reltarget) |
|
644 | reltarget) | |
645 | return |
|
645 | return | |
646 |
|
646 | |||
647 | if after: |
|
647 | if after: | |
648 | if not exists: |
|
648 | if not exists: | |
649 | if rename: |
|
649 | if rename: | |
650 | ui.warn(_('%s: not recording move - %s does not exist\n') % |
|
650 | ui.warn(_('%s: not recording move - %s does not exist\n') % | |
651 | (relsrc, reltarget)) |
|
651 | (relsrc, reltarget)) | |
652 | else: |
|
652 | else: | |
653 | ui.warn(_('%s: not recording copy - %s does not exist\n') % |
|
653 | ui.warn(_('%s: not recording copy - %s does not exist\n') % | |
654 | (relsrc, reltarget)) |
|
654 | (relsrc, reltarget)) | |
655 | return |
|
655 | return | |
656 | elif not dryrun: |
|
656 | elif not dryrun: | |
657 | try: |
|
657 | try: | |
658 | if exists: |
|
658 | if exists: | |
659 | os.unlink(target) |
|
659 | os.unlink(target) | |
660 | targetdir = os.path.dirname(target) or '.' |
|
660 | targetdir = os.path.dirname(target) or '.' | |
661 | if not os.path.isdir(targetdir): |
|
661 | if not os.path.isdir(targetdir): | |
662 | os.makedirs(targetdir) |
|
662 | os.makedirs(targetdir) | |
663 | if samefile: |
|
663 | if samefile: | |
664 | tmp = target + "~hgrename" |
|
664 | tmp = target + "~hgrename" | |
665 | os.rename(src, tmp) |
|
665 | os.rename(src, tmp) | |
666 | os.rename(tmp, target) |
|
666 | os.rename(tmp, target) | |
667 | else: |
|
667 | else: | |
668 | util.copyfile(src, target) |
|
668 | util.copyfile(src, target) | |
669 | srcexists = True |
|
669 | srcexists = True | |
670 | except IOError as inst: |
|
670 | except IOError as inst: | |
671 | if inst.errno == errno.ENOENT: |
|
671 | if inst.errno == errno.ENOENT: | |
672 | ui.warn(_('%s: deleted in working directory\n') % relsrc) |
|
672 | ui.warn(_('%s: deleted in working directory\n') % relsrc) | |
673 | srcexists = False |
|
673 | srcexists = False | |
674 | else: |
|
674 | else: | |
675 | ui.warn(_('%s: cannot copy - %s\n') % |
|
675 | ui.warn(_('%s: cannot copy - %s\n') % | |
676 | (relsrc, inst.strerror)) |
|
676 | (relsrc, inst.strerror)) | |
677 | return True # report a failure |
|
677 | return True # report a failure | |
678 |
|
678 | |||
679 | if ui.verbose or not exact: |
|
679 | if ui.verbose or not exact: | |
680 | if rename: |
|
680 | if rename: | |
681 | ui.status(_('moving %s to %s\n') % (relsrc, reltarget)) |
|
681 | ui.status(_('moving %s to %s\n') % (relsrc, reltarget)) | |
682 | else: |
|
682 | else: | |
683 | ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) |
|
683 | ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) | |
684 |
|
684 | |||
685 | targets[abstarget] = abssrc |
|
685 | targets[abstarget] = abssrc | |
686 |
|
686 | |||
687 | # fix up dirstate |
|
687 | # fix up dirstate | |
688 | scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget, |
|
688 | scmutil.dirstatecopy(ui, repo, wctx, abssrc, abstarget, | |
689 | dryrun=dryrun, cwd=cwd) |
|
689 | dryrun=dryrun, cwd=cwd) | |
690 | if rename and not dryrun: |
|
690 | if rename and not dryrun: | |
691 | if not after and srcexists and not samefile: |
|
691 | if not after and srcexists and not samefile: | |
692 | util.unlinkpath(repo.wjoin(abssrc)) |
|
692 | util.unlinkpath(repo.wjoin(abssrc)) | |
693 | wctx.forget([abssrc]) |
|
693 | wctx.forget([abssrc]) | |
694 |
|
694 | |||
695 | # pat: ossep |
|
695 | # pat: ossep | |
696 | # dest ossep |
|
696 | # dest ossep | |
697 | # srcs: list of (hgsep, hgsep, ossep, bool) |
|
697 | # srcs: list of (hgsep, hgsep, ossep, bool) | |
698 | # return: function that takes hgsep and returns ossep |
|
698 | # return: function that takes hgsep and returns ossep | |
699 | def targetpathfn(pat, dest, srcs): |
|
699 | def targetpathfn(pat, dest, srcs): | |
700 | if os.path.isdir(pat): |
|
700 | if os.path.isdir(pat): | |
701 | abspfx = pathutil.canonpath(repo.root, cwd, pat) |
|
701 | abspfx = pathutil.canonpath(repo.root, cwd, pat) | |
702 | abspfx = util.localpath(abspfx) |
|
702 | abspfx = util.localpath(abspfx) | |
703 | if destdirexists: |
|
703 | if destdirexists: | |
704 | striplen = len(os.path.split(abspfx)[0]) |
|
704 | striplen = len(os.path.split(abspfx)[0]) | |
705 | else: |
|
705 | else: | |
706 | striplen = len(abspfx) |
|
706 | striplen = len(abspfx) | |
707 | if striplen: |
|
707 | if striplen: | |
708 | striplen += len(os.sep) |
|
708 | striplen += len(os.sep) | |
709 | res = lambda p: os.path.join(dest, util.localpath(p)[striplen:]) |
|
709 | res = lambda p: os.path.join(dest, util.localpath(p)[striplen:]) | |
710 | elif destdirexists: |
|
710 | elif destdirexists: | |
711 | res = lambda p: os.path.join(dest, |
|
711 | res = lambda p: os.path.join(dest, | |
712 | os.path.basename(util.localpath(p))) |
|
712 | os.path.basename(util.localpath(p))) | |
713 | else: |
|
713 | else: | |
714 | res = lambda p: dest |
|
714 | res = lambda p: dest | |
715 | return res |
|
715 | return res | |
716 |
|
716 | |||
717 | # pat: ossep |
|
717 | # pat: ossep | |
718 | # dest ossep |
|
718 | # dest ossep | |
719 | # srcs: list of (hgsep, hgsep, ossep, bool) |
|
719 | # srcs: list of (hgsep, hgsep, ossep, bool) | |
720 | # return: function that takes hgsep and returns ossep |
|
720 | # return: function that takes hgsep and returns ossep | |
721 | def targetpathafterfn(pat, dest, srcs): |
|
721 | def targetpathafterfn(pat, dest, srcs): | |
722 | if matchmod.patkind(pat): |
|
722 | if matchmod.patkind(pat): | |
723 | # a mercurial pattern |
|
723 | # a mercurial pattern | |
724 | res = lambda p: os.path.join(dest, |
|
724 | res = lambda p: os.path.join(dest, | |
725 | os.path.basename(util.localpath(p))) |
|
725 | os.path.basename(util.localpath(p))) | |
726 | else: |
|
726 | else: | |
727 | abspfx = pathutil.canonpath(repo.root, cwd, pat) |
|
727 | abspfx = pathutil.canonpath(repo.root, cwd, pat) | |
728 | if len(abspfx) < len(srcs[0][0]): |
|
728 | if len(abspfx) < len(srcs[0][0]): | |
729 | # A directory. Either the target path contains the last |
|
729 | # A directory. Either the target path contains the last | |
730 | # component of the source path or it does not. |
|
730 | # component of the source path or it does not. | |
731 | def evalpath(striplen): |
|
731 | def evalpath(striplen): | |
732 | score = 0 |
|
732 | score = 0 | |
733 | for s in srcs: |
|
733 | for s in srcs: | |
734 | t = os.path.join(dest, util.localpath(s[0])[striplen:]) |
|
734 | t = os.path.join(dest, util.localpath(s[0])[striplen:]) | |
735 | if os.path.lexists(t): |
|
735 | if os.path.lexists(t): | |
736 | score += 1 |
|
736 | score += 1 | |
737 | return score |
|
737 | return score | |
738 |
|
738 | |||
739 | abspfx = util.localpath(abspfx) |
|
739 | abspfx = util.localpath(abspfx) | |
740 | striplen = len(abspfx) |
|
740 | striplen = len(abspfx) | |
741 | if striplen: |
|
741 | if striplen: | |
742 | striplen += len(os.sep) |
|
742 | striplen += len(os.sep) | |
743 | if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])): |
|
743 | if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])): | |
744 | score = evalpath(striplen) |
|
744 | score = evalpath(striplen) | |
745 | striplen1 = len(os.path.split(abspfx)[0]) |
|
745 | striplen1 = len(os.path.split(abspfx)[0]) | |
746 | if striplen1: |
|
746 | if striplen1: | |
747 | striplen1 += len(os.sep) |
|
747 | striplen1 += len(os.sep) | |
748 | if evalpath(striplen1) > score: |
|
748 | if evalpath(striplen1) > score: | |
749 | striplen = striplen1 |
|
749 | striplen = striplen1 | |
750 | res = lambda p: os.path.join(dest, |
|
750 | res = lambda p: os.path.join(dest, | |
751 | util.localpath(p)[striplen:]) |
|
751 | util.localpath(p)[striplen:]) | |
752 | else: |
|
752 | else: | |
753 | # a file |
|
753 | # a file | |
754 | if destdirexists: |
|
754 | if destdirexists: | |
755 | res = lambda p: os.path.join(dest, |
|
755 | res = lambda p: os.path.join(dest, | |
756 | os.path.basename(util.localpath(p))) |
|
756 | os.path.basename(util.localpath(p))) | |
757 | else: |
|
757 | else: | |
758 | res = lambda p: dest |
|
758 | res = lambda p: dest | |
759 | return res |
|
759 | return res | |
760 |
|
760 | |||
761 | pats = scmutil.expandpats(pats) |
|
761 | pats = scmutil.expandpats(pats) | |
762 | if not pats: |
|
762 | if not pats: | |
763 | raise error.Abort(_('no source or destination specified')) |
|
763 | raise error.Abort(_('no source or destination specified')) | |
764 | if len(pats) == 1: |
|
764 | if len(pats) == 1: | |
765 | raise error.Abort(_('no destination specified')) |
|
765 | raise error.Abort(_('no destination specified')) | |
766 | dest = pats.pop() |
|
766 | dest = pats.pop() | |
767 | destdirexists = os.path.isdir(dest) and not os.path.islink(dest) |
|
767 | destdirexists = os.path.isdir(dest) and not os.path.islink(dest) | |
768 | if not destdirexists: |
|
768 | if not destdirexists: | |
769 | if len(pats) > 1 or matchmod.patkind(pats[0]): |
|
769 | if len(pats) > 1 or matchmod.patkind(pats[0]): | |
770 | raise error.Abort(_('with multiple sources, destination must be an ' |
|
770 | raise error.Abort(_('with multiple sources, destination must be an ' | |
771 | 'existing directory')) |
|
771 | 'existing directory')) | |
772 | if util.endswithsep(dest): |
|
772 | if util.endswithsep(dest): | |
773 | raise error.Abort(_('destination %s is not a directory') % dest) |
|
773 | raise error.Abort(_('destination %s is not a directory') % dest) | |
774 |
|
774 | |||
775 | tfn = targetpathfn |
|
775 | tfn = targetpathfn | |
776 | if after: |
|
776 | if after: | |
777 | tfn = targetpathafterfn |
|
777 | tfn = targetpathafterfn | |
778 | copylist = [] |
|
778 | copylist = [] | |
779 | for pat in pats: |
|
779 | for pat in pats: | |
780 | srcs = walkpat(pat) |
|
780 | srcs = walkpat(pat) | |
781 | if not srcs: |
|
781 | if not srcs: | |
782 | continue |
|
782 | continue | |
783 | copylist.append((tfn(pat, dest, srcs), srcs)) |
|
783 | copylist.append((tfn(pat, dest, srcs), srcs)) | |
784 | if not copylist: |
|
784 | if not copylist: | |
785 | raise error.Abort(_('no files to copy')) |
|
785 | raise error.Abort(_('no files to copy')) | |
786 |
|
786 | |||
787 | errors = 0 |
|
787 | errors = 0 | |
788 | for targetpath, srcs in copylist: |
|
788 | for targetpath, srcs in copylist: | |
789 | for abssrc, relsrc, exact in srcs: |
|
789 | for abssrc, relsrc, exact in srcs: | |
790 | if copyfile(abssrc, relsrc, targetpath(abssrc), exact): |
|
790 | if copyfile(abssrc, relsrc, targetpath(abssrc), exact): | |
791 | errors += 1 |
|
791 | errors += 1 | |
792 |
|
792 | |||
793 | if errors: |
|
793 | if errors: | |
794 | ui.warn(_('(consider using --after)\n')) |
|
794 | ui.warn(_('(consider using --after)\n')) | |
795 |
|
795 | |||
796 | return errors != 0 |
|
796 | return errors != 0 | |
797 |
|
797 | |||
798 | def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None, |
|
798 | def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None, | |
799 | runargs=None, appendpid=False): |
|
799 | runargs=None, appendpid=False): | |
800 | '''Run a command as a service.''' |
|
800 | '''Run a command as a service.''' | |
801 |
|
801 | |||
802 | def writepid(pid): |
|
802 | def writepid(pid): | |
803 | if opts['pid_file']: |
|
803 | if opts['pid_file']: | |
804 | if appendpid: |
|
804 | if appendpid: | |
805 | mode = 'a' |
|
805 | mode = 'a' | |
806 | else: |
|
806 | else: | |
807 | mode = 'w' |
|
807 | mode = 'w' | |
808 | fp = open(opts['pid_file'], mode) |
|
808 | fp = open(opts['pid_file'], mode) | |
809 | fp.write(str(pid) + '\n') |
|
809 | fp.write(str(pid) + '\n') | |
810 | fp.close() |
|
810 | fp.close() | |
811 |
|
811 | |||
812 | if opts['daemon'] and not opts['daemon_postexec']: |
|
812 | if opts['daemon'] and not opts['daemon_postexec']: | |
813 | # Signal child process startup with file removal |
|
813 | # Signal child process startup with file removal | |
814 | lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-') |
|
814 | lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-') | |
815 | os.close(lockfd) |
|
815 | os.close(lockfd) | |
816 | try: |
|
816 | try: | |
817 | if not runargs: |
|
817 | if not runargs: | |
818 | runargs = util.hgcmd() + sys.argv[1:] |
|
818 | runargs = util.hgcmd() + sys.argv[1:] | |
819 | runargs.append('--daemon-postexec=unlink:%s' % lockpath) |
|
819 | runargs.append('--daemon-postexec=unlink:%s' % lockpath) | |
820 | # Don't pass --cwd to the child process, because we've already |
|
820 | # Don't pass --cwd to the child process, because we've already | |
821 | # changed directory. |
|
821 | # changed directory. | |
822 | for i in xrange(1, len(runargs)): |
|
822 | for i in xrange(1, len(runargs)): | |
823 | if runargs[i].startswith('--cwd='): |
|
823 | if runargs[i].startswith('--cwd='): | |
824 | del runargs[i] |
|
824 | del runargs[i] | |
825 | break |
|
825 | break | |
826 | elif runargs[i].startswith('--cwd'): |
|
826 | elif runargs[i].startswith('--cwd'): | |
827 | del runargs[i:i + 2] |
|
827 | del runargs[i:i + 2] | |
828 | break |
|
828 | break | |
829 | def condfn(): |
|
829 | def condfn(): | |
830 | return not os.path.exists(lockpath) |
|
830 | return not os.path.exists(lockpath) | |
831 | pid = util.rundetached(runargs, condfn) |
|
831 | pid = util.rundetached(runargs, condfn) | |
832 | if pid < 0: |
|
832 | if pid < 0: | |
833 | raise error.Abort(_('child process failed to start')) |
|
833 | raise error.Abort(_('child process failed to start')) | |
834 | writepid(pid) |
|
834 | writepid(pid) | |
835 | finally: |
|
835 | finally: | |
836 | try: |
|
836 | try: | |
837 | os.unlink(lockpath) |
|
837 | os.unlink(lockpath) | |
838 | except OSError as e: |
|
838 | except OSError as e: | |
839 | if e.errno != errno.ENOENT: |
|
839 | if e.errno != errno.ENOENT: | |
840 | raise |
|
840 | raise | |
841 | if parentfn: |
|
841 | if parentfn: | |
842 | return parentfn(pid) |
|
842 | return parentfn(pid) | |
843 | else: |
|
843 | else: | |
844 | return |
|
844 | return | |
845 |
|
845 | |||
846 | if initfn: |
|
846 | if initfn: | |
847 | initfn() |
|
847 | initfn() | |
848 |
|
848 | |||
849 | if not opts['daemon']: |
|
849 | if not opts['daemon']: | |
850 | writepid(util.getpid()) |
|
850 | writepid(util.getpid()) | |
851 |
|
851 | |||
852 | if opts['daemon_postexec']: |
|
852 | if opts['daemon_postexec']: | |
853 | try: |
|
853 | try: | |
854 | os.setsid() |
|
854 | os.setsid() | |
855 | except AttributeError: |
|
855 | except AttributeError: | |
856 | pass |
|
856 | pass | |
857 | for inst in opts['daemon_postexec']: |
|
857 | for inst in opts['daemon_postexec']: | |
858 | if inst.startswith('unlink:'): |
|
858 | if inst.startswith('unlink:'): | |
859 | lockpath = inst[7:] |
|
859 | lockpath = inst[7:] | |
860 | os.unlink(lockpath) |
|
860 | os.unlink(lockpath) | |
861 | elif inst.startswith('chdir:'): |
|
861 | elif inst.startswith('chdir:'): | |
862 | os.chdir(inst[6:]) |
|
862 | os.chdir(inst[6:]) | |
863 | elif inst != 'none': |
|
863 | elif inst != 'none': | |
864 | raise error.Abort(_('invalid value for --daemon-postexec: %s') |
|
864 | raise error.Abort(_('invalid value for --daemon-postexec: %s') | |
865 | % inst) |
|
865 | % inst) | |
866 | util.hidewindow() |
|
866 | util.hidewindow() | |
867 | sys.stdout.flush() |
|
867 | sys.stdout.flush() | |
868 | sys.stderr.flush() |
|
868 | sys.stderr.flush() | |
869 |
|
869 | |||
870 | nullfd = os.open(os.devnull, os.O_RDWR) |
|
870 | nullfd = os.open(os.devnull, os.O_RDWR) | |
871 | logfilefd = nullfd |
|
871 | logfilefd = nullfd | |
872 | if logfile: |
|
872 | if logfile: | |
873 | logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND) |
|
873 | logfilefd = os.open(logfile, os.O_RDWR | os.O_CREAT | os.O_APPEND) | |
874 | os.dup2(nullfd, 0) |
|
874 | os.dup2(nullfd, 0) | |
875 | os.dup2(logfilefd, 1) |
|
875 | os.dup2(logfilefd, 1) | |
876 | os.dup2(logfilefd, 2) |
|
876 | os.dup2(logfilefd, 2) | |
877 | if nullfd not in (0, 1, 2): |
|
877 | if nullfd not in (0, 1, 2): | |
878 | os.close(nullfd) |
|
878 | os.close(nullfd) | |
879 | if logfile and logfilefd not in (0, 1, 2): |
|
879 | if logfile and logfilefd not in (0, 1, 2): | |
880 | os.close(logfilefd) |
|
880 | os.close(logfilefd) | |
881 |
|
881 | |||
882 | if runfn: |
|
882 | if runfn: | |
883 | return runfn() |
|
883 | return runfn() | |
884 |
|
884 | |||
885 | ## facility to let extension process additional data into an import patch |
|
885 | ## facility to let extension process additional data into an import patch | |
886 | # list of identifier to be executed in order |
|
886 | # list of identifier to be executed in order | |
887 | extrapreimport = [] # run before commit |
|
887 | extrapreimport = [] # run before commit | |
888 | extrapostimport = [] # run after commit |
|
888 | extrapostimport = [] # run after commit | |
889 | # mapping from identifier to actual import function |
|
889 | # mapping from identifier to actual import function | |
890 | # |
|
890 | # | |
891 | # 'preimport' are run before the commit is made and are provided the following |
|
891 | # 'preimport' are run before the commit is made and are provided the following | |
892 | # arguments: |
|
892 | # arguments: | |
893 | # - repo: the localrepository instance, |
|
893 | # - repo: the localrepository instance, | |
894 | # - patchdata: data extracted from patch header (cf m.patch.patchheadermap), |
|
894 | # - patchdata: data extracted from patch header (cf m.patch.patchheadermap), | |
895 | # - extra: the future extra dictionary of the changeset, please mutate it, |
|
895 | # - extra: the future extra dictionary of the changeset, please mutate it, | |
896 | # - opts: the import options. |
|
896 | # - opts: the import options. | |
897 | # XXX ideally, we would just pass an ctx ready to be computed, that would allow |
|
897 | # XXX ideally, we would just pass an ctx ready to be computed, that would allow | |
898 | # mutation of in memory commit and more. Feel free to rework the code to get |
|
898 | # mutation of in memory commit and more. Feel free to rework the code to get | |
899 | # there. |
|
899 | # there. | |
900 | extrapreimportmap = {} |
|
900 | extrapreimportmap = {} | |
901 | # 'postimport' are run after the commit is made and are provided the following |
|
901 | # 'postimport' are run after the commit is made and are provided the following | |
902 | # argument: |
|
902 | # argument: | |
903 | # - ctx: the changectx created by import. |
|
903 | # - ctx: the changectx created by import. | |
904 | extrapostimportmap = {} |
|
904 | extrapostimportmap = {} | |
905 |
|
905 | |||
906 | def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc): |
|
906 | def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc): | |
907 | """Utility function used by commands.import to import a single patch |
|
907 | """Utility function used by commands.import to import a single patch | |
908 |
|
908 | |||
909 | This function is explicitly defined here to help the evolve extension to |
|
909 | This function is explicitly defined here to help the evolve extension to | |
910 | wrap this part of the import logic. |
|
910 | wrap this part of the import logic. | |
911 |
|
911 | |||
912 | The API is currently a bit ugly because it a simple code translation from |
|
912 | The API is currently a bit ugly because it a simple code translation from | |
913 | the import command. Feel free to make it better. |
|
913 | the import command. Feel free to make it better. | |
914 |
|
914 | |||
915 | :hunk: a patch (as a binary string) |
|
915 | :hunk: a patch (as a binary string) | |
916 | :parents: nodes that will be parent of the created commit |
|
916 | :parents: nodes that will be parent of the created commit | |
917 | :opts: the full dict of option passed to the import command |
|
917 | :opts: the full dict of option passed to the import command | |
918 | :msgs: list to save commit message to. |
|
918 | :msgs: list to save commit message to. | |
919 | (used in case we need to save it when failing) |
|
919 | (used in case we need to save it when failing) | |
920 | :updatefunc: a function that update a repo to a given node |
|
920 | :updatefunc: a function that update a repo to a given node | |
921 | updatefunc(<repo>, <node>) |
|
921 | updatefunc(<repo>, <node>) | |
922 | """ |
|
922 | """ | |
923 | # avoid cycle context -> subrepo -> cmdutil |
|
923 | # avoid cycle context -> subrepo -> cmdutil | |
924 | from . import context |
|
924 | from . import context | |
925 | extractdata = patch.extract(ui, hunk) |
|
925 | extractdata = patch.extract(ui, hunk) | |
926 | tmpname = extractdata.get('filename') |
|
926 | tmpname = extractdata.get('filename') | |
927 | message = extractdata.get('message') |
|
927 | message = extractdata.get('message') | |
928 | user = opts.get('user') or extractdata.get('user') |
|
928 | user = opts.get('user') or extractdata.get('user') | |
929 | date = opts.get('date') or extractdata.get('date') |
|
929 | date = opts.get('date') or extractdata.get('date') | |
930 | branch = extractdata.get('branch') |
|
930 | branch = extractdata.get('branch') | |
931 | nodeid = extractdata.get('nodeid') |
|
931 | nodeid = extractdata.get('nodeid') | |
932 | p1 = extractdata.get('p1') |
|
932 | p1 = extractdata.get('p1') | |
933 | p2 = extractdata.get('p2') |
|
933 | p2 = extractdata.get('p2') | |
934 |
|
934 | |||
935 | nocommit = opts.get('no_commit') |
|
935 | nocommit = opts.get('no_commit') | |
936 | importbranch = opts.get('import_branch') |
|
936 | importbranch = opts.get('import_branch') | |
937 | update = not opts.get('bypass') |
|
937 | update = not opts.get('bypass') | |
938 | strip = opts["strip"] |
|
938 | strip = opts["strip"] | |
939 | prefix = opts["prefix"] |
|
939 | prefix = opts["prefix"] | |
940 | sim = float(opts.get('similarity') or 0) |
|
940 | sim = float(opts.get('similarity') or 0) | |
941 | if not tmpname: |
|
941 | if not tmpname: | |
942 | return (None, None, False) |
|
942 | return (None, None, False) | |
943 |
|
943 | |||
944 | rejects = False |
|
944 | rejects = False | |
945 |
|
945 | |||
946 | try: |
|
946 | try: | |
947 | cmdline_message = logmessage(ui, opts) |
|
947 | cmdline_message = logmessage(ui, opts) | |
948 | if cmdline_message: |
|
948 | if cmdline_message: | |
949 | # pickup the cmdline msg |
|
949 | # pickup the cmdline msg | |
950 | message = cmdline_message |
|
950 | message = cmdline_message | |
951 | elif message: |
|
951 | elif message: | |
952 | # pickup the patch msg |
|
952 | # pickup the patch msg | |
953 | message = message.strip() |
|
953 | message = message.strip() | |
954 | else: |
|
954 | else: | |
955 | # launch the editor |
|
955 | # launch the editor | |
956 | message = None |
|
956 | message = None | |
957 | ui.debug('message:\n%s\n' % message) |
|
957 | ui.debug('message:\n%s\n' % message) | |
958 |
|
958 | |||
959 | if len(parents) == 1: |
|
959 | if len(parents) == 1: | |
960 | parents.append(repo[nullid]) |
|
960 | parents.append(repo[nullid]) | |
961 | if opts.get('exact'): |
|
961 | if opts.get('exact'): | |
962 | if not nodeid or not p1: |
|
962 | if not nodeid or not p1: | |
963 | raise error.Abort(_('not a Mercurial patch')) |
|
963 | raise error.Abort(_('not a Mercurial patch')) | |
964 | p1 = repo[p1] |
|
964 | p1 = repo[p1] | |
965 | p2 = repo[p2 or nullid] |
|
965 | p2 = repo[p2 or nullid] | |
966 | elif p2: |
|
966 | elif p2: | |
967 | try: |
|
967 | try: | |
968 | p1 = repo[p1] |
|
968 | p1 = repo[p1] | |
969 | p2 = repo[p2] |
|
969 | p2 = repo[p2] | |
970 | # Without any options, consider p2 only if the |
|
970 | # Without any options, consider p2 only if the | |
971 | # patch is being applied on top of the recorded |
|
971 | # patch is being applied on top of the recorded | |
972 | # first parent. |
|
972 | # first parent. | |
973 | if p1 != parents[0]: |
|
973 | if p1 != parents[0]: | |
974 | p1 = parents[0] |
|
974 | p1 = parents[0] | |
975 | p2 = repo[nullid] |
|
975 | p2 = repo[nullid] | |
976 | except error.RepoError: |
|
976 | except error.RepoError: | |
977 | p1, p2 = parents |
|
977 | p1, p2 = parents | |
978 | if p2.node() == nullid: |
|
978 | if p2.node() == nullid: | |
979 | ui.warn(_("warning: import the patch as a normal revision\n" |
|
979 | ui.warn(_("warning: import the patch as a normal revision\n" | |
980 | "(use --exact to import the patch as a merge)\n")) |
|
980 | "(use --exact to import the patch as a merge)\n")) | |
981 | else: |
|
981 | else: | |
982 | p1, p2 = parents |
|
982 | p1, p2 = parents | |
983 |
|
983 | |||
984 | n = None |
|
984 | n = None | |
985 | if update: |
|
985 | if update: | |
986 | if p1 != parents[0]: |
|
986 | if p1 != parents[0]: | |
987 | updatefunc(repo, p1.node()) |
|
987 | updatefunc(repo, p1.node()) | |
988 | if p2 != parents[1]: |
|
988 | if p2 != parents[1]: | |
989 | repo.setparents(p1.node(), p2.node()) |
|
989 | repo.setparents(p1.node(), p2.node()) | |
990 |
|
990 | |||
991 | if opts.get('exact') or importbranch: |
|
991 | if opts.get('exact') or importbranch: | |
992 | repo.dirstate.setbranch(branch or 'default') |
|
992 | repo.dirstate.setbranch(branch or 'default') | |
993 |
|
993 | |||
994 | partial = opts.get('partial', False) |
|
994 | partial = opts.get('partial', False) | |
995 | files = set() |
|
995 | files = set() | |
996 | try: |
|
996 | try: | |
997 | patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix, |
|
997 | patch.patch(ui, repo, tmpname, strip=strip, prefix=prefix, | |
998 | files=files, eolmode=None, similarity=sim / 100.0) |
|
998 | files=files, eolmode=None, similarity=sim / 100.0) | |
999 | except patch.PatchError as e: |
|
999 | except patch.PatchError as e: | |
1000 | if not partial: |
|
1000 | if not partial: | |
1001 | raise error.Abort(str(e)) |
|
1001 | raise error.Abort(str(e)) | |
1002 | if partial: |
|
1002 | if partial: | |
1003 | rejects = True |
|
1003 | rejects = True | |
1004 |
|
1004 | |||
1005 | files = list(files) |
|
1005 | files = list(files) | |
1006 | if nocommit: |
|
1006 | if nocommit: | |
1007 | if message: |
|
1007 | if message: | |
1008 | msgs.append(message) |
|
1008 | msgs.append(message) | |
1009 | else: |
|
1009 | else: | |
1010 | if opts.get('exact') or p2: |
|
1010 | if opts.get('exact') or p2: | |
1011 | # If you got here, you either use --force and know what |
|
1011 | # If you got here, you either use --force and know what | |
1012 | # you are doing or used --exact or a merge patch while |
|
1012 | # you are doing or used --exact or a merge patch while | |
1013 | # being updated to its first parent. |
|
1013 | # being updated to its first parent. | |
1014 | m = None |
|
1014 | m = None | |
1015 | else: |
|
1015 | else: | |
1016 | m = scmutil.matchfiles(repo, files or []) |
|
1016 | m = scmutil.matchfiles(repo, files or []) | |
1017 | editform = mergeeditform(repo[None], 'import.normal') |
|
1017 | editform = mergeeditform(repo[None], 'import.normal') | |
1018 | if opts.get('exact'): |
|
1018 | if opts.get('exact'): | |
1019 | editor = None |
|
1019 | editor = None | |
1020 | else: |
|
1020 | else: | |
1021 | editor = getcommiteditor(editform=editform, **opts) |
|
1021 | editor = getcommiteditor(editform=editform, **opts) | |
1022 | allowemptyback = repo.ui.backupconfig('ui', 'allowemptycommit') |
|
1022 | allowemptyback = repo.ui.backupconfig('ui', 'allowemptycommit') | |
1023 | extra = {} |
|
1023 | extra = {} | |
1024 | for idfunc in extrapreimport: |
|
1024 | for idfunc in extrapreimport: | |
1025 | extrapreimportmap[idfunc](repo, extractdata, extra, opts) |
|
1025 | extrapreimportmap[idfunc](repo, extractdata, extra, opts) | |
1026 | try: |
|
1026 | try: | |
1027 | if partial: |
|
1027 | if partial: | |
1028 | repo.ui.setconfig('ui', 'allowemptycommit', True) |
|
1028 | repo.ui.setconfig('ui', 'allowemptycommit', True) | |
1029 | n = repo.commit(message, user, |
|
1029 | n = repo.commit(message, user, | |
1030 | date, match=m, |
|
1030 | date, match=m, | |
1031 | editor=editor, extra=extra) |
|
1031 | editor=editor, extra=extra) | |
1032 | for idfunc in extrapostimport: |
|
1032 | for idfunc in extrapostimport: | |
1033 | extrapostimportmap[idfunc](repo[n]) |
|
1033 | extrapostimportmap[idfunc](repo[n]) | |
1034 | finally: |
|
1034 | finally: | |
1035 | repo.ui.restoreconfig(allowemptyback) |
|
1035 | repo.ui.restoreconfig(allowemptyback) | |
1036 | else: |
|
1036 | else: | |
1037 | if opts.get('exact') or importbranch: |
|
1037 | if opts.get('exact') or importbranch: | |
1038 | branch = branch or 'default' |
|
1038 | branch = branch or 'default' | |
1039 | else: |
|
1039 | else: | |
1040 | branch = p1.branch() |
|
1040 | branch = p1.branch() | |
1041 | store = patch.filestore() |
|
1041 | store = patch.filestore() | |
1042 | try: |
|
1042 | try: | |
1043 | files = set() |
|
1043 | files = set() | |
1044 | try: |
|
1044 | try: | |
1045 | patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix, |
|
1045 | patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix, | |
1046 | files, eolmode=None) |
|
1046 | files, eolmode=None) | |
1047 | except patch.PatchError as e: |
|
1047 | except patch.PatchError as e: | |
1048 | raise error.Abort(str(e)) |
|
1048 | raise error.Abort(str(e)) | |
1049 | if opts.get('exact'): |
|
1049 | if opts.get('exact'): | |
1050 | editor = None |
|
1050 | editor = None | |
1051 | else: |
|
1051 | else: | |
1052 | editor = getcommiteditor(editform='import.bypass') |
|
1052 | editor = getcommiteditor(editform='import.bypass') | |
1053 | memctx = context.makememctx(repo, (p1.node(), p2.node()), |
|
1053 | memctx = context.makememctx(repo, (p1.node(), p2.node()), | |
1054 | message, |
|
1054 | message, | |
1055 | user, |
|
1055 | user, | |
1056 | date, |
|
1056 | date, | |
1057 | branch, files, store, |
|
1057 | branch, files, store, | |
1058 | editor=editor) |
|
1058 | editor=editor) | |
1059 | n = memctx.commit() |
|
1059 | n = memctx.commit() | |
1060 | finally: |
|
1060 | finally: | |
1061 | store.close() |
|
1061 | store.close() | |
1062 | if opts.get('exact') and nocommit: |
|
1062 | if opts.get('exact') and nocommit: | |
1063 | # --exact with --no-commit is still useful in that it does merge |
|
1063 | # --exact with --no-commit is still useful in that it does merge | |
1064 | # and branch bits |
|
1064 | # and branch bits | |
1065 | ui.warn(_("warning: can't check exact import with --no-commit\n")) |
|
1065 | ui.warn(_("warning: can't check exact import with --no-commit\n")) | |
1066 | elif opts.get('exact') and hex(n) != nodeid: |
|
1066 | elif opts.get('exact') and hex(n) != nodeid: | |
1067 | raise error.Abort(_('patch is damaged or loses information')) |
|
1067 | raise error.Abort(_('patch is damaged or loses information')) | |
1068 | msg = _('applied to working directory') |
|
1068 | msg = _('applied to working directory') | |
1069 | if n: |
|
1069 | if n: | |
1070 | # i18n: refers to a short changeset id |
|
1070 | # i18n: refers to a short changeset id | |
1071 | msg = _('created %s') % short(n) |
|
1071 | msg = _('created %s') % short(n) | |
1072 | return (msg, n, rejects) |
|
1072 | return (msg, n, rejects) | |
1073 | finally: |
|
1073 | finally: | |
1074 | os.unlink(tmpname) |
|
1074 | os.unlink(tmpname) | |
1075 |
|
1075 | |||
1076 | # facility to let extensions include additional data in an exported patch |
|
1076 | # facility to let extensions include additional data in an exported patch | |
1077 | # list of identifiers to be executed in order |
|
1077 | # list of identifiers to be executed in order | |
1078 | extraexport = [] |
|
1078 | extraexport = [] | |
1079 | # mapping from identifier to actual export function |
|
1079 | # mapping from identifier to actual export function | |
1080 | # function as to return a string to be added to the header or None |
|
1080 | # function as to return a string to be added to the header or None | |
1081 | # it is given two arguments (sequencenumber, changectx) |
|
1081 | # it is given two arguments (sequencenumber, changectx) | |
1082 | extraexportmap = {} |
|
1082 | extraexportmap = {} | |
1083 |
|
1083 | |||
1084 | def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, |
|
1084 | def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, | |
1085 | opts=None, match=None): |
|
1085 | opts=None, match=None): | |
1086 | '''export changesets as hg patches.''' |
|
1086 | '''export changesets as hg patches.''' | |
1087 |
|
1087 | |||
1088 | total = len(revs) |
|
1088 | total = len(revs) | |
1089 | revwidth = max([len(str(rev)) for rev in revs]) |
|
1089 | revwidth = max([len(str(rev)) for rev in revs]) | |
1090 | filemode = {} |
|
1090 | filemode = {} | |
1091 |
|
1091 | |||
1092 | def single(rev, seqno, fp): |
|
1092 | def single(rev, seqno, fp): | |
1093 | ctx = repo[rev] |
|
1093 | ctx = repo[rev] | |
1094 | node = ctx.node() |
|
1094 | node = ctx.node() | |
1095 | parents = [p.node() for p in ctx.parents() if p] |
|
1095 | parents = [p.node() for p in ctx.parents() if p] | |
1096 | branch = ctx.branch() |
|
1096 | branch = ctx.branch() | |
1097 | if switch_parent: |
|
1097 | if switch_parent: | |
1098 | parents.reverse() |
|
1098 | parents.reverse() | |
1099 |
|
1099 | |||
1100 | if parents: |
|
1100 | if parents: | |
1101 | prev = parents[0] |
|
1101 | prev = parents[0] | |
1102 | else: |
|
1102 | else: | |
1103 | prev = nullid |
|
1103 | prev = nullid | |
1104 |
|
1104 | |||
1105 | shouldclose = False |
|
1105 | shouldclose = False | |
1106 | if not fp and len(template) > 0: |
|
1106 | if not fp and len(template) > 0: | |
1107 | desc_lines = ctx.description().rstrip().split('\n') |
|
1107 | desc_lines = ctx.description().rstrip().split('\n') | |
1108 | desc = desc_lines[0] #Commit always has a first line. |
|
1108 | desc = desc_lines[0] #Commit always has a first line. | |
1109 | fp = makefileobj(repo, template, node, desc=desc, total=total, |
|
1109 | fp = makefileobj(repo, template, node, desc=desc, total=total, | |
1110 | seqno=seqno, revwidth=revwidth, mode='wb', |
|
1110 | seqno=seqno, revwidth=revwidth, mode='wb', | |
1111 | modemap=filemode) |
|
1111 | modemap=filemode) | |
1112 | shouldclose = True |
|
1112 | shouldclose = True | |
1113 | if fp and not getattr(fp, 'name', '<unnamed>').startswith('<'): |
|
1113 | if fp and not getattr(fp, 'name', '<unnamed>').startswith('<'): | |
1114 | repo.ui.note("%s\n" % fp.name) |
|
1114 | repo.ui.note("%s\n" % fp.name) | |
1115 |
|
1115 | |||
1116 | if not fp: |
|
1116 | if not fp: | |
1117 | write = repo.ui.write |
|
1117 | write = repo.ui.write | |
1118 | else: |
|
1118 | else: | |
1119 | def write(s, **kw): |
|
1119 | def write(s, **kw): | |
1120 | fp.write(s) |
|
1120 | fp.write(s) | |
1121 |
|
1121 | |||
1122 | write("# HG changeset patch\n") |
|
1122 | write("# HG changeset patch\n") | |
1123 | write("# User %s\n" % ctx.user()) |
|
1123 | write("# User %s\n" % ctx.user()) | |
1124 | write("# Date %d %d\n" % ctx.date()) |
|
1124 | write("# Date %d %d\n" % ctx.date()) | |
1125 | write("# %s\n" % util.datestr(ctx.date())) |
|
1125 | write("# %s\n" % util.datestr(ctx.date())) | |
1126 | if branch and branch != 'default': |
|
1126 | if branch and branch != 'default': | |
1127 | write("# Branch %s\n" % branch) |
|
1127 | write("# Branch %s\n" % branch) | |
1128 | write("# Node ID %s\n" % hex(node)) |
|
1128 | write("# Node ID %s\n" % hex(node)) | |
1129 | write("# Parent %s\n" % hex(prev)) |
|
1129 | write("# Parent %s\n" % hex(prev)) | |
1130 | if len(parents) > 1: |
|
1130 | if len(parents) > 1: | |
1131 | write("# Parent %s\n" % hex(parents[1])) |
|
1131 | write("# Parent %s\n" % hex(parents[1])) | |
1132 |
|
1132 | |||
1133 | for headerid in extraexport: |
|
1133 | for headerid in extraexport: | |
1134 | header = extraexportmap[headerid](seqno, ctx) |
|
1134 | header = extraexportmap[headerid](seqno, ctx) | |
1135 | if header is not None: |
|
1135 | if header is not None: | |
1136 | write('# %s\n' % header) |
|
1136 | write('# %s\n' % header) | |
1137 | write(ctx.description().rstrip()) |
|
1137 | write(ctx.description().rstrip()) | |
1138 | write("\n\n") |
|
1138 | write("\n\n") | |
1139 |
|
1139 | |||
1140 | for chunk, label in patch.diffui(repo, prev, node, match, opts=opts): |
|
1140 | for chunk, label in patch.diffui(repo, prev, node, match, opts=opts): | |
1141 | write(chunk, label=label) |
|
1141 | write(chunk, label=label) | |
1142 |
|
1142 | |||
1143 | if shouldclose: |
|
1143 | if shouldclose: | |
1144 | fp.close() |
|
1144 | fp.close() | |
1145 |
|
1145 | |||
1146 | for seqno, rev in enumerate(revs): |
|
1146 | for seqno, rev in enumerate(revs): | |
1147 | single(rev, seqno + 1, fp) |
|
1147 | single(rev, seqno + 1, fp) | |
1148 |
|
1148 | |||
1149 | def diffordiffstat(ui, repo, diffopts, node1, node2, match, |
|
1149 | def diffordiffstat(ui, repo, diffopts, node1, node2, match, | |
1150 | changes=None, stat=False, fp=None, prefix='', |
|
1150 | changes=None, stat=False, fp=None, prefix='', | |
1151 | root='', listsubrepos=False): |
|
1151 | root='', listsubrepos=False): | |
1152 | '''show diff or diffstat.''' |
|
1152 | '''show diff or diffstat.''' | |
1153 | if fp is None: |
|
1153 | if fp is None: | |
1154 | write = ui.write |
|
1154 | write = ui.write | |
1155 | else: |
|
1155 | else: | |
1156 | def write(s, **kw): |
|
1156 | def write(s, **kw): | |
1157 | fp.write(s) |
|
1157 | fp.write(s) | |
1158 |
|
1158 | |||
1159 | if root: |
|
1159 | if root: | |
1160 | relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) |
|
1160 | relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) | |
1161 | else: |
|
1161 | else: | |
1162 | relroot = '' |
|
1162 | relroot = '' | |
1163 | if relroot != '': |
|
1163 | if relroot != '': | |
1164 | # XXX relative roots currently don't work if the root is within a |
|
1164 | # XXX relative roots currently don't work if the root is within a | |
1165 | # subrepo |
|
1165 | # subrepo | |
1166 | uirelroot = match.uipath(relroot) |
|
1166 | uirelroot = match.uipath(relroot) | |
1167 | relroot += '/' |
|
1167 | relroot += '/' | |
1168 | for matchroot in match.files(): |
|
1168 | for matchroot in match.files(): | |
1169 | if not matchroot.startswith(relroot): |
|
1169 | if not matchroot.startswith(relroot): | |
1170 | ui.warn(_('warning: %s not inside relative root %s\n') % ( |
|
1170 | ui.warn(_('warning: %s not inside relative root %s\n') % ( | |
1171 | match.uipath(matchroot), uirelroot)) |
|
1171 | match.uipath(matchroot), uirelroot)) | |
1172 |
|
1172 | |||
1173 | if stat: |
|
1173 | if stat: | |
1174 | diffopts = diffopts.copy(context=0) |
|
1174 | diffopts = diffopts.copy(context=0) | |
1175 | width = 80 |
|
1175 | width = 80 | |
1176 | if not ui.plain(): |
|
1176 | if not ui.plain(): | |
1177 | width = ui.termwidth() |
|
1177 | width = ui.termwidth() | |
1178 | chunks = patch.diff(repo, node1, node2, match, changes, diffopts, |
|
1178 | chunks = patch.diff(repo, node1, node2, match, changes, diffopts, | |
1179 | prefix=prefix, relroot=relroot) |
|
1179 | prefix=prefix, relroot=relroot) | |
1180 | for chunk, label in patch.diffstatui(util.iterlines(chunks), |
|
1180 | for chunk, label in patch.diffstatui(util.iterlines(chunks), | |
1181 | width=width, |
|
1181 | width=width, | |
1182 | git=diffopts.git): |
|
1182 | git=diffopts.git): | |
1183 | write(chunk, label=label) |
|
1183 | write(chunk, label=label) | |
1184 | else: |
|
1184 | else: | |
1185 | for chunk, label in patch.diffui(repo, node1, node2, match, |
|
1185 | for chunk, label in patch.diffui(repo, node1, node2, match, | |
1186 | changes, diffopts, prefix=prefix, |
|
1186 | changes, diffopts, prefix=prefix, | |
1187 | relroot=relroot): |
|
1187 | relroot=relroot): | |
1188 | write(chunk, label=label) |
|
1188 | write(chunk, label=label) | |
1189 |
|
1189 | |||
1190 | if listsubrepos: |
|
1190 | if listsubrepos: | |
1191 | ctx1 = repo[node1] |
|
1191 | ctx1 = repo[node1] | |
1192 | ctx2 = repo[node2] |
|
1192 | ctx2 = repo[node2] | |
1193 | for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
|
1193 | for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): | |
1194 | tempnode2 = node2 |
|
1194 | tempnode2 = node2 | |
1195 | try: |
|
1195 | try: | |
1196 | if node2 is not None: |
|
1196 | if node2 is not None: | |
1197 | tempnode2 = ctx2.substate[subpath][1] |
|
1197 | tempnode2 = ctx2.substate[subpath][1] | |
1198 | except KeyError: |
|
1198 | except KeyError: | |
1199 | # A subrepo that existed in node1 was deleted between node1 and |
|
1199 | # A subrepo that existed in node1 was deleted between node1 and | |
1200 | # node2 (inclusive). Thus, ctx2's substate won't contain that |
|
1200 | # node2 (inclusive). Thus, ctx2's substate won't contain that | |
1201 | # subpath. The best we can do is to ignore it. |
|
1201 | # subpath. The best we can do is to ignore it. | |
1202 | tempnode2 = None |
|
1202 | tempnode2 = None | |
1203 | submatch = matchmod.subdirmatcher(subpath, match) |
|
1203 | submatch = matchmod.subdirmatcher(subpath, match) | |
1204 | sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, |
|
1204 | sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, | |
1205 | stat=stat, fp=fp, prefix=prefix) |
|
1205 | stat=stat, fp=fp, prefix=prefix) | |
1206 |
|
1206 | |||
1207 | class changeset_printer(object): |
|
1207 | class changeset_printer(object): | |
1208 | '''show changeset information when templating not requested.''' |
|
1208 | '''show changeset information when templating not requested.''' | |
1209 |
|
1209 | |||
1210 | def __init__(self, ui, repo, matchfn, diffopts, buffered): |
|
1210 | def __init__(self, ui, repo, matchfn, diffopts, buffered): | |
1211 | self.ui = ui |
|
1211 | self.ui = ui | |
1212 | self.repo = repo |
|
1212 | self.repo = repo | |
1213 | self.buffered = buffered |
|
1213 | self.buffered = buffered | |
1214 | self.matchfn = matchfn |
|
1214 | self.matchfn = matchfn | |
1215 | self.diffopts = diffopts |
|
1215 | self.diffopts = diffopts | |
1216 | self.header = {} |
|
1216 | self.header = {} | |
1217 | self.hunk = {} |
|
1217 | self.hunk = {} | |
1218 | self.lastheader = None |
|
1218 | self.lastheader = None | |
1219 | self.footer = None |
|
1219 | self.footer = None | |
1220 |
|
1220 | |||
1221 | def flush(self, ctx): |
|
1221 | def flush(self, ctx): | |
1222 | rev = ctx.rev() |
|
1222 | rev = ctx.rev() | |
1223 | if rev in self.header: |
|
1223 | if rev in self.header: | |
1224 | h = self.header[rev] |
|
1224 | h = self.header[rev] | |
1225 | if h != self.lastheader: |
|
1225 | if h != self.lastheader: | |
1226 | self.lastheader = h |
|
1226 | self.lastheader = h | |
1227 | self.ui.write(h) |
|
1227 | self.ui.write(h) | |
1228 | del self.header[rev] |
|
1228 | del self.header[rev] | |
1229 | if rev in self.hunk: |
|
1229 | if rev in self.hunk: | |
1230 | self.ui.write(self.hunk[rev]) |
|
1230 | self.ui.write(self.hunk[rev]) | |
1231 | del self.hunk[rev] |
|
1231 | del self.hunk[rev] | |
1232 | return 1 |
|
1232 | return 1 | |
1233 | return 0 |
|
1233 | return 0 | |
1234 |
|
1234 | |||
1235 | def close(self): |
|
1235 | def close(self): | |
1236 | if self.footer: |
|
1236 | if self.footer: | |
1237 | self.ui.write(self.footer) |
|
1237 | self.ui.write(self.footer) | |
1238 |
|
1238 | |||
1239 | def show(self, ctx, copies=None, matchfn=None, **props): |
|
1239 | def show(self, ctx, copies=None, matchfn=None, **props): | |
1240 | if self.buffered: |
|
1240 | if self.buffered: | |
1241 | self.ui.pushbuffer(labeled=True) |
|
1241 | self.ui.pushbuffer(labeled=True) | |
1242 | self._show(ctx, copies, matchfn, props) |
|
1242 | self._show(ctx, copies, matchfn, props) | |
1243 | self.hunk[ctx.rev()] = self.ui.popbuffer() |
|
1243 | self.hunk[ctx.rev()] = self.ui.popbuffer() | |
1244 | else: |
|
1244 | else: | |
1245 | self._show(ctx, copies, matchfn, props) |
|
1245 | self._show(ctx, copies, matchfn, props) | |
1246 |
|
1246 | |||
1247 | def _show(self, ctx, copies, matchfn, props): |
|
1247 | def _show(self, ctx, copies, matchfn, props): | |
1248 | '''show a single changeset or file revision''' |
|
1248 | '''show a single changeset or file revision''' | |
1249 | changenode = ctx.node() |
|
1249 | changenode = ctx.node() | |
1250 | rev = ctx.rev() |
|
1250 | rev = ctx.rev() | |
1251 | if self.ui.debugflag: |
|
1251 | if self.ui.debugflag: | |
1252 | hexfunc = hex |
|
1252 | hexfunc = hex | |
1253 | else: |
|
1253 | else: | |
1254 | hexfunc = short |
|
1254 | hexfunc = short | |
1255 | # as of now, wctx.node() and wctx.rev() return None, but we want to |
|
1255 | # as of now, wctx.node() and wctx.rev() return None, but we want to | |
1256 | # show the same values as {node} and {rev} templatekw |
|
1256 | # show the same values as {node} and {rev} templatekw | |
1257 | revnode = (scmutil.intrev(rev), hexfunc(bin(ctx.hex()))) |
|
1257 | revnode = (scmutil.intrev(rev), hexfunc(bin(ctx.hex()))) | |
1258 |
|
1258 | |||
1259 | if self.ui.quiet: |
|
1259 | if self.ui.quiet: | |
1260 | self.ui.write("%d:%s\n" % revnode, label='log.node') |
|
1260 | self.ui.write("%d:%s\n" % revnode, label='log.node') | |
1261 | return |
|
1261 | return | |
1262 |
|
1262 | |||
1263 | date = util.datestr(ctx.date()) |
|
1263 | date = util.datestr(ctx.date()) | |
1264 |
|
1264 | |||
1265 | # i18n: column positioning for "hg log" |
|
1265 | # i18n: column positioning for "hg log" | |
1266 | self.ui.write(_("changeset: %d:%s\n") % revnode, |
|
1266 | self.ui.write(_("changeset: %d:%s\n") % revnode, | |
1267 | label='log.changeset changeset.%s' % ctx.phasestr()) |
|
1267 | label='log.changeset changeset.%s' % ctx.phasestr()) | |
1268 |
|
1268 | |||
1269 | # branches are shown first before any other names due to backwards |
|
1269 | # branches are shown first before any other names due to backwards | |
1270 | # compatibility |
|
1270 | # compatibility | |
1271 | branch = ctx.branch() |
|
1271 | branch = ctx.branch() | |
1272 | # don't show the default branch name |
|
1272 | # don't show the default branch name | |
1273 | if branch != 'default': |
|
1273 | if branch != 'default': | |
1274 | # i18n: column positioning for "hg log" |
|
1274 | # i18n: column positioning for "hg log" | |
1275 | self.ui.write(_("branch: %s\n") % branch, |
|
1275 | self.ui.write(_("branch: %s\n") % branch, | |
1276 | label='log.branch') |
|
1276 | label='log.branch') | |
1277 |
|
1277 | |||
1278 | for name, ns in self.repo.names.iteritems(): |
|
1278 | for name, ns in self.repo.names.iteritems(): | |
1279 | # branches has special logic already handled above, so here we just |
|
1279 | # branches has special logic already handled above, so here we just | |
1280 | # skip it |
|
1280 | # skip it | |
1281 | if name == 'branches': |
|
1281 | if name == 'branches': | |
1282 | continue |
|
1282 | continue | |
1283 | # we will use the templatename as the color name since those two |
|
1283 | # we will use the templatename as the color name since those two | |
1284 | # should be the same |
|
1284 | # should be the same | |
1285 | for name in ns.names(self.repo, changenode): |
|
1285 | for name in ns.names(self.repo, changenode): | |
1286 | self.ui.write(ns.logfmt % name, |
|
1286 | self.ui.write(ns.logfmt % name, | |
1287 | label='log.%s' % ns.colorname) |
|
1287 | label='log.%s' % ns.colorname) | |
1288 | if self.ui.debugflag: |
|
1288 | if self.ui.debugflag: | |
1289 | # i18n: column positioning for "hg log" |
|
1289 | # i18n: column positioning for "hg log" | |
1290 | self.ui.write(_("phase: %s\n") % ctx.phasestr(), |
|
1290 | self.ui.write(_("phase: %s\n") % ctx.phasestr(), | |
1291 | label='log.phase') |
|
1291 | label='log.phase') | |
1292 | for pctx in scmutil.meaningfulparents(self.repo, ctx): |
|
1292 | for pctx in scmutil.meaningfulparents(self.repo, ctx): | |
1293 | label = 'log.parent changeset.%s' % pctx.phasestr() |
|
1293 | label = 'log.parent changeset.%s' % pctx.phasestr() | |
1294 | # i18n: column positioning for "hg log" |
|
1294 | # i18n: column positioning for "hg log" | |
1295 | self.ui.write(_("parent: %d:%s\n") |
|
1295 | self.ui.write(_("parent: %d:%s\n") | |
1296 | % (pctx.rev(), hexfunc(pctx.node())), |
|
1296 | % (pctx.rev(), hexfunc(pctx.node())), | |
1297 | label=label) |
|
1297 | label=label) | |
1298 |
|
1298 | |||
1299 | if self.ui.debugflag and rev is not None: |
|
1299 | if self.ui.debugflag and rev is not None: | |
1300 | mnode = ctx.manifestnode() |
|
1300 | mnode = ctx.manifestnode() | |
1301 | # i18n: column positioning for "hg log" |
|
1301 | # i18n: column positioning for "hg log" | |
1302 | self.ui.write(_("manifest: %d:%s\n") % |
|
1302 | self.ui.write(_("manifest: %d:%s\n") % | |
1303 | (self.repo.manifest.rev(mnode), hex(mnode)), |
|
1303 | (self.repo.manifest.rev(mnode), hex(mnode)), | |
1304 | label='ui.debug log.manifest') |
|
1304 | label='ui.debug log.manifest') | |
1305 | # i18n: column positioning for "hg log" |
|
1305 | # i18n: column positioning for "hg log" | |
1306 | self.ui.write(_("user: %s\n") % ctx.user(), |
|
1306 | self.ui.write(_("user: %s\n") % ctx.user(), | |
1307 | label='log.user') |
|
1307 | label='log.user') | |
1308 | # i18n: column positioning for "hg log" |
|
1308 | # i18n: column positioning for "hg log" | |
1309 | self.ui.write(_("date: %s\n") % date, |
|
1309 | self.ui.write(_("date: %s\n") % date, | |
1310 | label='log.date') |
|
1310 | label='log.date') | |
1311 |
|
1311 | |||
1312 | if self.ui.debugflag: |
|
1312 | if self.ui.debugflag: | |
1313 | files = ctx.p1().status(ctx)[:3] |
|
1313 | files = ctx.p1().status(ctx)[:3] | |
1314 | for key, value in zip([# i18n: column positioning for "hg log" |
|
1314 | for key, value in zip([# i18n: column positioning for "hg log" | |
1315 | _("files:"), |
|
1315 | _("files:"), | |
1316 | # i18n: column positioning for "hg log" |
|
1316 | # i18n: column positioning for "hg log" | |
1317 | _("files+:"), |
|
1317 | _("files+:"), | |
1318 | # i18n: column positioning for "hg log" |
|
1318 | # i18n: column positioning for "hg log" | |
1319 | _("files-:")], files): |
|
1319 | _("files-:")], files): | |
1320 | if value: |
|
1320 | if value: | |
1321 | self.ui.write("%-12s %s\n" % (key, " ".join(value)), |
|
1321 | self.ui.write("%-12s %s\n" % (key, " ".join(value)), | |
1322 | label='ui.debug log.files') |
|
1322 | label='ui.debug log.files') | |
1323 | elif ctx.files() and self.ui.verbose: |
|
1323 | elif ctx.files() and self.ui.verbose: | |
1324 | # i18n: column positioning for "hg log" |
|
1324 | # i18n: column positioning for "hg log" | |
1325 | self.ui.write(_("files: %s\n") % " ".join(ctx.files()), |
|
1325 | self.ui.write(_("files: %s\n") % " ".join(ctx.files()), | |
1326 | label='ui.note log.files') |
|
1326 | label='ui.note log.files') | |
1327 | if copies and self.ui.verbose: |
|
1327 | if copies and self.ui.verbose: | |
1328 | copies = ['%s (%s)' % c for c in copies] |
|
1328 | copies = ['%s (%s)' % c for c in copies] | |
1329 | # i18n: column positioning for "hg log" |
|
1329 | # i18n: column positioning for "hg log" | |
1330 | self.ui.write(_("copies: %s\n") % ' '.join(copies), |
|
1330 | self.ui.write(_("copies: %s\n") % ' '.join(copies), | |
1331 | label='ui.note log.copies') |
|
1331 | label='ui.note log.copies') | |
1332 |
|
1332 | |||
1333 | extra = ctx.extra() |
|
1333 | extra = ctx.extra() | |
1334 | if extra and self.ui.debugflag: |
|
1334 | if extra and self.ui.debugflag: | |
1335 | for key, value in sorted(extra.items()): |
|
1335 | for key, value in sorted(extra.items()): | |
1336 | # i18n: column positioning for "hg log" |
|
1336 | # i18n: column positioning for "hg log" | |
1337 | self.ui.write(_("extra: %s=%s\n") |
|
1337 | self.ui.write(_("extra: %s=%s\n") | |
1338 | % (key, value.encode('string_escape')), |
|
1338 | % (key, value.encode('string_escape')), | |
1339 | label='ui.debug log.extra') |
|
1339 | label='ui.debug log.extra') | |
1340 |
|
1340 | |||
1341 | description = ctx.description().strip() |
|
1341 | description = ctx.description().strip() | |
1342 | if description: |
|
1342 | if description: | |
1343 | if self.ui.verbose: |
|
1343 | if self.ui.verbose: | |
1344 | self.ui.write(_("description:\n"), |
|
1344 | self.ui.write(_("description:\n"), | |
1345 | label='ui.note log.description') |
|
1345 | label='ui.note log.description') | |
1346 | self.ui.write(description, |
|
1346 | self.ui.write(description, | |
1347 | label='ui.note log.description') |
|
1347 | label='ui.note log.description') | |
1348 | self.ui.write("\n\n") |
|
1348 | self.ui.write("\n\n") | |
1349 | else: |
|
1349 | else: | |
1350 | # i18n: column positioning for "hg log" |
|
1350 | # i18n: column positioning for "hg log" | |
1351 | self.ui.write(_("summary: %s\n") % |
|
1351 | self.ui.write(_("summary: %s\n") % | |
1352 | description.splitlines()[0], |
|
1352 | description.splitlines()[0], | |
1353 | label='log.summary') |
|
1353 | label='log.summary') | |
1354 | self.ui.write("\n") |
|
1354 | self.ui.write("\n") | |
1355 |
|
1355 | |||
1356 | self.showpatch(ctx, matchfn) |
|
1356 | self.showpatch(ctx, matchfn) | |
1357 |
|
1357 | |||
1358 | def showpatch(self, ctx, matchfn): |
|
1358 | def showpatch(self, ctx, matchfn): | |
1359 | if not matchfn: |
|
1359 | if not matchfn: | |
1360 | matchfn = self.matchfn |
|
1360 | matchfn = self.matchfn | |
1361 | if matchfn: |
|
1361 | if matchfn: | |
1362 | stat = self.diffopts.get('stat') |
|
1362 | stat = self.diffopts.get('stat') | |
1363 | diff = self.diffopts.get('patch') |
|
1363 | diff = self.diffopts.get('patch') | |
1364 | diffopts = patch.diffallopts(self.ui, self.diffopts) |
|
1364 | diffopts = patch.diffallopts(self.ui, self.diffopts) | |
1365 | node = ctx.node() |
|
1365 | node = ctx.node() | |
1366 | prev = ctx.p1().node() |
|
1366 | prev = ctx.p1().node() | |
1367 | if stat: |
|
1367 | if stat: | |
1368 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, |
|
1368 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, | |
1369 | match=matchfn, stat=True) |
|
1369 | match=matchfn, stat=True) | |
1370 | if diff: |
|
1370 | if diff: | |
1371 | if stat: |
|
1371 | if stat: | |
1372 | self.ui.write("\n") |
|
1372 | self.ui.write("\n") | |
1373 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, |
|
1373 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, | |
1374 | match=matchfn, stat=False) |
|
1374 | match=matchfn, stat=False) | |
1375 | self.ui.write("\n") |
|
1375 | self.ui.write("\n") | |
1376 |
|
1376 | |||
1377 | class jsonchangeset(changeset_printer): |
|
1377 | class jsonchangeset(changeset_printer): | |
1378 | '''format changeset information.''' |
|
1378 | '''format changeset information.''' | |
1379 |
|
1379 | |||
1380 | def __init__(self, ui, repo, matchfn, diffopts, buffered): |
|
1380 | def __init__(self, ui, repo, matchfn, diffopts, buffered): | |
1381 | changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) |
|
1381 | changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) | |
1382 | self.cache = {} |
|
1382 | self.cache = {} | |
1383 | self._first = True |
|
1383 | self._first = True | |
1384 |
|
1384 | |||
1385 | def close(self): |
|
1385 | def close(self): | |
1386 | if not self._first: |
|
1386 | if not self._first: | |
1387 | self.ui.write("\n]\n") |
|
1387 | self.ui.write("\n]\n") | |
1388 | else: |
|
1388 | else: | |
1389 | self.ui.write("[]\n") |
|
1389 | self.ui.write("[]\n") | |
1390 |
|
1390 | |||
1391 | def _show(self, ctx, copies, matchfn, props): |
|
1391 | def _show(self, ctx, copies, matchfn, props): | |
1392 | '''show a single changeset or file revision''' |
|
1392 | '''show a single changeset or file revision''' | |
1393 | rev = ctx.rev() |
|
1393 | rev = ctx.rev() | |
1394 | if rev is None: |
|
1394 | if rev is None: | |
1395 | jrev = jnode = 'null' |
|
1395 | jrev = jnode = 'null' | |
1396 | else: |
|
1396 | else: | |
1397 | jrev = str(rev) |
|
1397 | jrev = str(rev) | |
1398 | jnode = '"%s"' % hex(ctx.node()) |
|
1398 | jnode = '"%s"' % hex(ctx.node()) | |
1399 | j = encoding.jsonescape |
|
1399 | j = encoding.jsonescape | |
1400 |
|
1400 | |||
1401 | if self._first: |
|
1401 | if self._first: | |
1402 | self.ui.write("[\n {") |
|
1402 | self.ui.write("[\n {") | |
1403 | self._first = False |
|
1403 | self._first = False | |
1404 | else: |
|
1404 | else: | |
1405 | self.ui.write(",\n {") |
|
1405 | self.ui.write(",\n {") | |
1406 |
|
1406 | |||
1407 | if self.ui.quiet: |
|
1407 | if self.ui.quiet: | |
1408 | self.ui.write('\n "rev": %s' % jrev) |
|
1408 | self.ui.write('\n "rev": %s' % jrev) | |
1409 | self.ui.write(',\n "node": %s' % jnode) |
|
1409 | self.ui.write(',\n "node": %s' % jnode) | |
1410 | self.ui.write('\n }') |
|
1410 | self.ui.write('\n }') | |
1411 | return |
|
1411 | return | |
1412 |
|
1412 | |||
1413 | self.ui.write('\n "rev": %s' % jrev) |
|
1413 | self.ui.write('\n "rev": %s' % jrev) | |
1414 | self.ui.write(',\n "node": %s' % jnode) |
|
1414 | self.ui.write(',\n "node": %s' % jnode) | |
1415 | self.ui.write(',\n "branch": "%s"' % j(ctx.branch())) |
|
1415 | self.ui.write(',\n "branch": "%s"' % j(ctx.branch())) | |
1416 | self.ui.write(',\n "phase": "%s"' % ctx.phasestr()) |
|
1416 | self.ui.write(',\n "phase": "%s"' % ctx.phasestr()) | |
1417 | self.ui.write(',\n "user": "%s"' % j(ctx.user())) |
|
1417 | self.ui.write(',\n "user": "%s"' % j(ctx.user())) | |
1418 | self.ui.write(',\n "date": [%d, %d]' % ctx.date()) |
|
1418 | self.ui.write(',\n "date": [%d, %d]' % ctx.date()) | |
1419 | self.ui.write(',\n "desc": "%s"' % j(ctx.description())) |
|
1419 | self.ui.write(',\n "desc": "%s"' % j(ctx.description())) | |
1420 |
|
1420 | |||
1421 | self.ui.write(',\n "bookmarks": [%s]' % |
|
1421 | self.ui.write(',\n "bookmarks": [%s]' % | |
1422 | ", ".join('"%s"' % j(b) for b in ctx.bookmarks())) |
|
1422 | ", ".join('"%s"' % j(b) for b in ctx.bookmarks())) | |
1423 | self.ui.write(',\n "tags": [%s]' % |
|
1423 | self.ui.write(',\n "tags": [%s]' % | |
1424 | ", ".join('"%s"' % j(t) for t in ctx.tags())) |
|
1424 | ", ".join('"%s"' % j(t) for t in ctx.tags())) | |
1425 | self.ui.write(',\n "parents": [%s]' % |
|
1425 | self.ui.write(',\n "parents": [%s]' % | |
1426 | ", ".join('"%s"' % c.hex() for c in ctx.parents())) |
|
1426 | ", ".join('"%s"' % c.hex() for c in ctx.parents())) | |
1427 |
|
1427 | |||
1428 | if self.ui.debugflag: |
|
1428 | if self.ui.debugflag: | |
1429 | if rev is None: |
|
1429 | if rev is None: | |
1430 | jmanifestnode = 'null' |
|
1430 | jmanifestnode = 'null' | |
1431 | else: |
|
1431 | else: | |
1432 | jmanifestnode = '"%s"' % hex(ctx.manifestnode()) |
|
1432 | jmanifestnode = '"%s"' % hex(ctx.manifestnode()) | |
1433 | self.ui.write(',\n "manifest": %s' % jmanifestnode) |
|
1433 | self.ui.write(',\n "manifest": %s' % jmanifestnode) | |
1434 |
|
1434 | |||
1435 | self.ui.write(',\n "extra": {%s}' % |
|
1435 | self.ui.write(',\n "extra": {%s}' % | |
1436 | ", ".join('"%s": "%s"' % (j(k), j(v)) |
|
1436 | ", ".join('"%s": "%s"' % (j(k), j(v)) | |
1437 | for k, v in ctx.extra().items())) |
|
1437 | for k, v in ctx.extra().items())) | |
1438 |
|
1438 | |||
1439 | files = ctx.p1().status(ctx) |
|
1439 | files = ctx.p1().status(ctx) | |
1440 | self.ui.write(',\n "modified": [%s]' % |
|
1440 | self.ui.write(',\n "modified": [%s]' % | |
1441 | ", ".join('"%s"' % j(f) for f in files[0])) |
|
1441 | ", ".join('"%s"' % j(f) for f in files[0])) | |
1442 | self.ui.write(',\n "added": [%s]' % |
|
1442 | self.ui.write(',\n "added": [%s]' % | |
1443 | ", ".join('"%s"' % j(f) for f in files[1])) |
|
1443 | ", ".join('"%s"' % j(f) for f in files[1])) | |
1444 | self.ui.write(',\n "removed": [%s]' % |
|
1444 | self.ui.write(',\n "removed": [%s]' % | |
1445 | ", ".join('"%s"' % j(f) for f in files[2])) |
|
1445 | ", ".join('"%s"' % j(f) for f in files[2])) | |
1446 |
|
1446 | |||
1447 | elif self.ui.verbose: |
|
1447 | elif self.ui.verbose: | |
1448 | self.ui.write(',\n "files": [%s]' % |
|
1448 | self.ui.write(',\n "files": [%s]' % | |
1449 | ", ".join('"%s"' % j(f) for f in ctx.files())) |
|
1449 | ", ".join('"%s"' % j(f) for f in ctx.files())) | |
1450 |
|
1450 | |||
1451 | if copies: |
|
1451 | if copies: | |
1452 | self.ui.write(',\n "copies": {%s}' % |
|
1452 | self.ui.write(',\n "copies": {%s}' % | |
1453 | ", ".join('"%s": "%s"' % (j(k), j(v)) |
|
1453 | ", ".join('"%s": "%s"' % (j(k), j(v)) | |
1454 | for k, v in copies)) |
|
1454 | for k, v in copies)) | |
1455 |
|
1455 | |||
1456 | matchfn = self.matchfn |
|
1456 | matchfn = self.matchfn | |
1457 | if matchfn: |
|
1457 | if matchfn: | |
1458 | stat = self.diffopts.get('stat') |
|
1458 | stat = self.diffopts.get('stat') | |
1459 | diff = self.diffopts.get('patch') |
|
1459 | diff = self.diffopts.get('patch') | |
1460 | diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True) |
|
1460 | diffopts = patch.difffeatureopts(self.ui, self.diffopts, git=True) | |
1461 | node, prev = ctx.node(), ctx.p1().node() |
|
1461 | node, prev = ctx.node(), ctx.p1().node() | |
1462 | if stat: |
|
1462 | if stat: | |
1463 | self.ui.pushbuffer() |
|
1463 | self.ui.pushbuffer() | |
1464 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, |
|
1464 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, | |
1465 | match=matchfn, stat=True) |
|
1465 | match=matchfn, stat=True) | |
1466 | self.ui.write(',\n "diffstat": "%s"' % j(self.ui.popbuffer())) |
|
1466 | self.ui.write(',\n "diffstat": "%s"' % j(self.ui.popbuffer())) | |
1467 | if diff: |
|
1467 | if diff: | |
1468 | self.ui.pushbuffer() |
|
1468 | self.ui.pushbuffer() | |
1469 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, |
|
1469 | diffordiffstat(self.ui, self.repo, diffopts, prev, node, | |
1470 | match=matchfn, stat=False) |
|
1470 | match=matchfn, stat=False) | |
1471 | self.ui.write(',\n "diff": "%s"' % j(self.ui.popbuffer())) |
|
1471 | self.ui.write(',\n "diff": "%s"' % j(self.ui.popbuffer())) | |
1472 |
|
1472 | |||
1473 | self.ui.write("\n }") |
|
1473 | self.ui.write("\n }") | |
1474 |
|
1474 | |||
1475 | class changeset_templater(changeset_printer): |
|
1475 | class changeset_templater(changeset_printer): | |
1476 | '''format changeset information.''' |
|
1476 | '''format changeset information.''' | |
1477 |
|
1477 | |||
1478 | def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered): |
|
1478 | def __init__(self, ui, repo, matchfn, diffopts, tmpl, mapfile, buffered): | |
1479 | changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) |
|
1479 | changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) | |
1480 | formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12]) |
|
1480 | formatnode = ui.debugflag and (lambda x: x) or (lambda x: x[:12]) | |
1481 | defaulttempl = { |
|
1481 | defaulttempl = { | |
1482 | 'parent': '{rev}:{node|formatnode} ', |
|
1482 | 'parent': '{rev}:{node|formatnode} ', | |
1483 | 'manifest': '{rev}:{node|formatnode}', |
|
1483 | 'manifest': '{rev}:{node|formatnode}', | |
1484 | 'file_copy': '{name} ({source})', |
|
1484 | 'file_copy': '{name} ({source})', | |
1485 | 'extra': '{key}={value|stringescape}' |
|
1485 | 'extra': '{key}={value|stringescape}' | |
1486 | } |
|
1486 | } | |
1487 | # filecopy is preserved for compatibility reasons |
|
1487 | # filecopy is preserved for compatibility reasons | |
1488 | defaulttempl['filecopy'] = defaulttempl['file_copy'] |
|
1488 | defaulttempl['filecopy'] = defaulttempl['file_copy'] | |
1489 | self.t = templater.templater(mapfile, {'formatnode': formatnode}, |
|
1489 | self.t = templater.templater(mapfile, {'formatnode': formatnode}, | |
1490 | cache=defaulttempl) |
|
1490 | cache=defaulttempl) | |
1491 | if tmpl: |
|
1491 | if tmpl: | |
1492 | self.t.cache['changeset'] = tmpl |
|
1492 | self.t.cache['changeset'] = tmpl | |
1493 |
|
1493 | |||
1494 | self.cache = {} |
|
1494 | self.cache = {} | |
1495 |
|
1495 | |||
1496 | # find correct templates for current mode |
|
1496 | # find correct templates for current mode | |
1497 | tmplmodes = [ |
|
1497 | tmplmodes = [ | |
1498 | (True, None), |
|
1498 | (True, None), | |
1499 | (self.ui.verbose, 'verbose'), |
|
1499 | (self.ui.verbose, 'verbose'), | |
1500 | (self.ui.quiet, 'quiet'), |
|
1500 | (self.ui.quiet, 'quiet'), | |
1501 | (self.ui.debugflag, 'debug'), |
|
1501 | (self.ui.debugflag, 'debug'), | |
1502 | ] |
|
1502 | ] | |
1503 |
|
1503 | |||
1504 | self._parts = {'header': '', 'footer': '', 'changeset': 'changeset', |
|
1504 | self._parts = {'header': '', 'footer': '', 'changeset': 'changeset', | |
1505 | 'docheader': '', 'docfooter': ''} |
|
1505 | 'docheader': '', 'docfooter': ''} | |
1506 | for mode, postfix in tmplmodes: |
|
1506 | for mode, postfix in tmplmodes: | |
1507 | for t in self._parts: |
|
1507 | for t in self._parts: | |
1508 | cur = t |
|
1508 | cur = t | |
1509 | if postfix: |
|
1509 | if postfix: | |
1510 | cur += "_" + postfix |
|
1510 | cur += "_" + postfix | |
1511 | if mode and cur in self.t: |
|
1511 | if mode and cur in self.t: | |
1512 | self._parts[t] = cur |
|
1512 | self._parts[t] = cur | |
1513 |
|
1513 | |||
1514 | if self._parts['docheader']: |
|
1514 | if self._parts['docheader']: | |
1515 | self.ui.write(templater.stringify(self.t(self._parts['docheader']))) |
|
1515 | self.ui.write(templater.stringify(self.t(self._parts['docheader']))) | |
1516 |
|
1516 | |||
1517 | def close(self): |
|
1517 | def close(self): | |
1518 | if self._parts['docfooter']: |
|
1518 | if self._parts['docfooter']: | |
1519 | if not self.footer: |
|
1519 | if not self.footer: | |
1520 | self.footer = "" |
|
1520 | self.footer = "" | |
1521 | self.footer += templater.stringify(self.t(self._parts['docfooter'])) |
|
1521 | self.footer += templater.stringify(self.t(self._parts['docfooter'])) | |
1522 | return super(changeset_templater, self).close() |
|
1522 | return super(changeset_templater, self).close() | |
1523 |
|
1523 | |||
1524 | def _show(self, ctx, copies, matchfn, props): |
|
1524 | def _show(self, ctx, copies, matchfn, props): | |
1525 | '''show a single changeset or file revision''' |
|
1525 | '''show a single changeset or file revision''' | |
1526 | props = props.copy() |
|
1526 | props = props.copy() | |
1527 | props.update(templatekw.keywords) |
|
1527 | props.update(templatekw.keywords) | |
1528 | props['templ'] = self.t |
|
1528 | props['templ'] = self.t | |
1529 | props['ctx'] = ctx |
|
1529 | props['ctx'] = ctx | |
1530 | props['repo'] = self.repo |
|
1530 | props['repo'] = self.repo | |
1531 | props['ui'] = self.repo.ui |
|
1531 | props['ui'] = self.repo.ui | |
1532 | props['revcache'] = {'copies': copies} |
|
1532 | props['revcache'] = {'copies': copies} | |
1533 | props['cache'] = self.cache |
|
1533 | props['cache'] = self.cache | |
1534 |
|
1534 | |||
1535 | # write header |
|
1535 | # write header | |
1536 | if self._parts['header']: |
|
1536 | if self._parts['header']: | |
1537 | h = templater.stringify(self.t(self._parts['header'], **props)) |
|
1537 | h = templater.stringify(self.t(self._parts['header'], **props)) | |
1538 | if self.buffered: |
|
1538 | if self.buffered: | |
1539 | self.header[ctx.rev()] = h |
|
1539 | self.header[ctx.rev()] = h | |
1540 | else: |
|
1540 | else: | |
1541 | if self.lastheader != h: |
|
1541 | if self.lastheader != h: | |
1542 | self.lastheader = h |
|
1542 | self.lastheader = h | |
1543 | self.ui.write(h) |
|
1543 | self.ui.write(h) | |
1544 |
|
1544 | |||
1545 | # write changeset metadata, then patch if requested |
|
1545 | # write changeset metadata, then patch if requested | |
1546 | key = self._parts['changeset'] |
|
1546 | key = self._parts['changeset'] | |
1547 | self.ui.write(templater.stringify(self.t(key, **props))) |
|
1547 | self.ui.write(templater.stringify(self.t(key, **props))) | |
1548 | self.showpatch(ctx, matchfn) |
|
1548 | self.showpatch(ctx, matchfn) | |
1549 |
|
1549 | |||
1550 | if self._parts['footer']: |
|
1550 | if self._parts['footer']: | |
1551 | if not self.footer: |
|
1551 | if not self.footer: | |
1552 | self.footer = templater.stringify( |
|
1552 | self.footer = templater.stringify( | |
1553 | self.t(self._parts['footer'], **props)) |
|
1553 | self.t(self._parts['footer'], **props)) | |
1554 |
|
1554 | |||
1555 | def gettemplate(ui, tmpl, style): |
|
1555 | def gettemplate(ui, tmpl, style): | |
1556 | """ |
|
1556 | """ | |
1557 | Find the template matching the given template spec or style. |
|
1557 | Find the template matching the given template spec or style. | |
1558 | """ |
|
1558 | """ | |
1559 |
|
1559 | |||
1560 | # ui settings |
|
1560 | # ui settings | |
1561 | if not tmpl and not style: # template are stronger than style |
|
1561 | if not tmpl and not style: # template are stronger than style | |
1562 | tmpl = ui.config('ui', 'logtemplate') |
|
1562 | tmpl = ui.config('ui', 'logtemplate') | |
1563 | if tmpl: |
|
1563 | if tmpl: | |
1564 | return templater.unquotestring(tmpl), None |
|
1564 | return templater.unquotestring(tmpl), None | |
1565 | else: |
|
1565 | else: | |
1566 | style = util.expandpath(ui.config('ui', 'style', '')) |
|
1566 | style = util.expandpath(ui.config('ui', 'style', '')) | |
1567 |
|
1567 | |||
1568 | if not tmpl and style: |
|
1568 | if not tmpl and style: | |
1569 | mapfile = style |
|
1569 | mapfile = style | |
1570 | if not os.path.split(mapfile)[0]: |
|
1570 | if not os.path.split(mapfile)[0]: | |
1571 | mapname = (templater.templatepath('map-cmdline.' + mapfile) |
|
1571 | mapname = (templater.templatepath('map-cmdline.' + mapfile) | |
1572 | or templater.templatepath(mapfile)) |
|
1572 | or templater.templatepath(mapfile)) | |
1573 | if mapname: |
|
1573 | if mapname: | |
1574 | mapfile = mapname |
|
1574 | mapfile = mapname | |
1575 | return None, mapfile |
|
1575 | return None, mapfile | |
1576 |
|
1576 | |||
1577 | if not tmpl: |
|
1577 | if not tmpl: | |
1578 | return None, None |
|
1578 | return None, None | |
1579 |
|
1579 | |||
1580 | return formatter.lookuptemplate(ui, 'changeset', tmpl) |
|
1580 | return formatter.lookuptemplate(ui, 'changeset', tmpl) | |
1581 |
|
1581 | |||
1582 | def show_changeset(ui, repo, opts, buffered=False): |
|
1582 | def show_changeset(ui, repo, opts, buffered=False): | |
1583 | """show one changeset using template or regular display. |
|
1583 | """show one changeset using template or regular display. | |
1584 |
|
1584 | |||
1585 | Display format will be the first non-empty hit of: |
|
1585 | Display format will be the first non-empty hit of: | |
1586 | 1. option 'template' |
|
1586 | 1. option 'template' | |
1587 | 2. option 'style' |
|
1587 | 2. option 'style' | |
1588 | 3. [ui] setting 'logtemplate' |
|
1588 | 3. [ui] setting 'logtemplate' | |
1589 | 4. [ui] setting 'style' |
|
1589 | 4. [ui] setting 'style' | |
1590 | If all of these values are either the unset or the empty string, |
|
1590 | If all of these values are either the unset or the empty string, | |
1591 | regular display via changeset_printer() is done. |
|
1591 | regular display via changeset_printer() is done. | |
1592 | """ |
|
1592 | """ | |
1593 | # options |
|
1593 | # options | |
1594 | matchfn = None |
|
1594 | matchfn = None | |
1595 | if opts.get('patch') or opts.get('stat'): |
|
1595 | if opts.get('patch') or opts.get('stat'): | |
1596 | matchfn = scmutil.matchall(repo) |
|
1596 | matchfn = scmutil.matchall(repo) | |
1597 |
|
1597 | |||
1598 | if opts.get('template') == 'json': |
|
1598 | if opts.get('template') == 'json': | |
1599 | return jsonchangeset(ui, repo, matchfn, opts, buffered) |
|
1599 | return jsonchangeset(ui, repo, matchfn, opts, buffered) | |
1600 |
|
1600 | |||
1601 | tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style')) |
|
1601 | tmpl, mapfile = gettemplate(ui, opts.get('template'), opts.get('style')) | |
1602 |
|
1602 | |||
1603 | if not tmpl and not mapfile: |
|
1603 | if not tmpl and not mapfile: | |
1604 | return changeset_printer(ui, repo, matchfn, opts, buffered) |
|
1604 | return changeset_printer(ui, repo, matchfn, opts, buffered) | |
1605 |
|
1605 | |||
1606 | return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered) |
|
1606 | return changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered) | |
1607 |
|
1607 | |||
1608 | def showmarker(ui, marker, index=None): |
|
1608 | def showmarker(ui, marker, index=None): | |
1609 | """utility function to display obsolescence marker in a readable way |
|
1609 | """utility function to display obsolescence marker in a readable way | |
1610 |
|
1610 | |||
1611 | To be used by debug function.""" |
|
1611 | To be used by debug function.""" | |
1612 | if index is not None: |
|
1612 | if index is not None: | |
1613 | ui.write("%i " % index) |
|
1613 | ui.write("%i " % index) | |
1614 | ui.write(hex(marker.precnode())) |
|
1614 | ui.write(hex(marker.precnode())) | |
1615 | for repl in marker.succnodes(): |
|
1615 | for repl in marker.succnodes(): | |
1616 | ui.write(' ') |
|
1616 | ui.write(' ') | |
1617 | ui.write(hex(repl)) |
|
1617 | ui.write(hex(repl)) | |
1618 | ui.write(' %X ' % marker.flags()) |
|
1618 | ui.write(' %X ' % marker.flags()) | |
1619 | parents = marker.parentnodes() |
|
1619 | parents = marker.parentnodes() | |
1620 | if parents is not None: |
|
1620 | if parents is not None: | |
1621 | ui.write('{%s} ' % ', '.join(hex(p) for p in parents)) |
|
1621 | ui.write('{%s} ' % ', '.join(hex(p) for p in parents)) | |
1622 | ui.write('(%s) ' % util.datestr(marker.date())) |
|
1622 | ui.write('(%s) ' % util.datestr(marker.date())) | |
1623 | ui.write('{%s}' % (', '.join('%r: %r' % t for t in |
|
1623 | ui.write('{%s}' % (', '.join('%r: %r' % t for t in | |
1624 | sorted(marker.metadata().items()) |
|
1624 | sorted(marker.metadata().items()) | |
1625 | if t[0] != 'date'))) |
|
1625 | if t[0] != 'date'))) | |
1626 | ui.write('\n') |
|
1626 | ui.write('\n') | |
1627 |
|
1627 | |||
1628 | def finddate(ui, repo, date): |
|
1628 | def finddate(ui, repo, date): | |
1629 | """Find the tipmost changeset that matches the given date spec""" |
|
1629 | """Find the tipmost changeset that matches the given date spec""" | |
1630 |
|
1630 | |||
1631 | df = util.matchdate(date) |
|
1631 | df = util.matchdate(date) | |
1632 | m = scmutil.matchall(repo) |
|
1632 | m = scmutil.matchall(repo) | |
1633 | results = {} |
|
1633 | results = {} | |
1634 |
|
1634 | |||
1635 | def prep(ctx, fns): |
|
1635 | def prep(ctx, fns): | |
1636 | d = ctx.date() |
|
1636 | d = ctx.date() | |
1637 | if df(d[0]): |
|
1637 | if df(d[0]): | |
1638 | results[ctx.rev()] = d |
|
1638 | results[ctx.rev()] = d | |
1639 |
|
1639 | |||
1640 | for ctx in walkchangerevs(repo, m, {'rev': None}, prep): |
|
1640 | for ctx in walkchangerevs(repo, m, {'rev': None}, prep): | |
1641 | rev = ctx.rev() |
|
1641 | rev = ctx.rev() | |
1642 | if rev in results: |
|
1642 | if rev in results: | |
1643 | ui.status(_("found revision %s from %s\n") % |
|
1643 | ui.status(_("found revision %s from %s\n") % | |
1644 | (rev, util.datestr(results[rev]))) |
|
1644 | (rev, util.datestr(results[rev]))) | |
1645 | return str(rev) |
|
1645 | return str(rev) | |
1646 |
|
1646 | |||
1647 | raise error.Abort(_("revision matching date not found")) |
|
1647 | raise error.Abort(_("revision matching date not found")) | |
1648 |
|
1648 | |||
1649 | def increasingwindows(windowsize=8, sizelimit=512): |
|
1649 | def increasingwindows(windowsize=8, sizelimit=512): | |
1650 | while True: |
|
1650 | while True: | |
1651 | yield windowsize |
|
1651 | yield windowsize | |
1652 | if windowsize < sizelimit: |
|
1652 | if windowsize < sizelimit: | |
1653 | windowsize *= 2 |
|
1653 | windowsize *= 2 | |
1654 |
|
1654 | |||
1655 | class FileWalkError(Exception): |
|
1655 | class FileWalkError(Exception): | |
1656 | pass |
|
1656 | pass | |
1657 |
|
1657 | |||
1658 | def walkfilerevs(repo, match, follow, revs, fncache): |
|
1658 | def walkfilerevs(repo, match, follow, revs, fncache): | |
1659 | '''Walks the file history for the matched files. |
|
1659 | '''Walks the file history for the matched files. | |
1660 |
|
1660 | |||
1661 | Returns the changeset revs that are involved in the file history. |
|
1661 | Returns the changeset revs that are involved in the file history. | |
1662 |
|
1662 | |||
1663 | Throws FileWalkError if the file history can't be walked using |
|
1663 | Throws FileWalkError if the file history can't be walked using | |
1664 | filelogs alone. |
|
1664 | filelogs alone. | |
1665 | ''' |
|
1665 | ''' | |
1666 | wanted = set() |
|
1666 | wanted = set() | |
1667 | copies = [] |
|
1667 | copies = [] | |
1668 | minrev, maxrev = min(revs), max(revs) |
|
1668 | minrev, maxrev = min(revs), max(revs) | |
1669 | def filerevgen(filelog, last): |
|
1669 | def filerevgen(filelog, last): | |
1670 | """ |
|
1670 | """ | |
1671 | Only files, no patterns. Check the history of each file. |
|
1671 | Only files, no patterns. Check the history of each file. | |
1672 |
|
1672 | |||
1673 | Examines filelog entries within minrev, maxrev linkrev range |
|
1673 | Examines filelog entries within minrev, maxrev linkrev range | |
1674 | Returns an iterator yielding (linkrev, parentlinkrevs, copied) |
|
1674 | Returns an iterator yielding (linkrev, parentlinkrevs, copied) | |
1675 | tuples in backwards order |
|
1675 | tuples in backwards order | |
1676 | """ |
|
1676 | """ | |
1677 | cl_count = len(repo) |
|
1677 | cl_count = len(repo) | |
1678 | revs = [] |
|
1678 | revs = [] | |
1679 | for j in xrange(0, last + 1): |
|
1679 | for j in xrange(0, last + 1): | |
1680 | linkrev = filelog.linkrev(j) |
|
1680 | linkrev = filelog.linkrev(j) | |
1681 | if linkrev < minrev: |
|
1681 | if linkrev < minrev: | |
1682 | continue |
|
1682 | continue | |
1683 | # only yield rev for which we have the changelog, it can |
|
1683 | # only yield rev for which we have the changelog, it can | |
1684 | # happen while doing "hg log" during a pull or commit |
|
1684 | # happen while doing "hg log" during a pull or commit | |
1685 | if linkrev >= cl_count: |
|
1685 | if linkrev >= cl_count: | |
1686 | break |
|
1686 | break | |
1687 |
|
1687 | |||
1688 | parentlinkrevs = [] |
|
1688 | parentlinkrevs = [] | |
1689 | for p in filelog.parentrevs(j): |
|
1689 | for p in filelog.parentrevs(j): | |
1690 | if p != nullrev: |
|
1690 | if p != nullrev: | |
1691 | parentlinkrevs.append(filelog.linkrev(p)) |
|
1691 | parentlinkrevs.append(filelog.linkrev(p)) | |
1692 | n = filelog.node(j) |
|
1692 | n = filelog.node(j) | |
1693 | revs.append((linkrev, parentlinkrevs, |
|
1693 | revs.append((linkrev, parentlinkrevs, | |
1694 | follow and filelog.renamed(n))) |
|
1694 | follow and filelog.renamed(n))) | |
1695 |
|
1695 | |||
1696 | return reversed(revs) |
|
1696 | return reversed(revs) | |
1697 | def iterfiles(): |
|
1697 | def iterfiles(): | |
1698 | pctx = repo['.'] |
|
1698 | pctx = repo['.'] | |
1699 | for filename in match.files(): |
|
1699 | for filename in match.files(): | |
1700 | if follow: |
|
1700 | if follow: | |
1701 | if filename not in pctx: |
|
1701 | if filename not in pctx: | |
1702 | raise error.Abort(_('cannot follow file not in parent ' |
|
1702 | raise error.Abort(_('cannot follow file not in parent ' | |
1703 | 'revision: "%s"') % filename) |
|
1703 | 'revision: "%s"') % filename) | |
1704 | yield filename, pctx[filename].filenode() |
|
1704 | yield filename, pctx[filename].filenode() | |
1705 | else: |
|
1705 | else: | |
1706 | yield filename, None |
|
1706 | yield filename, None | |
1707 | for filename_node in copies: |
|
1707 | for filename_node in copies: | |
1708 | yield filename_node |
|
1708 | yield filename_node | |
1709 |
|
1709 | |||
1710 | for file_, node in iterfiles(): |
|
1710 | for file_, node in iterfiles(): | |
1711 | filelog = repo.file(file_) |
|
1711 | filelog = repo.file(file_) | |
1712 | if not len(filelog): |
|
1712 | if not len(filelog): | |
1713 | if node is None: |
|
1713 | if node is None: | |
1714 | # A zero count may be a directory or deleted file, so |
|
1714 | # A zero count may be a directory or deleted file, so | |
1715 | # try to find matching entries on the slow path. |
|
1715 | # try to find matching entries on the slow path. | |
1716 | if follow: |
|
1716 | if follow: | |
1717 | raise error.Abort( |
|
1717 | raise error.Abort( | |
1718 | _('cannot follow nonexistent file: "%s"') % file_) |
|
1718 | _('cannot follow nonexistent file: "%s"') % file_) | |
1719 | raise FileWalkError("Cannot walk via filelog") |
|
1719 | raise FileWalkError("Cannot walk via filelog") | |
1720 | else: |
|
1720 | else: | |
1721 | continue |
|
1721 | continue | |
1722 |
|
1722 | |||
1723 | if node is None: |
|
1723 | if node is None: | |
1724 | last = len(filelog) - 1 |
|
1724 | last = len(filelog) - 1 | |
1725 | else: |
|
1725 | else: | |
1726 | last = filelog.rev(node) |
|
1726 | last = filelog.rev(node) | |
1727 |
|
1727 | |||
1728 | # keep track of all ancestors of the file |
|
1728 | # keep track of all ancestors of the file | |
1729 | ancestors = set([filelog.linkrev(last)]) |
|
1729 | ancestors = set([filelog.linkrev(last)]) | |
1730 |
|
1730 | |||
1731 | # iterate from latest to oldest revision |
|
1731 | # iterate from latest to oldest revision | |
1732 | for rev, flparentlinkrevs, copied in filerevgen(filelog, last): |
|
1732 | for rev, flparentlinkrevs, copied in filerevgen(filelog, last): | |
1733 | if not follow: |
|
1733 | if not follow: | |
1734 | if rev > maxrev: |
|
1734 | if rev > maxrev: | |
1735 | continue |
|
1735 | continue | |
1736 | else: |
|
1736 | else: | |
1737 | # Note that last might not be the first interesting |
|
1737 | # Note that last might not be the first interesting | |
1738 | # rev to us: |
|
1738 | # rev to us: | |
1739 | # if the file has been changed after maxrev, we'll |
|
1739 | # if the file has been changed after maxrev, we'll | |
1740 | # have linkrev(last) > maxrev, and we still need |
|
1740 | # have linkrev(last) > maxrev, and we still need | |
1741 | # to explore the file graph |
|
1741 | # to explore the file graph | |
1742 | if rev not in ancestors: |
|
1742 | if rev not in ancestors: | |
1743 | continue |
|
1743 | continue | |
1744 | # XXX insert 1327 fix here |
|
1744 | # XXX insert 1327 fix here | |
1745 | if flparentlinkrevs: |
|
1745 | if flparentlinkrevs: | |
1746 | ancestors.update(flparentlinkrevs) |
|
1746 | ancestors.update(flparentlinkrevs) | |
1747 |
|
1747 | |||
1748 | fncache.setdefault(rev, []).append(file_) |
|
1748 | fncache.setdefault(rev, []).append(file_) | |
1749 | wanted.add(rev) |
|
1749 | wanted.add(rev) | |
1750 | if copied: |
|
1750 | if copied: | |
1751 | copies.append(copied) |
|
1751 | copies.append(copied) | |
1752 |
|
1752 | |||
1753 | return wanted |
|
1753 | return wanted | |
1754 |
|
1754 | |||
1755 | class _followfilter(object): |
|
1755 | class _followfilter(object): | |
1756 | def __init__(self, repo, onlyfirst=False): |
|
1756 | def __init__(self, repo, onlyfirst=False): | |
1757 | self.repo = repo |
|
1757 | self.repo = repo | |
1758 | self.startrev = nullrev |
|
1758 | self.startrev = nullrev | |
1759 | self.roots = set() |
|
1759 | self.roots = set() | |
1760 | self.onlyfirst = onlyfirst |
|
1760 | self.onlyfirst = onlyfirst | |
1761 |
|
1761 | |||
1762 | def match(self, rev): |
|
1762 | def match(self, rev): | |
1763 | def realparents(rev): |
|
1763 | def realparents(rev): | |
1764 | if self.onlyfirst: |
|
1764 | if self.onlyfirst: | |
1765 | return self.repo.changelog.parentrevs(rev)[0:1] |
|
1765 | return self.repo.changelog.parentrevs(rev)[0:1] | |
1766 | else: |
|
1766 | else: | |
1767 | return filter(lambda x: x != nullrev, |
|
1767 | return filter(lambda x: x != nullrev, | |
1768 | self.repo.changelog.parentrevs(rev)) |
|
1768 | self.repo.changelog.parentrevs(rev)) | |
1769 |
|
1769 | |||
1770 | if self.startrev == nullrev: |
|
1770 | if self.startrev == nullrev: | |
1771 | self.startrev = rev |
|
1771 | self.startrev = rev | |
1772 | return True |
|
1772 | return True | |
1773 |
|
1773 | |||
1774 | if rev > self.startrev: |
|
1774 | if rev > self.startrev: | |
1775 | # forward: all descendants |
|
1775 | # forward: all descendants | |
1776 | if not self.roots: |
|
1776 | if not self.roots: | |
1777 | self.roots.add(self.startrev) |
|
1777 | self.roots.add(self.startrev) | |
1778 | for parent in realparents(rev): |
|
1778 | for parent in realparents(rev): | |
1779 | if parent in self.roots: |
|
1779 | if parent in self.roots: | |
1780 | self.roots.add(rev) |
|
1780 | self.roots.add(rev) | |
1781 | return True |
|
1781 | return True | |
1782 | else: |
|
1782 | else: | |
1783 | # backwards: all parents |
|
1783 | # backwards: all parents | |
1784 | if not self.roots: |
|
1784 | if not self.roots: | |
1785 | self.roots.update(realparents(self.startrev)) |
|
1785 | self.roots.update(realparents(self.startrev)) | |
1786 | if rev in self.roots: |
|
1786 | if rev in self.roots: | |
1787 | self.roots.remove(rev) |
|
1787 | self.roots.remove(rev) | |
1788 | self.roots.update(realparents(rev)) |
|
1788 | self.roots.update(realparents(rev)) | |
1789 | return True |
|
1789 | return True | |
1790 |
|
1790 | |||
1791 | return False |
|
1791 | return False | |
1792 |
|
1792 | |||
1793 | def walkchangerevs(repo, match, opts, prepare): |
|
1793 | def walkchangerevs(repo, match, opts, prepare): | |
1794 | '''Iterate over files and the revs in which they changed. |
|
1794 | '''Iterate over files and the revs in which they changed. | |
1795 |
|
1795 | |||
1796 | Callers most commonly need to iterate backwards over the history |
|
1796 | Callers most commonly need to iterate backwards over the history | |
1797 | in which they are interested. Doing so has awful (quadratic-looking) |
|
1797 | in which they are interested. Doing so has awful (quadratic-looking) | |
1798 | performance, so we use iterators in a "windowed" way. |
|
1798 | performance, so we use iterators in a "windowed" way. | |
1799 |
|
1799 | |||
1800 | We walk a window of revisions in the desired order. Within the |
|
1800 | We walk a window of revisions in the desired order. Within the | |
1801 | window, we first walk forwards to gather data, then in the desired |
|
1801 | window, we first walk forwards to gather data, then in the desired | |
1802 | order (usually backwards) to display it. |
|
1802 | order (usually backwards) to display it. | |
1803 |
|
1803 | |||
1804 | This function returns an iterator yielding contexts. Before |
|
1804 | This function returns an iterator yielding contexts. Before | |
1805 | yielding each context, the iterator will first call the prepare |
|
1805 | yielding each context, the iterator will first call the prepare | |
1806 | function on each context in the window in forward order.''' |
|
1806 | function on each context in the window in forward order.''' | |
1807 |
|
1807 | |||
1808 | follow = opts.get('follow') or opts.get('follow_first') |
|
1808 | follow = opts.get('follow') or opts.get('follow_first') | |
1809 | revs = _logrevs(repo, opts) |
|
1809 | revs = _logrevs(repo, opts) | |
1810 | if not revs: |
|
1810 | if not revs: | |
1811 | return [] |
|
1811 | return [] | |
1812 | wanted = set() |
|
1812 | wanted = set() | |
1813 | slowpath = match.anypats() or ((match.isexact() or match.prefix()) and |
|
1813 | slowpath = match.anypats() or ((match.isexact() or match.prefix()) and | |
1814 | opts.get('removed')) |
|
1814 | opts.get('removed')) | |
1815 | fncache = {} |
|
1815 | fncache = {} | |
1816 | change = repo.changectx |
|
1816 | change = repo.changectx | |
1817 |
|
1817 | |||
1818 | # First step is to fill wanted, the set of revisions that we want to yield. |
|
1818 | # First step is to fill wanted, the set of revisions that we want to yield. | |
1819 | # When it does not induce extra cost, we also fill fncache for revisions in |
|
1819 | # When it does not induce extra cost, we also fill fncache for revisions in | |
1820 | # wanted: a cache of filenames that were changed (ctx.files()) and that |
|
1820 | # wanted: a cache of filenames that were changed (ctx.files()) and that | |
1821 | # match the file filtering conditions. |
|
1821 | # match the file filtering conditions. | |
1822 |
|
1822 | |||
1823 | if match.always(): |
|
1823 | if match.always(): | |
1824 | # No files, no patterns. Display all revs. |
|
1824 | # No files, no patterns. Display all revs. | |
1825 | wanted = revs |
|
1825 | wanted = revs | |
1826 | elif not slowpath: |
|
1826 | elif not slowpath: | |
1827 | # We only have to read through the filelog to find wanted revisions |
|
1827 | # We only have to read through the filelog to find wanted revisions | |
1828 |
|
1828 | |||
1829 | try: |
|
1829 | try: | |
1830 | wanted = walkfilerevs(repo, match, follow, revs, fncache) |
|
1830 | wanted = walkfilerevs(repo, match, follow, revs, fncache) | |
1831 | except FileWalkError: |
|
1831 | except FileWalkError: | |
1832 | slowpath = True |
|
1832 | slowpath = True | |
1833 |
|
1833 | |||
1834 | # We decided to fall back to the slowpath because at least one |
|
1834 | # We decided to fall back to the slowpath because at least one | |
1835 | # of the paths was not a file. Check to see if at least one of them |
|
1835 | # of the paths was not a file. Check to see if at least one of them | |
1836 | # existed in history, otherwise simply return |
|
1836 | # existed in history, otherwise simply return | |
1837 | for path in match.files(): |
|
1837 | for path in match.files(): | |
1838 | if path == '.' or path in repo.store: |
|
1838 | if path == '.' or path in repo.store: | |
1839 | break |
|
1839 | break | |
1840 | else: |
|
1840 | else: | |
1841 | return [] |
|
1841 | return [] | |
1842 |
|
1842 | |||
1843 | if slowpath: |
|
1843 | if slowpath: | |
1844 | # We have to read the changelog to match filenames against |
|
1844 | # We have to read the changelog to match filenames against | |
1845 | # changed files |
|
1845 | # changed files | |
1846 |
|
1846 | |||
1847 | if follow: |
|
1847 | if follow: | |
1848 | raise error.Abort(_('can only follow copies/renames for explicit ' |
|
1848 | raise error.Abort(_('can only follow copies/renames for explicit ' | |
1849 | 'filenames')) |
|
1849 | 'filenames')) | |
1850 |
|
1850 | |||
1851 | # The slow path checks files modified in every changeset. |
|
1851 | # The slow path checks files modified in every changeset. | |
1852 | # This is really slow on large repos, so compute the set lazily. |
|
1852 | # This is really slow on large repos, so compute the set lazily. | |
1853 | class lazywantedset(object): |
|
1853 | class lazywantedset(object): | |
1854 | def __init__(self): |
|
1854 | def __init__(self): | |
1855 | self.set = set() |
|
1855 | self.set = set() | |
1856 | self.revs = set(revs) |
|
1856 | self.revs = set(revs) | |
1857 |
|
1857 | |||
1858 | # No need to worry about locality here because it will be accessed |
|
1858 | # No need to worry about locality here because it will be accessed | |
1859 | # in the same order as the increasing window below. |
|
1859 | # in the same order as the increasing window below. | |
1860 | def __contains__(self, value): |
|
1860 | def __contains__(self, value): | |
1861 | if value in self.set: |
|
1861 | if value in self.set: | |
1862 | return True |
|
1862 | return True | |
1863 | elif not value in self.revs: |
|
1863 | elif not value in self.revs: | |
1864 | return False |
|
1864 | return False | |
1865 | else: |
|
1865 | else: | |
1866 | self.revs.discard(value) |
|
1866 | self.revs.discard(value) | |
1867 | ctx = change(value) |
|
1867 | ctx = change(value) | |
1868 | matches = filter(match, ctx.files()) |
|
1868 | matches = filter(match, ctx.files()) | |
1869 | if matches: |
|
1869 | if matches: | |
1870 | fncache[value] = matches |
|
1870 | fncache[value] = matches | |
1871 | self.set.add(value) |
|
1871 | self.set.add(value) | |
1872 | return True |
|
1872 | return True | |
1873 | return False |
|
1873 | return False | |
1874 |
|
1874 | |||
1875 | def discard(self, value): |
|
1875 | def discard(self, value): | |
1876 | self.revs.discard(value) |
|
1876 | self.revs.discard(value) | |
1877 | self.set.discard(value) |
|
1877 | self.set.discard(value) | |
1878 |
|
1878 | |||
1879 | wanted = lazywantedset() |
|
1879 | wanted = lazywantedset() | |
1880 |
|
1880 | |||
1881 | # it might be worthwhile to do this in the iterator if the rev range |
|
1881 | # it might be worthwhile to do this in the iterator if the rev range | |
1882 | # is descending and the prune args are all within that range |
|
1882 | # is descending and the prune args are all within that range | |
1883 | for rev in opts.get('prune', ()): |
|
1883 | for rev in opts.get('prune', ()): | |
1884 | rev = repo[rev].rev() |
|
1884 | rev = repo[rev].rev() | |
1885 | ff = _followfilter(repo) |
|
1885 | ff = _followfilter(repo) | |
1886 | stop = min(revs[0], revs[-1]) |
|
1886 | stop = min(revs[0], revs[-1]) | |
1887 | for x in xrange(rev, stop - 1, -1): |
|
1887 | for x in xrange(rev, stop - 1, -1): | |
1888 | if ff.match(x): |
|
1888 | if ff.match(x): | |
1889 | wanted = wanted - [x] |
|
1889 | wanted = wanted - [x] | |
1890 |
|
1890 | |||
1891 | # Now that wanted is correctly initialized, we can iterate over the |
|
1891 | # Now that wanted is correctly initialized, we can iterate over the | |
1892 | # revision range, yielding only revisions in wanted. |
|
1892 | # revision range, yielding only revisions in wanted. | |
1893 | def iterate(): |
|
1893 | def iterate(): | |
1894 | if follow and match.always(): |
|
1894 | if follow and match.always(): | |
1895 | ff = _followfilter(repo, onlyfirst=opts.get('follow_first')) |
|
1895 | ff = _followfilter(repo, onlyfirst=opts.get('follow_first')) | |
1896 | def want(rev): |
|
1896 | def want(rev): | |
1897 | return ff.match(rev) and rev in wanted |
|
1897 | return ff.match(rev) and rev in wanted | |
1898 | else: |
|
1898 | else: | |
1899 | def want(rev): |
|
1899 | def want(rev): | |
1900 | return rev in wanted |
|
1900 | return rev in wanted | |
1901 |
|
1901 | |||
1902 | it = iter(revs) |
|
1902 | it = iter(revs) | |
1903 | stopiteration = False |
|
1903 | stopiteration = False | |
1904 | for windowsize in increasingwindows(): |
|
1904 | for windowsize in increasingwindows(): | |
1905 | nrevs = [] |
|
1905 | nrevs = [] | |
1906 | for i in xrange(windowsize): |
|
1906 | for i in xrange(windowsize): | |
1907 | rev = next(it, None) |
|
1907 | rev = next(it, None) | |
1908 | if rev is None: |
|
1908 | if rev is None: | |
1909 | stopiteration = True |
|
1909 | stopiteration = True | |
1910 | break |
|
1910 | break | |
1911 | elif want(rev): |
|
1911 | elif want(rev): | |
1912 | nrevs.append(rev) |
|
1912 | nrevs.append(rev) | |
1913 | for rev in sorted(nrevs): |
|
1913 | for rev in sorted(nrevs): | |
1914 | fns = fncache.get(rev) |
|
1914 | fns = fncache.get(rev) | |
1915 | ctx = change(rev) |
|
1915 | ctx = change(rev) | |
1916 | if not fns: |
|
1916 | if not fns: | |
1917 | def fns_generator(): |
|
1917 | def fns_generator(): | |
1918 | for f in ctx.files(): |
|
1918 | for f in ctx.files(): | |
1919 | if match(f): |
|
1919 | if match(f): | |
1920 | yield f |
|
1920 | yield f | |
1921 | fns = fns_generator() |
|
1921 | fns = fns_generator() | |
1922 | prepare(ctx, fns) |
|
1922 | prepare(ctx, fns) | |
1923 | for rev in nrevs: |
|
1923 | for rev in nrevs: | |
1924 | yield change(rev) |
|
1924 | yield change(rev) | |
1925 |
|
1925 | |||
1926 | if stopiteration: |
|
1926 | if stopiteration: | |
1927 | break |
|
1927 | break | |
1928 |
|
1928 | |||
1929 | return iterate() |
|
1929 | return iterate() | |
1930 |
|
1930 | |||
1931 | def _makefollowlogfilematcher(repo, files, followfirst): |
|
1931 | def _makefollowlogfilematcher(repo, files, followfirst): | |
1932 | # When displaying a revision with --patch --follow FILE, we have |
|
1932 | # When displaying a revision with --patch --follow FILE, we have | |
1933 | # to know which file of the revision must be diffed. With |
|
1933 | # to know which file of the revision must be diffed. With | |
1934 | # --follow, we want the names of the ancestors of FILE in the |
|
1934 | # --follow, we want the names of the ancestors of FILE in the | |
1935 | # revision, stored in "fcache". "fcache" is populated by |
|
1935 | # revision, stored in "fcache". "fcache" is populated by | |
1936 | # reproducing the graph traversal already done by --follow revset |
|
1936 | # reproducing the graph traversal already done by --follow revset | |
1937 | # and relating linkrevs to file names (which is not "correct" but |
|
1937 | # and relating linkrevs to file names (which is not "correct" but | |
1938 | # good enough). |
|
1938 | # good enough). | |
1939 | fcache = {} |
|
1939 | fcache = {} | |
1940 | fcacheready = [False] |
|
1940 | fcacheready = [False] | |
1941 | pctx = repo['.'] |
|
1941 | pctx = repo['.'] | |
1942 |
|
1942 | |||
1943 | def populate(): |
|
1943 | def populate(): | |
1944 | for fn in files: |
|
1944 | for fn in files: | |
1945 | for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)): |
|
1945 | for i in ((pctx[fn],), pctx[fn].ancestors(followfirst=followfirst)): | |
1946 | for c in i: |
|
1946 | for c in i: | |
1947 | fcache.setdefault(c.linkrev(), set()).add(c.path()) |
|
1947 | fcache.setdefault(c.linkrev(), set()).add(c.path()) | |
1948 |
|
1948 | |||
1949 | def filematcher(rev): |
|
1949 | def filematcher(rev): | |
1950 | if not fcacheready[0]: |
|
1950 | if not fcacheready[0]: | |
1951 | # Lazy initialization |
|
1951 | # Lazy initialization | |
1952 | fcacheready[0] = True |
|
1952 | fcacheready[0] = True | |
1953 | populate() |
|
1953 | populate() | |
1954 | return scmutil.matchfiles(repo, fcache.get(rev, [])) |
|
1954 | return scmutil.matchfiles(repo, fcache.get(rev, [])) | |
1955 |
|
1955 | |||
1956 | return filematcher |
|
1956 | return filematcher | |
1957 |
|
1957 | |||
1958 | def _makenofollowlogfilematcher(repo, pats, opts): |
|
1958 | def _makenofollowlogfilematcher(repo, pats, opts): | |
1959 | '''hook for extensions to override the filematcher for non-follow cases''' |
|
1959 | '''hook for extensions to override the filematcher for non-follow cases''' | |
1960 | return None |
|
1960 | return None | |
1961 |
|
1961 | |||
1962 | def _makelogrevset(repo, pats, opts, revs): |
|
1962 | def _makelogrevset(repo, pats, opts, revs): | |
1963 | """Return (expr, filematcher) where expr is a revset string built |
|
1963 | """Return (expr, filematcher) where expr is a revset string built | |
1964 | from log options and file patterns or None. If --stat or --patch |
|
1964 | from log options and file patterns or None. If --stat or --patch | |
1965 | are not passed filematcher is None. Otherwise it is a callable |
|
1965 | are not passed filematcher is None. Otherwise it is a callable | |
1966 | taking a revision number and returning a match objects filtering |
|
1966 | taking a revision number and returning a match objects filtering | |
1967 | the files to be detailed when displaying the revision. |
|
1967 | the files to be detailed when displaying the revision. | |
1968 | """ |
|
1968 | """ | |
1969 | opt2revset = { |
|
1969 | opt2revset = { | |
1970 | 'no_merges': ('not merge()', None), |
|
1970 | 'no_merges': ('not merge()', None), | |
1971 | 'only_merges': ('merge()', None), |
|
1971 | 'only_merges': ('merge()', None), | |
1972 | '_ancestors': ('ancestors(%(val)s)', None), |
|
1972 | '_ancestors': ('ancestors(%(val)s)', None), | |
1973 | '_fancestors': ('_firstancestors(%(val)s)', None), |
|
1973 | '_fancestors': ('_firstancestors(%(val)s)', None), | |
1974 | '_descendants': ('descendants(%(val)s)', None), |
|
1974 | '_descendants': ('descendants(%(val)s)', None), | |
1975 | '_fdescendants': ('_firstdescendants(%(val)s)', None), |
|
1975 | '_fdescendants': ('_firstdescendants(%(val)s)', None), | |
1976 | '_matchfiles': ('_matchfiles(%(val)s)', None), |
|
1976 | '_matchfiles': ('_matchfiles(%(val)s)', None), | |
1977 | 'date': ('date(%(val)r)', None), |
|
1977 | 'date': ('date(%(val)r)', None), | |
1978 | 'branch': ('branch(%(val)r)', ' or '), |
|
1978 | 'branch': ('branch(%(val)r)', ' or '), | |
1979 | '_patslog': ('filelog(%(val)r)', ' or '), |
|
1979 | '_patslog': ('filelog(%(val)r)', ' or '), | |
1980 | '_patsfollow': ('follow(%(val)r)', ' or '), |
|
1980 | '_patsfollow': ('follow(%(val)r)', ' or '), | |
1981 | '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '), |
|
1981 | '_patsfollowfirst': ('_followfirst(%(val)r)', ' or '), | |
1982 | 'keyword': ('keyword(%(val)r)', ' or '), |
|
1982 | 'keyword': ('keyword(%(val)r)', ' or '), | |
1983 | 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '), |
|
1983 | 'prune': ('not (%(val)r or ancestors(%(val)r))', ' and '), | |
1984 | 'user': ('user(%(val)r)', ' or '), |
|
1984 | 'user': ('user(%(val)r)', ' or '), | |
1985 | } |
|
1985 | } | |
1986 |
|
1986 | |||
1987 | opts = dict(opts) |
|
1987 | opts = dict(opts) | |
1988 | # follow or not follow? |
|
1988 | # follow or not follow? | |
1989 | follow = opts.get('follow') or opts.get('follow_first') |
|
1989 | follow = opts.get('follow') or opts.get('follow_first') | |
1990 | if opts.get('follow_first'): |
|
1990 | if opts.get('follow_first'): | |
1991 | followfirst = 1 |
|
1991 | followfirst = 1 | |
1992 | else: |
|
1992 | else: | |
1993 | followfirst = 0 |
|
1993 | followfirst = 0 | |
1994 | # --follow with FILE behavior depends on revs... |
|
1994 | # --follow with FILE behavior depends on revs... | |
1995 | it = iter(revs) |
|
1995 | it = iter(revs) | |
1996 | startrev = it.next() |
|
1996 | startrev = it.next() | |
1997 | followdescendants = startrev < next(it, startrev) |
|
1997 | followdescendants = startrev < next(it, startrev) | |
1998 |
|
1998 | |||
1999 | # branch and only_branch are really aliases and must be handled at |
|
1999 | # branch and only_branch are really aliases and must be handled at | |
2000 | # the same time |
|
2000 | # the same time | |
2001 | opts['branch'] = opts.get('branch', []) + opts.get('only_branch', []) |
|
2001 | opts['branch'] = opts.get('branch', []) + opts.get('only_branch', []) | |
2002 | opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']] |
|
2002 | opts['branch'] = [repo.lookupbranch(b) for b in opts['branch']] | |
2003 | # pats/include/exclude are passed to match.match() directly in |
|
2003 | # pats/include/exclude are passed to match.match() directly in | |
2004 | # _matchfiles() revset but walkchangerevs() builds its matcher with |
|
2004 | # _matchfiles() revset but walkchangerevs() builds its matcher with | |
2005 | # scmutil.match(). The difference is input pats are globbed on |
|
2005 | # scmutil.match(). The difference is input pats are globbed on | |
2006 | # platforms without shell expansion (windows). |
|
2006 | # platforms without shell expansion (windows). | |
2007 | wctx = repo[None] |
|
2007 | wctx = repo[None] | |
2008 | match, pats = scmutil.matchandpats(wctx, pats, opts) |
|
2008 | match, pats = scmutil.matchandpats(wctx, pats, opts) | |
2009 | slowpath = match.anypats() or ((match.isexact() or match.prefix()) and |
|
2009 | slowpath = match.anypats() or ((match.isexact() or match.prefix()) and | |
2010 | opts.get('removed')) |
|
2010 | opts.get('removed')) | |
2011 | if not slowpath: |
|
2011 | if not slowpath: | |
2012 | for f in match.files(): |
|
2012 | for f in match.files(): | |
2013 | if follow and f not in wctx: |
|
2013 | if follow and f not in wctx: | |
2014 | # If the file exists, it may be a directory, so let it |
|
2014 | # If the file exists, it may be a directory, so let it | |
2015 | # take the slow path. |
|
2015 | # take the slow path. | |
2016 | if os.path.exists(repo.wjoin(f)): |
|
2016 | if os.path.exists(repo.wjoin(f)): | |
2017 | slowpath = True |
|
2017 | slowpath = True | |
2018 | continue |
|
2018 | continue | |
2019 | else: |
|
2019 | else: | |
2020 | raise error.Abort(_('cannot follow file not in parent ' |
|
2020 | raise error.Abort(_('cannot follow file not in parent ' | |
2021 | 'revision: "%s"') % f) |
|
2021 | 'revision: "%s"') % f) | |
2022 | filelog = repo.file(f) |
|
2022 | filelog = repo.file(f) | |
2023 | if not filelog: |
|
2023 | if not filelog: | |
2024 | # A zero count may be a directory or deleted file, so |
|
2024 | # A zero count may be a directory or deleted file, so | |
2025 | # try to find matching entries on the slow path. |
|
2025 | # try to find matching entries on the slow path. | |
2026 | if follow: |
|
2026 | if follow: | |
2027 | raise error.Abort( |
|
2027 | raise error.Abort( | |
2028 | _('cannot follow nonexistent file: "%s"') % f) |
|
2028 | _('cannot follow nonexistent file: "%s"') % f) | |
2029 | slowpath = True |
|
2029 | slowpath = True | |
2030 |
|
2030 | |||
2031 | # We decided to fall back to the slowpath because at least one |
|
2031 | # We decided to fall back to the slowpath because at least one | |
2032 | # of the paths was not a file. Check to see if at least one of them |
|
2032 | # of the paths was not a file. Check to see if at least one of them | |
2033 | # existed in history - in that case, we'll continue down the |
|
2033 | # existed in history - in that case, we'll continue down the | |
2034 | # slowpath; otherwise, we can turn off the slowpath |
|
2034 | # slowpath; otherwise, we can turn off the slowpath | |
2035 | if slowpath: |
|
2035 | if slowpath: | |
2036 | for path in match.files(): |
|
2036 | for path in match.files(): | |
2037 | if path == '.' or path in repo.store: |
|
2037 | if path == '.' or path in repo.store: | |
2038 | break |
|
2038 | break | |
2039 | else: |
|
2039 | else: | |
2040 | slowpath = False |
|
2040 | slowpath = False | |
2041 |
|
2041 | |||
2042 | fpats = ('_patsfollow', '_patsfollowfirst') |
|
2042 | fpats = ('_patsfollow', '_patsfollowfirst') | |
2043 | fnopats = (('_ancestors', '_fancestors'), |
|
2043 | fnopats = (('_ancestors', '_fancestors'), | |
2044 | ('_descendants', '_fdescendants')) |
|
2044 | ('_descendants', '_fdescendants')) | |
2045 | if slowpath: |
|
2045 | if slowpath: | |
2046 | # See walkchangerevs() slow path. |
|
2046 | # See walkchangerevs() slow path. | |
2047 | # |
|
2047 | # | |
2048 | # pats/include/exclude cannot be represented as separate |
|
2048 | # pats/include/exclude cannot be represented as separate | |
2049 | # revset expressions as their filtering logic applies at file |
|
2049 | # revset expressions as their filtering logic applies at file | |
2050 | # level. For instance "-I a -X a" matches a revision touching |
|
2050 | # level. For instance "-I a -X a" matches a revision touching | |
2051 | # "a" and "b" while "file(a) and not file(b)" does |
|
2051 | # "a" and "b" while "file(a) and not file(b)" does | |
2052 | # not. Besides, filesets are evaluated against the working |
|
2052 | # not. Besides, filesets are evaluated against the working | |
2053 | # directory. |
|
2053 | # directory. | |
2054 | matchargs = ['r:', 'd:relpath'] |
|
2054 | matchargs = ['r:', 'd:relpath'] | |
2055 | for p in pats: |
|
2055 | for p in pats: | |
2056 | matchargs.append('p:' + p) |
|
2056 | matchargs.append('p:' + p) | |
2057 | for p in opts.get('include', []): |
|
2057 | for p in opts.get('include', []): | |
2058 | matchargs.append('i:' + p) |
|
2058 | matchargs.append('i:' + p) | |
2059 | for p in opts.get('exclude', []): |
|
2059 | for p in opts.get('exclude', []): | |
2060 | matchargs.append('x:' + p) |
|
2060 | matchargs.append('x:' + p) | |
2061 | matchargs = ','.join(('%r' % p) for p in matchargs) |
|
2061 | matchargs = ','.join(('%r' % p) for p in matchargs) | |
2062 | opts['_matchfiles'] = matchargs |
|
2062 | opts['_matchfiles'] = matchargs | |
2063 | if follow: |
|
2063 | if follow: | |
2064 | opts[fnopats[0][followfirst]] = '.' |
|
2064 | opts[fnopats[0][followfirst]] = '.' | |
2065 | else: |
|
2065 | else: | |
2066 | if follow: |
|
2066 | if follow: | |
2067 | if pats: |
|
2067 | if pats: | |
2068 | # follow() revset interprets its file argument as a |
|
2068 | # follow() revset interprets its file argument as a | |
2069 | # manifest entry, so use match.files(), not pats. |
|
2069 | # manifest entry, so use match.files(), not pats. | |
2070 | opts[fpats[followfirst]] = list(match.files()) |
|
2070 | opts[fpats[followfirst]] = list(match.files()) | |
2071 | else: |
|
2071 | else: | |
2072 | op = fnopats[followdescendants][followfirst] |
|
2072 | op = fnopats[followdescendants][followfirst] | |
2073 | opts[op] = 'rev(%d)' % startrev |
|
2073 | opts[op] = 'rev(%d)' % startrev | |
2074 | else: |
|
2074 | else: | |
2075 | opts['_patslog'] = list(pats) |
|
2075 | opts['_patslog'] = list(pats) | |
2076 |
|
2076 | |||
2077 | filematcher = None |
|
2077 | filematcher = None | |
2078 | if opts.get('patch') or opts.get('stat'): |
|
2078 | if opts.get('patch') or opts.get('stat'): | |
2079 | # When following files, track renames via a special matcher. |
|
2079 | # When following files, track renames via a special matcher. | |
2080 | # If we're forced to take the slowpath it means we're following |
|
2080 | # If we're forced to take the slowpath it means we're following | |
2081 | # at least one pattern/directory, so don't bother with rename tracking. |
|
2081 | # at least one pattern/directory, so don't bother with rename tracking. | |
2082 | if follow and not match.always() and not slowpath: |
|
2082 | if follow and not match.always() and not slowpath: | |
2083 | # _makefollowlogfilematcher expects its files argument to be |
|
2083 | # _makefollowlogfilematcher expects its files argument to be | |
2084 | # relative to the repo root, so use match.files(), not pats. |
|
2084 | # relative to the repo root, so use match.files(), not pats. | |
2085 | filematcher = _makefollowlogfilematcher(repo, match.files(), |
|
2085 | filematcher = _makefollowlogfilematcher(repo, match.files(), | |
2086 | followfirst) |
|
2086 | followfirst) | |
2087 | else: |
|
2087 | else: | |
2088 | filematcher = _makenofollowlogfilematcher(repo, pats, opts) |
|
2088 | filematcher = _makenofollowlogfilematcher(repo, pats, opts) | |
2089 | if filematcher is None: |
|
2089 | if filematcher is None: | |
2090 | filematcher = lambda rev: match |
|
2090 | filematcher = lambda rev: match | |
2091 |
|
2091 | |||
2092 | expr = [] |
|
2092 | expr = [] | |
2093 | for op, val in sorted(opts.iteritems()): |
|
2093 | for op, val in sorted(opts.iteritems()): | |
2094 | if not val: |
|
2094 | if not val: | |
2095 | continue |
|
2095 | continue | |
2096 | if op not in opt2revset: |
|
2096 | if op not in opt2revset: | |
2097 | continue |
|
2097 | continue | |
2098 | revop, andor = opt2revset[op] |
|
2098 | revop, andor = opt2revset[op] | |
2099 | if '%(val)' not in revop: |
|
2099 | if '%(val)' not in revop: | |
2100 | expr.append(revop) |
|
2100 | expr.append(revop) | |
2101 | else: |
|
2101 | else: | |
2102 | if not isinstance(val, list): |
|
2102 | if not isinstance(val, list): | |
2103 | e = revop % {'val': val} |
|
2103 | e = revop % {'val': val} | |
2104 | else: |
|
2104 | else: | |
2105 | e = '(' + andor.join((revop % {'val': v}) for v in val) + ')' |
|
2105 | e = '(' + andor.join((revop % {'val': v}) for v in val) + ')' | |
2106 | expr.append(e) |
|
2106 | expr.append(e) | |
2107 |
|
2107 | |||
2108 | if expr: |
|
2108 | if expr: | |
2109 | expr = '(' + ' and '.join(expr) + ')' |
|
2109 | expr = '(' + ' and '.join(expr) + ')' | |
2110 | else: |
|
2110 | else: | |
2111 | expr = None |
|
2111 | expr = None | |
2112 | return expr, filematcher |
|
2112 | return expr, filematcher | |
2113 |
|
2113 | |||
2114 | def _logrevs(repo, opts): |
|
2114 | def _logrevs(repo, opts): | |
2115 | # Default --rev value depends on --follow but --follow behavior |
|
2115 | # Default --rev value depends on --follow but --follow behavior | |
2116 | # depends on revisions resolved from --rev... |
|
2116 | # depends on revisions resolved from --rev... | |
2117 | follow = opts.get('follow') or opts.get('follow_first') |
|
2117 | follow = opts.get('follow') or opts.get('follow_first') | |
2118 | if opts.get('rev'): |
|
2118 | if opts.get('rev'): | |
2119 | revs = scmutil.revrange(repo, opts['rev']) |
|
2119 | revs = scmutil.revrange(repo, opts['rev']) | |
2120 | elif follow and repo.dirstate.p1() == nullid: |
|
2120 | elif follow and repo.dirstate.p1() == nullid: | |
2121 | revs = revset.baseset() |
|
2121 | revs = revset.baseset() | |
2122 | elif follow: |
|
2122 | elif follow: | |
2123 | revs = repo.revs('reverse(:.)') |
|
2123 | revs = repo.revs('reverse(:.)') | |
2124 | else: |
|
2124 | else: | |
2125 | revs = revset.spanset(repo) |
|
2125 | revs = revset.spanset(repo) | |
2126 | revs.reverse() |
|
2126 | revs.reverse() | |
2127 | return revs |
|
2127 | return revs | |
2128 |
|
2128 | |||
2129 | def getgraphlogrevs(repo, pats, opts): |
|
2129 | def getgraphlogrevs(repo, pats, opts): | |
2130 | """Return (revs, expr, filematcher) where revs is an iterable of |
|
2130 | """Return (revs, expr, filematcher) where revs is an iterable of | |
2131 | revision numbers, expr is a revset string built from log options |
|
2131 | revision numbers, expr is a revset string built from log options | |
2132 | and file patterns or None, and used to filter 'revs'. If --stat or |
|
2132 | and file patterns or None, and used to filter 'revs'. If --stat or | |
2133 | --patch are not passed filematcher is None. Otherwise it is a |
|
2133 | --patch are not passed filematcher is None. Otherwise it is a | |
2134 | callable taking a revision number and returning a match objects |
|
2134 | callable taking a revision number and returning a match objects | |
2135 | filtering the files to be detailed when displaying the revision. |
|
2135 | filtering the files to be detailed when displaying the revision. | |
2136 | """ |
|
2136 | """ | |
2137 | limit = loglimit(opts) |
|
2137 | limit = loglimit(opts) | |
2138 | revs = _logrevs(repo, opts) |
|
2138 | revs = _logrevs(repo, opts) | |
2139 | if not revs: |
|
2139 | if not revs: | |
2140 | return revset.baseset(), None, None |
|
2140 | return revset.baseset(), None, None | |
2141 | expr, filematcher = _makelogrevset(repo, pats, opts, revs) |
|
2141 | expr, filematcher = _makelogrevset(repo, pats, opts, revs) | |
2142 | if opts.get('rev'): |
|
2142 | if opts.get('rev'): | |
2143 | # User-specified revs might be unsorted, but don't sort before |
|
2143 | # User-specified revs might be unsorted, but don't sort before | |
2144 | # _makelogrevset because it might depend on the order of revs |
|
2144 | # _makelogrevset because it might depend on the order of revs | |
2145 | revs.sort(reverse=True) |
|
2145 | revs.sort(reverse=True) | |
2146 | if expr: |
|
2146 | if expr: | |
2147 | # Revset matchers often operate faster on revisions in changelog |
|
2147 | # Revset matchers often operate faster on revisions in changelog | |
2148 | # order, because most filters deal with the changelog. |
|
2148 | # order, because most filters deal with the changelog. | |
2149 | revs.reverse() |
|
2149 | revs.reverse() | |
2150 | matcher = revset.match(repo.ui, expr) |
|
2150 | matcher = revset.match(repo.ui, expr) | |
2151 | # Revset matches can reorder revisions. "A or B" typically returns |
|
2151 | # Revset matches can reorder revisions. "A or B" typically returns | |
2152 | # returns the revision matching A then the revision matching B. Sort |
|
2152 | # returns the revision matching A then the revision matching B. Sort | |
2153 | # again to fix that. |
|
2153 | # again to fix that. | |
2154 | revs = matcher(repo, revs) |
|
2154 | revs = matcher(repo, revs) | |
2155 | revs.sort(reverse=True) |
|
2155 | revs.sort(reverse=True) | |
2156 | if limit is not None: |
|
2156 | if limit is not None: | |
2157 | limitedrevs = [] |
|
2157 | limitedrevs = [] | |
2158 | for idx, rev in enumerate(revs): |
|
2158 | for idx, rev in enumerate(revs): | |
2159 | if idx >= limit: |
|
2159 | if idx >= limit: | |
2160 | break |
|
2160 | break | |
2161 | limitedrevs.append(rev) |
|
2161 | limitedrevs.append(rev) | |
2162 | revs = revset.baseset(limitedrevs) |
|
2162 | revs = revset.baseset(limitedrevs) | |
2163 |
|
2163 | |||
2164 | return revs, expr, filematcher |
|
2164 | return revs, expr, filematcher | |
2165 |
|
2165 | |||
2166 | def getlogrevs(repo, pats, opts): |
|
2166 | def getlogrevs(repo, pats, opts): | |
2167 | """Return (revs, expr, filematcher) where revs is an iterable of |
|
2167 | """Return (revs, expr, filematcher) where revs is an iterable of | |
2168 | revision numbers, expr is a revset string built from log options |
|
2168 | revision numbers, expr is a revset string built from log options | |
2169 | and file patterns or None, and used to filter 'revs'. If --stat or |
|
2169 | and file patterns or None, and used to filter 'revs'. If --stat or | |
2170 | --patch are not passed filematcher is None. Otherwise it is a |
|
2170 | --patch are not passed filematcher is None. Otherwise it is a | |
2171 | callable taking a revision number and returning a match objects |
|
2171 | callable taking a revision number and returning a match objects | |
2172 | filtering the files to be detailed when displaying the revision. |
|
2172 | filtering the files to be detailed when displaying the revision. | |
2173 | """ |
|
2173 | """ | |
2174 | limit = loglimit(opts) |
|
2174 | limit = loglimit(opts) | |
2175 | revs = _logrevs(repo, opts) |
|
2175 | revs = _logrevs(repo, opts) | |
2176 | if not revs: |
|
2176 | if not revs: | |
2177 | return revset.baseset([]), None, None |
|
2177 | return revset.baseset([]), None, None | |
2178 | expr, filematcher = _makelogrevset(repo, pats, opts, revs) |
|
2178 | expr, filematcher = _makelogrevset(repo, pats, opts, revs) | |
2179 | if expr: |
|
2179 | if expr: | |
2180 | # Revset matchers often operate faster on revisions in changelog |
|
2180 | # Revset matchers often operate faster on revisions in changelog | |
2181 | # order, because most filters deal with the changelog. |
|
2181 | # order, because most filters deal with the changelog. | |
2182 | if not opts.get('rev'): |
|
2182 | if not opts.get('rev'): | |
2183 | revs.reverse() |
|
2183 | revs.reverse() | |
2184 | matcher = revset.match(repo.ui, expr) |
|
2184 | matcher = revset.match(repo.ui, expr) | |
2185 | # Revset matches can reorder revisions. "A or B" typically returns |
|
2185 | # Revset matches can reorder revisions. "A or B" typically returns | |
2186 | # returns the revision matching A then the revision matching B. Sort |
|
2186 | # returns the revision matching A then the revision matching B. Sort | |
2187 | # again to fix that. |
|
2187 | # again to fix that. | |
2188 | fixopts = ['branch', 'only_branch', 'keyword', 'user'] |
|
2188 | fixopts = ['branch', 'only_branch', 'keyword', 'user'] | |
2189 | oldrevs = revs |
|
2189 | oldrevs = revs | |
2190 | revs = matcher(repo, revs) |
|
2190 | revs = matcher(repo, revs) | |
2191 | if not opts.get('rev'): |
|
2191 | if not opts.get('rev'): | |
2192 | revs.sort(reverse=True) |
|
2192 | revs.sort(reverse=True) | |
2193 | elif len(pats) > 1 or any(len(opts.get(op, [])) > 1 for op in fixopts): |
|
2193 | elif len(pats) > 1 or any(len(opts.get(op, [])) > 1 for op in fixopts): | |
2194 | # XXX "A or B" is known to change the order; fix it by filtering |
|
2194 | # XXX "A or B" is known to change the order; fix it by filtering | |
2195 | # matched set again (issue5100) |
|
2195 | # matched set again (issue5100) | |
2196 | revs = oldrevs & revs |
|
2196 | revs = oldrevs & revs | |
2197 | if limit is not None: |
|
2197 | if limit is not None: | |
2198 | limitedrevs = [] |
|
2198 | limitedrevs = [] | |
2199 | for idx, r in enumerate(revs): |
|
2199 | for idx, r in enumerate(revs): | |
2200 | if limit <= idx: |
|
2200 | if limit <= idx: | |
2201 | break |
|
2201 | break | |
2202 | limitedrevs.append(r) |
|
2202 | limitedrevs.append(r) | |
2203 | revs = revset.baseset(limitedrevs) |
|
2203 | revs = revset.baseset(limitedrevs) | |
2204 |
|
2204 | |||
2205 | return revs, expr, filematcher |
|
2205 | return revs, expr, filematcher | |
2206 |
|
2206 | |||
2207 | def _graphnodeformatter(ui, displayer): |
|
2207 | def _graphnodeformatter(ui, displayer): | |
2208 | spec = ui.config('ui', 'graphnodetemplate') |
|
2208 | spec = ui.config('ui', 'graphnodetemplate') | |
2209 | if not spec: |
|
2209 | if not spec: | |
2210 | return templatekw.showgraphnode # fast path for "{graphnode}" |
|
2210 | return templatekw.showgraphnode # fast path for "{graphnode}" | |
2211 |
|
2211 | |||
2212 | templ = formatter.gettemplater(ui, 'graphnode', spec) |
|
2212 | templ = formatter.gettemplater(ui, 'graphnode', spec) | |
2213 | cache = {} |
|
2213 | cache = {} | |
2214 | if isinstance(displayer, changeset_templater): |
|
2214 | if isinstance(displayer, changeset_templater): | |
2215 | cache = displayer.cache # reuse cache of slow templates |
|
2215 | cache = displayer.cache # reuse cache of slow templates | |
2216 | props = templatekw.keywords.copy() |
|
2216 | props = templatekw.keywords.copy() | |
2217 | props['templ'] = templ |
|
2217 | props['templ'] = templ | |
2218 | props['cache'] = cache |
|
2218 | props['cache'] = cache | |
2219 | def formatnode(repo, ctx): |
|
2219 | def formatnode(repo, ctx): | |
2220 | props['ctx'] = ctx |
|
2220 | props['ctx'] = ctx | |
2221 | props['repo'] = repo |
|
2221 | props['repo'] = repo | |
2222 | props['ui'] = repo.ui |
|
2222 | props['ui'] = repo.ui | |
2223 | props['revcache'] = {} |
|
2223 | props['revcache'] = {} | |
2224 | return templater.stringify(templ('graphnode', **props)) |
|
2224 | return templater.stringify(templ('graphnode', **props)) | |
2225 | return formatnode |
|
2225 | return formatnode | |
2226 |
|
2226 | |||
2227 | def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, |
|
2227 | def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, | |
2228 | filematcher=None): |
|
2228 | filematcher=None): | |
2229 | formatnode = _graphnodeformatter(ui, displayer) |
|
2229 | formatnode = _graphnodeformatter(ui, displayer) | |
2230 | state = graphmod.asciistate() |
|
2230 | state = graphmod.asciistate() | |
2231 | styles = state['styles'] |
|
2231 | styles = state['styles'] | |
2232 | edgetypes = { |
|
2232 | edgetypes = { | |
2233 | 'parent': graphmod.PARENT, |
|
2233 | 'parent': graphmod.PARENT, | |
2234 | 'grandparent': graphmod.GRANDPARENT, |
|
2234 | 'grandparent': graphmod.GRANDPARENT, | |
2235 | 'missing': graphmod.MISSINGPARENT |
|
2235 | 'missing': graphmod.MISSINGPARENT | |
2236 | } |
|
2236 | } | |
2237 | for name, key in edgetypes.items(): |
|
2237 | for name, key in edgetypes.items(): | |
2238 | # experimental config: experimental.graphstyle.* |
|
2238 | # experimental config: experimental.graphstyle.* | |
2239 | styles[key] = ui.config('experimental', 'graphstyle.%s' % name, |
|
2239 | styles[key] = ui.config('experimental', 'graphstyle.%s' % name, | |
2240 | styles[key]) |
|
2240 | styles[key]) | |
2241 | if not styles[key]: |
|
2241 | if not styles[key]: | |
2242 | styles[key] = None |
|
2242 | styles[key] = None | |
|
2243 | ||||
|
2244 | # experimental config: experimental.graphshorten | |||
|
2245 | state['graphshorten'] = ui.configbool('experimental', 'graphshorten') | |||
|
2246 | ||||
2243 | for rev, type, ctx, parents in dag: |
|
2247 | for rev, type, ctx, parents in dag: | |
2244 | char = formatnode(repo, ctx) |
|
2248 | char = formatnode(repo, ctx) | |
2245 | copies = None |
|
2249 | copies = None | |
2246 | if getrenamed and ctx.rev(): |
|
2250 | if getrenamed and ctx.rev(): | |
2247 | copies = [] |
|
2251 | copies = [] | |
2248 | for fn in ctx.files(): |
|
2252 | for fn in ctx.files(): | |
2249 | rename = getrenamed(fn, ctx.rev()) |
|
2253 | rename = getrenamed(fn, ctx.rev()) | |
2250 | if rename: |
|
2254 | if rename: | |
2251 | copies.append((fn, rename[0])) |
|
2255 | copies.append((fn, rename[0])) | |
2252 | revmatchfn = None |
|
2256 | revmatchfn = None | |
2253 | if filematcher is not None: |
|
2257 | if filematcher is not None: | |
2254 | revmatchfn = filematcher(ctx.rev()) |
|
2258 | revmatchfn = filematcher(ctx.rev()) | |
2255 | displayer.show(ctx, copies=copies, matchfn=revmatchfn) |
|
2259 | displayer.show(ctx, copies=copies, matchfn=revmatchfn) | |
2256 | lines = displayer.hunk.pop(rev).split('\n') |
|
2260 | lines = displayer.hunk.pop(rev).split('\n') | |
2257 | if not lines[-1]: |
|
2261 | if not lines[-1]: | |
2258 | del lines[-1] |
|
2262 | del lines[-1] | |
2259 | displayer.flush(ctx) |
|
2263 | displayer.flush(ctx) | |
2260 | edges = edgefn(type, char, lines, state, rev, parents) |
|
2264 | edges = edgefn(type, char, lines, state, rev, parents) | |
2261 | for type, char, lines, coldata in edges: |
|
2265 | for type, char, lines, coldata in edges: | |
2262 | graphmod.ascii(ui, state, type, char, lines, coldata) |
|
2266 | graphmod.ascii(ui, state, type, char, lines, coldata) | |
2263 | displayer.close() |
|
2267 | displayer.close() | |
2264 |
|
2268 | |||
2265 | def graphlog(ui, repo, *pats, **opts): |
|
2269 | def graphlog(ui, repo, *pats, **opts): | |
2266 | # Parameters are identical to log command ones |
|
2270 | # Parameters are identical to log command ones | |
2267 | revs, expr, filematcher = getgraphlogrevs(repo, pats, opts) |
|
2271 | revs, expr, filematcher = getgraphlogrevs(repo, pats, opts) | |
2268 | revdag = graphmod.dagwalker(repo, revs) |
|
2272 | revdag = graphmod.dagwalker(repo, revs) | |
2269 |
|
2273 | |||
2270 | getrenamed = None |
|
2274 | getrenamed = None | |
2271 | if opts.get('copies'): |
|
2275 | if opts.get('copies'): | |
2272 | endrev = None |
|
2276 | endrev = None | |
2273 | if opts.get('rev'): |
|
2277 | if opts.get('rev'): | |
2274 | endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 |
|
2278 | endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 | |
2275 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) |
|
2279 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) | |
2276 | displayer = show_changeset(ui, repo, opts, buffered=True) |
|
2280 | displayer = show_changeset(ui, repo, opts, buffered=True) | |
2277 | displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed, |
|
2281 | displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed, | |
2278 | filematcher) |
|
2282 | filematcher) | |
2279 |
|
2283 | |||
2280 | def checkunsupportedgraphflags(pats, opts): |
|
2284 | def checkunsupportedgraphflags(pats, opts): | |
2281 | for op in ["newest_first"]: |
|
2285 | for op in ["newest_first"]: | |
2282 | if op in opts and opts[op]: |
|
2286 | if op in opts and opts[op]: | |
2283 | raise error.Abort(_("-G/--graph option is incompatible with --%s") |
|
2287 | raise error.Abort(_("-G/--graph option is incompatible with --%s") | |
2284 | % op.replace("_", "-")) |
|
2288 | % op.replace("_", "-")) | |
2285 |
|
2289 | |||
2286 | def graphrevs(repo, nodes, opts): |
|
2290 | def graphrevs(repo, nodes, opts): | |
2287 | limit = loglimit(opts) |
|
2291 | limit = loglimit(opts) | |
2288 | nodes.reverse() |
|
2292 | nodes.reverse() | |
2289 | if limit is not None: |
|
2293 | if limit is not None: | |
2290 | nodes = nodes[:limit] |
|
2294 | nodes = nodes[:limit] | |
2291 | return graphmod.nodes(repo, nodes) |
|
2295 | return graphmod.nodes(repo, nodes) | |
2292 |
|
2296 | |||
2293 | def add(ui, repo, match, prefix, explicitonly, **opts): |
|
2297 | def add(ui, repo, match, prefix, explicitonly, **opts): | |
2294 | join = lambda f: os.path.join(prefix, f) |
|
2298 | join = lambda f: os.path.join(prefix, f) | |
2295 | bad = [] |
|
2299 | bad = [] | |
2296 |
|
2300 | |||
2297 | badfn = lambda x, y: bad.append(x) or match.bad(x, y) |
|
2301 | badfn = lambda x, y: bad.append(x) or match.bad(x, y) | |
2298 | names = [] |
|
2302 | names = [] | |
2299 | wctx = repo[None] |
|
2303 | wctx = repo[None] | |
2300 | cca = None |
|
2304 | cca = None | |
2301 | abort, warn = scmutil.checkportabilityalert(ui) |
|
2305 | abort, warn = scmutil.checkportabilityalert(ui) | |
2302 | if abort or warn: |
|
2306 | if abort or warn: | |
2303 | cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) |
|
2307 | cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) | |
2304 |
|
2308 | |||
2305 | badmatch = matchmod.badmatch(match, badfn) |
|
2309 | badmatch = matchmod.badmatch(match, badfn) | |
2306 | dirstate = repo.dirstate |
|
2310 | dirstate = repo.dirstate | |
2307 | # We don't want to just call wctx.walk here, since it would return a lot of |
|
2311 | # We don't want to just call wctx.walk here, since it would return a lot of | |
2308 | # clean files, which we aren't interested in and takes time. |
|
2312 | # clean files, which we aren't interested in and takes time. | |
2309 | for f in sorted(dirstate.walk(badmatch, sorted(wctx.substate), |
|
2313 | for f in sorted(dirstate.walk(badmatch, sorted(wctx.substate), | |
2310 | True, False, full=False)): |
|
2314 | True, False, full=False)): | |
2311 | exact = match.exact(f) |
|
2315 | exact = match.exact(f) | |
2312 | if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f): |
|
2316 | if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f): | |
2313 | if cca: |
|
2317 | if cca: | |
2314 | cca(f) |
|
2318 | cca(f) | |
2315 | names.append(f) |
|
2319 | names.append(f) | |
2316 | if ui.verbose or not exact: |
|
2320 | if ui.verbose or not exact: | |
2317 | ui.status(_('adding %s\n') % match.rel(f)) |
|
2321 | ui.status(_('adding %s\n') % match.rel(f)) | |
2318 |
|
2322 | |||
2319 | for subpath in sorted(wctx.substate): |
|
2323 | for subpath in sorted(wctx.substate): | |
2320 | sub = wctx.sub(subpath) |
|
2324 | sub = wctx.sub(subpath) | |
2321 | try: |
|
2325 | try: | |
2322 | submatch = matchmod.subdirmatcher(subpath, match) |
|
2326 | submatch = matchmod.subdirmatcher(subpath, match) | |
2323 | if opts.get('subrepos'): |
|
2327 | if opts.get('subrepos'): | |
2324 | bad.extend(sub.add(ui, submatch, prefix, False, **opts)) |
|
2328 | bad.extend(sub.add(ui, submatch, prefix, False, **opts)) | |
2325 | else: |
|
2329 | else: | |
2326 | bad.extend(sub.add(ui, submatch, prefix, True, **opts)) |
|
2330 | bad.extend(sub.add(ui, submatch, prefix, True, **opts)) | |
2327 | except error.LookupError: |
|
2331 | except error.LookupError: | |
2328 | ui.status(_("skipping missing subrepository: %s\n") |
|
2332 | ui.status(_("skipping missing subrepository: %s\n") | |
2329 | % join(subpath)) |
|
2333 | % join(subpath)) | |
2330 |
|
2334 | |||
2331 | if not opts.get('dry_run'): |
|
2335 | if not opts.get('dry_run'): | |
2332 | rejected = wctx.add(names, prefix) |
|
2336 | rejected = wctx.add(names, prefix) | |
2333 | bad.extend(f for f in rejected if f in match.files()) |
|
2337 | bad.extend(f for f in rejected if f in match.files()) | |
2334 | return bad |
|
2338 | return bad | |
2335 |
|
2339 | |||
2336 | def forget(ui, repo, match, prefix, explicitonly): |
|
2340 | def forget(ui, repo, match, prefix, explicitonly): | |
2337 | join = lambda f: os.path.join(prefix, f) |
|
2341 | join = lambda f: os.path.join(prefix, f) | |
2338 | bad = [] |
|
2342 | bad = [] | |
2339 | badfn = lambda x, y: bad.append(x) or match.bad(x, y) |
|
2343 | badfn = lambda x, y: bad.append(x) or match.bad(x, y) | |
2340 | wctx = repo[None] |
|
2344 | wctx = repo[None] | |
2341 | forgot = [] |
|
2345 | forgot = [] | |
2342 |
|
2346 | |||
2343 | s = repo.status(match=matchmod.badmatch(match, badfn), clean=True) |
|
2347 | s = repo.status(match=matchmod.badmatch(match, badfn), clean=True) | |
2344 | forget = sorted(s[0] + s[1] + s[3] + s[6]) |
|
2348 | forget = sorted(s[0] + s[1] + s[3] + s[6]) | |
2345 | if explicitonly: |
|
2349 | if explicitonly: | |
2346 | forget = [f for f in forget if match.exact(f)] |
|
2350 | forget = [f for f in forget if match.exact(f)] | |
2347 |
|
2351 | |||
2348 | for subpath in sorted(wctx.substate): |
|
2352 | for subpath in sorted(wctx.substate): | |
2349 | sub = wctx.sub(subpath) |
|
2353 | sub = wctx.sub(subpath) | |
2350 | try: |
|
2354 | try: | |
2351 | submatch = matchmod.subdirmatcher(subpath, match) |
|
2355 | submatch = matchmod.subdirmatcher(subpath, match) | |
2352 | subbad, subforgot = sub.forget(submatch, prefix) |
|
2356 | subbad, subforgot = sub.forget(submatch, prefix) | |
2353 | bad.extend([subpath + '/' + f for f in subbad]) |
|
2357 | bad.extend([subpath + '/' + f for f in subbad]) | |
2354 | forgot.extend([subpath + '/' + f for f in subforgot]) |
|
2358 | forgot.extend([subpath + '/' + f for f in subforgot]) | |
2355 | except error.LookupError: |
|
2359 | except error.LookupError: | |
2356 | ui.status(_("skipping missing subrepository: %s\n") |
|
2360 | ui.status(_("skipping missing subrepository: %s\n") | |
2357 | % join(subpath)) |
|
2361 | % join(subpath)) | |
2358 |
|
2362 | |||
2359 | if not explicitonly: |
|
2363 | if not explicitonly: | |
2360 | for f in match.files(): |
|
2364 | for f in match.files(): | |
2361 | if f not in repo.dirstate and not repo.wvfs.isdir(f): |
|
2365 | if f not in repo.dirstate and not repo.wvfs.isdir(f): | |
2362 | if f not in forgot: |
|
2366 | if f not in forgot: | |
2363 | if repo.wvfs.exists(f): |
|
2367 | if repo.wvfs.exists(f): | |
2364 | # Don't complain if the exact case match wasn't given. |
|
2368 | # Don't complain if the exact case match wasn't given. | |
2365 | # But don't do this until after checking 'forgot', so |
|
2369 | # But don't do this until after checking 'forgot', so | |
2366 | # that subrepo files aren't normalized, and this op is |
|
2370 | # that subrepo files aren't normalized, and this op is | |
2367 | # purely from data cached by the status walk above. |
|
2371 | # purely from data cached by the status walk above. | |
2368 | if repo.dirstate.normalize(f) in repo.dirstate: |
|
2372 | if repo.dirstate.normalize(f) in repo.dirstate: | |
2369 | continue |
|
2373 | continue | |
2370 | ui.warn(_('not removing %s: ' |
|
2374 | ui.warn(_('not removing %s: ' | |
2371 | 'file is already untracked\n') |
|
2375 | 'file is already untracked\n') | |
2372 | % match.rel(f)) |
|
2376 | % match.rel(f)) | |
2373 | bad.append(f) |
|
2377 | bad.append(f) | |
2374 |
|
2378 | |||
2375 | for f in forget: |
|
2379 | for f in forget: | |
2376 | if ui.verbose or not match.exact(f): |
|
2380 | if ui.verbose or not match.exact(f): | |
2377 | ui.status(_('removing %s\n') % match.rel(f)) |
|
2381 | ui.status(_('removing %s\n') % match.rel(f)) | |
2378 |
|
2382 | |||
2379 | rejected = wctx.forget(forget, prefix) |
|
2383 | rejected = wctx.forget(forget, prefix) | |
2380 | bad.extend(f for f in rejected if f in match.files()) |
|
2384 | bad.extend(f for f in rejected if f in match.files()) | |
2381 | forgot.extend(f for f in forget if f not in rejected) |
|
2385 | forgot.extend(f for f in forget if f not in rejected) | |
2382 | return bad, forgot |
|
2386 | return bad, forgot | |
2383 |
|
2387 | |||
2384 | def files(ui, ctx, m, fm, fmt, subrepos): |
|
2388 | def files(ui, ctx, m, fm, fmt, subrepos): | |
2385 | rev = ctx.rev() |
|
2389 | rev = ctx.rev() | |
2386 | ret = 1 |
|
2390 | ret = 1 | |
2387 | ds = ctx.repo().dirstate |
|
2391 | ds = ctx.repo().dirstate | |
2388 |
|
2392 | |||
2389 | for f in ctx.matches(m): |
|
2393 | for f in ctx.matches(m): | |
2390 | if rev is None and ds[f] == 'r': |
|
2394 | if rev is None and ds[f] == 'r': | |
2391 | continue |
|
2395 | continue | |
2392 | fm.startitem() |
|
2396 | fm.startitem() | |
2393 | if ui.verbose: |
|
2397 | if ui.verbose: | |
2394 | fc = ctx[f] |
|
2398 | fc = ctx[f] | |
2395 | fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) |
|
2399 | fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) | |
2396 | fm.data(abspath=f) |
|
2400 | fm.data(abspath=f) | |
2397 | fm.write('path', fmt, m.rel(f)) |
|
2401 | fm.write('path', fmt, m.rel(f)) | |
2398 | ret = 0 |
|
2402 | ret = 0 | |
2399 |
|
2403 | |||
2400 | for subpath in sorted(ctx.substate): |
|
2404 | for subpath in sorted(ctx.substate): | |
2401 | def matchessubrepo(subpath): |
|
2405 | def matchessubrepo(subpath): | |
2402 | return (m.exact(subpath) |
|
2406 | return (m.exact(subpath) | |
2403 | or any(f.startswith(subpath + '/') for f in m.files())) |
|
2407 | or any(f.startswith(subpath + '/') for f in m.files())) | |
2404 |
|
2408 | |||
2405 | if subrepos or matchessubrepo(subpath): |
|
2409 | if subrepos or matchessubrepo(subpath): | |
2406 | sub = ctx.sub(subpath) |
|
2410 | sub = ctx.sub(subpath) | |
2407 | try: |
|
2411 | try: | |
2408 | submatch = matchmod.subdirmatcher(subpath, m) |
|
2412 | submatch = matchmod.subdirmatcher(subpath, m) | |
2409 | recurse = m.exact(subpath) or subrepos |
|
2413 | recurse = m.exact(subpath) or subrepos | |
2410 | if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0: |
|
2414 | if sub.printfiles(ui, submatch, fm, fmt, recurse) == 0: | |
2411 | ret = 0 |
|
2415 | ret = 0 | |
2412 | except error.LookupError: |
|
2416 | except error.LookupError: | |
2413 | ui.status(_("skipping missing subrepository: %s\n") |
|
2417 | ui.status(_("skipping missing subrepository: %s\n") | |
2414 | % m.abs(subpath)) |
|
2418 | % m.abs(subpath)) | |
2415 |
|
2419 | |||
2416 | return ret |
|
2420 | return ret | |
2417 |
|
2421 | |||
2418 | def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None): |
|
2422 | def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None): | |
2419 | join = lambda f: os.path.join(prefix, f) |
|
2423 | join = lambda f: os.path.join(prefix, f) | |
2420 | ret = 0 |
|
2424 | ret = 0 | |
2421 | s = repo.status(match=m, clean=True) |
|
2425 | s = repo.status(match=m, clean=True) | |
2422 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] |
|
2426 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] | |
2423 |
|
2427 | |||
2424 | wctx = repo[None] |
|
2428 | wctx = repo[None] | |
2425 |
|
2429 | |||
2426 | if warnings is None: |
|
2430 | if warnings is None: | |
2427 | warnings = [] |
|
2431 | warnings = [] | |
2428 | warn = True |
|
2432 | warn = True | |
2429 | else: |
|
2433 | else: | |
2430 | warn = False |
|
2434 | warn = False | |
2431 |
|
2435 | |||
2432 | subs = sorted(wctx.substate) |
|
2436 | subs = sorted(wctx.substate) | |
2433 | total = len(subs) |
|
2437 | total = len(subs) | |
2434 | count = 0 |
|
2438 | count = 0 | |
2435 | for subpath in subs: |
|
2439 | for subpath in subs: | |
2436 | def matchessubrepo(matcher, subpath): |
|
2440 | def matchessubrepo(matcher, subpath): | |
2437 | if matcher.exact(subpath): |
|
2441 | if matcher.exact(subpath): | |
2438 | return True |
|
2442 | return True | |
2439 | for f in matcher.files(): |
|
2443 | for f in matcher.files(): | |
2440 | if f.startswith(subpath): |
|
2444 | if f.startswith(subpath): | |
2441 | return True |
|
2445 | return True | |
2442 | return False |
|
2446 | return False | |
2443 |
|
2447 | |||
2444 | count += 1 |
|
2448 | count += 1 | |
2445 | if subrepos or matchessubrepo(m, subpath): |
|
2449 | if subrepos or matchessubrepo(m, subpath): | |
2446 | ui.progress(_('searching'), count, total=total, unit=_('subrepos')) |
|
2450 | ui.progress(_('searching'), count, total=total, unit=_('subrepos')) | |
2447 |
|
2451 | |||
2448 | sub = wctx.sub(subpath) |
|
2452 | sub = wctx.sub(subpath) | |
2449 | try: |
|
2453 | try: | |
2450 | submatch = matchmod.subdirmatcher(subpath, m) |
|
2454 | submatch = matchmod.subdirmatcher(subpath, m) | |
2451 | if sub.removefiles(submatch, prefix, after, force, subrepos, |
|
2455 | if sub.removefiles(submatch, prefix, after, force, subrepos, | |
2452 | warnings): |
|
2456 | warnings): | |
2453 | ret = 1 |
|
2457 | ret = 1 | |
2454 | except error.LookupError: |
|
2458 | except error.LookupError: | |
2455 | warnings.append(_("skipping missing subrepository: %s\n") |
|
2459 | warnings.append(_("skipping missing subrepository: %s\n") | |
2456 | % join(subpath)) |
|
2460 | % join(subpath)) | |
2457 | ui.progress(_('searching'), None) |
|
2461 | ui.progress(_('searching'), None) | |
2458 |
|
2462 | |||
2459 | # warn about failure to delete explicit files/dirs |
|
2463 | # warn about failure to delete explicit files/dirs | |
2460 | deleteddirs = util.dirs(deleted) |
|
2464 | deleteddirs = util.dirs(deleted) | |
2461 | files = m.files() |
|
2465 | files = m.files() | |
2462 | total = len(files) |
|
2466 | total = len(files) | |
2463 | count = 0 |
|
2467 | count = 0 | |
2464 | for f in files: |
|
2468 | for f in files: | |
2465 | def insubrepo(): |
|
2469 | def insubrepo(): | |
2466 | for subpath in wctx.substate: |
|
2470 | for subpath in wctx.substate: | |
2467 | if f.startswith(subpath): |
|
2471 | if f.startswith(subpath): | |
2468 | return True |
|
2472 | return True | |
2469 | return False |
|
2473 | return False | |
2470 |
|
2474 | |||
2471 | count += 1 |
|
2475 | count += 1 | |
2472 | ui.progress(_('deleting'), count, total=total, unit=_('files')) |
|
2476 | ui.progress(_('deleting'), count, total=total, unit=_('files')) | |
2473 | isdir = f in deleteddirs or wctx.hasdir(f) |
|
2477 | isdir = f in deleteddirs or wctx.hasdir(f) | |
2474 | if f in repo.dirstate or isdir or f == '.' or insubrepo(): |
|
2478 | if f in repo.dirstate or isdir or f == '.' or insubrepo(): | |
2475 | continue |
|
2479 | continue | |
2476 |
|
2480 | |||
2477 | if repo.wvfs.exists(f): |
|
2481 | if repo.wvfs.exists(f): | |
2478 | if repo.wvfs.isdir(f): |
|
2482 | if repo.wvfs.isdir(f): | |
2479 | warnings.append(_('not removing %s: no tracked files\n') |
|
2483 | warnings.append(_('not removing %s: no tracked files\n') | |
2480 | % m.rel(f)) |
|
2484 | % m.rel(f)) | |
2481 | else: |
|
2485 | else: | |
2482 | warnings.append(_('not removing %s: file is untracked\n') |
|
2486 | warnings.append(_('not removing %s: file is untracked\n') | |
2483 | % m.rel(f)) |
|
2487 | % m.rel(f)) | |
2484 | # missing files will generate a warning elsewhere |
|
2488 | # missing files will generate a warning elsewhere | |
2485 | ret = 1 |
|
2489 | ret = 1 | |
2486 | ui.progress(_('deleting'), None) |
|
2490 | ui.progress(_('deleting'), None) | |
2487 |
|
2491 | |||
2488 | if force: |
|
2492 | if force: | |
2489 | list = modified + deleted + clean + added |
|
2493 | list = modified + deleted + clean + added | |
2490 | elif after: |
|
2494 | elif after: | |
2491 | list = deleted |
|
2495 | list = deleted | |
2492 | remaining = modified + added + clean |
|
2496 | remaining = modified + added + clean | |
2493 | total = len(remaining) |
|
2497 | total = len(remaining) | |
2494 | count = 0 |
|
2498 | count = 0 | |
2495 | for f in remaining: |
|
2499 | for f in remaining: | |
2496 | count += 1 |
|
2500 | count += 1 | |
2497 | ui.progress(_('skipping'), count, total=total, unit=_('files')) |
|
2501 | ui.progress(_('skipping'), count, total=total, unit=_('files')) | |
2498 | warnings.append(_('not removing %s: file still exists\n') |
|
2502 | warnings.append(_('not removing %s: file still exists\n') | |
2499 | % m.rel(f)) |
|
2503 | % m.rel(f)) | |
2500 | ret = 1 |
|
2504 | ret = 1 | |
2501 | ui.progress(_('skipping'), None) |
|
2505 | ui.progress(_('skipping'), None) | |
2502 | else: |
|
2506 | else: | |
2503 | list = deleted + clean |
|
2507 | list = deleted + clean | |
2504 | total = len(modified) + len(added) |
|
2508 | total = len(modified) + len(added) | |
2505 | count = 0 |
|
2509 | count = 0 | |
2506 | for f in modified: |
|
2510 | for f in modified: | |
2507 | count += 1 |
|
2511 | count += 1 | |
2508 | ui.progress(_('skipping'), count, total=total, unit=_('files')) |
|
2512 | ui.progress(_('skipping'), count, total=total, unit=_('files')) | |
2509 | warnings.append(_('not removing %s: file is modified (use -f' |
|
2513 | warnings.append(_('not removing %s: file is modified (use -f' | |
2510 | ' to force removal)\n') % m.rel(f)) |
|
2514 | ' to force removal)\n') % m.rel(f)) | |
2511 | ret = 1 |
|
2515 | ret = 1 | |
2512 | for f in added: |
|
2516 | for f in added: | |
2513 | count += 1 |
|
2517 | count += 1 | |
2514 | ui.progress(_('skipping'), count, total=total, unit=_('files')) |
|
2518 | ui.progress(_('skipping'), count, total=total, unit=_('files')) | |
2515 | warnings.append(_('not removing %s: file has been marked for add' |
|
2519 | warnings.append(_('not removing %s: file has been marked for add' | |
2516 | ' (use forget to undo)\n') % m.rel(f)) |
|
2520 | ' (use forget to undo)\n') % m.rel(f)) | |
2517 | ret = 1 |
|
2521 | ret = 1 | |
2518 | ui.progress(_('skipping'), None) |
|
2522 | ui.progress(_('skipping'), None) | |
2519 |
|
2523 | |||
2520 | list = sorted(list) |
|
2524 | list = sorted(list) | |
2521 | total = len(list) |
|
2525 | total = len(list) | |
2522 | count = 0 |
|
2526 | count = 0 | |
2523 | for f in list: |
|
2527 | for f in list: | |
2524 | count += 1 |
|
2528 | count += 1 | |
2525 | if ui.verbose or not m.exact(f): |
|
2529 | if ui.verbose or not m.exact(f): | |
2526 | ui.progress(_('deleting'), count, total=total, unit=_('files')) |
|
2530 | ui.progress(_('deleting'), count, total=total, unit=_('files')) | |
2527 | ui.status(_('removing %s\n') % m.rel(f)) |
|
2531 | ui.status(_('removing %s\n') % m.rel(f)) | |
2528 | ui.progress(_('deleting'), None) |
|
2532 | ui.progress(_('deleting'), None) | |
2529 |
|
2533 | |||
2530 | with repo.wlock(): |
|
2534 | with repo.wlock(): | |
2531 | if not after: |
|
2535 | if not after: | |
2532 | for f in list: |
|
2536 | for f in list: | |
2533 | if f in added: |
|
2537 | if f in added: | |
2534 | continue # we never unlink added files on remove |
|
2538 | continue # we never unlink added files on remove | |
2535 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
2539 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) | |
2536 | repo[None].forget(list) |
|
2540 | repo[None].forget(list) | |
2537 |
|
2541 | |||
2538 | if warn: |
|
2542 | if warn: | |
2539 | for warning in warnings: |
|
2543 | for warning in warnings: | |
2540 | ui.warn(warning) |
|
2544 | ui.warn(warning) | |
2541 |
|
2545 | |||
2542 | return ret |
|
2546 | return ret | |
2543 |
|
2547 | |||
2544 | def cat(ui, repo, ctx, matcher, prefix, **opts): |
|
2548 | def cat(ui, repo, ctx, matcher, prefix, **opts): | |
2545 | err = 1 |
|
2549 | err = 1 | |
2546 |
|
2550 | |||
2547 | def write(path): |
|
2551 | def write(path): | |
2548 | fp = makefileobj(repo, opts.get('output'), ctx.node(), |
|
2552 | fp = makefileobj(repo, opts.get('output'), ctx.node(), | |
2549 | pathname=os.path.join(prefix, path)) |
|
2553 | pathname=os.path.join(prefix, path)) | |
2550 | data = ctx[path].data() |
|
2554 | data = ctx[path].data() | |
2551 | if opts.get('decode'): |
|
2555 | if opts.get('decode'): | |
2552 | data = repo.wwritedata(path, data) |
|
2556 | data = repo.wwritedata(path, data) | |
2553 | fp.write(data) |
|
2557 | fp.write(data) | |
2554 | fp.close() |
|
2558 | fp.close() | |
2555 |
|
2559 | |||
2556 | # Automation often uses hg cat on single files, so special case it |
|
2560 | # Automation often uses hg cat on single files, so special case it | |
2557 | # for performance to avoid the cost of parsing the manifest. |
|
2561 | # for performance to avoid the cost of parsing the manifest. | |
2558 | if len(matcher.files()) == 1 and not matcher.anypats(): |
|
2562 | if len(matcher.files()) == 1 and not matcher.anypats(): | |
2559 | file = matcher.files()[0] |
|
2563 | file = matcher.files()[0] | |
2560 | mf = repo.manifest |
|
2564 | mf = repo.manifest | |
2561 | mfnode = ctx.manifestnode() |
|
2565 | mfnode = ctx.manifestnode() | |
2562 | if mfnode and mf.find(mfnode, file)[0]: |
|
2566 | if mfnode and mf.find(mfnode, file)[0]: | |
2563 | write(file) |
|
2567 | write(file) | |
2564 | return 0 |
|
2568 | return 0 | |
2565 |
|
2569 | |||
2566 | # Don't warn about "missing" files that are really in subrepos |
|
2570 | # Don't warn about "missing" files that are really in subrepos | |
2567 | def badfn(path, msg): |
|
2571 | def badfn(path, msg): | |
2568 | for subpath in ctx.substate: |
|
2572 | for subpath in ctx.substate: | |
2569 | if path.startswith(subpath): |
|
2573 | if path.startswith(subpath): | |
2570 | return |
|
2574 | return | |
2571 | matcher.bad(path, msg) |
|
2575 | matcher.bad(path, msg) | |
2572 |
|
2576 | |||
2573 | for abs in ctx.walk(matchmod.badmatch(matcher, badfn)): |
|
2577 | for abs in ctx.walk(matchmod.badmatch(matcher, badfn)): | |
2574 | write(abs) |
|
2578 | write(abs) | |
2575 | err = 0 |
|
2579 | err = 0 | |
2576 |
|
2580 | |||
2577 | for subpath in sorted(ctx.substate): |
|
2581 | for subpath in sorted(ctx.substate): | |
2578 | sub = ctx.sub(subpath) |
|
2582 | sub = ctx.sub(subpath) | |
2579 | try: |
|
2583 | try: | |
2580 | submatch = matchmod.subdirmatcher(subpath, matcher) |
|
2584 | submatch = matchmod.subdirmatcher(subpath, matcher) | |
2581 |
|
2585 | |||
2582 | if not sub.cat(submatch, os.path.join(prefix, sub._path), |
|
2586 | if not sub.cat(submatch, os.path.join(prefix, sub._path), | |
2583 | **opts): |
|
2587 | **opts): | |
2584 | err = 0 |
|
2588 | err = 0 | |
2585 | except error.RepoLookupError: |
|
2589 | except error.RepoLookupError: | |
2586 | ui.status(_("skipping missing subrepository: %s\n") |
|
2590 | ui.status(_("skipping missing subrepository: %s\n") | |
2587 | % os.path.join(prefix, subpath)) |
|
2591 | % os.path.join(prefix, subpath)) | |
2588 |
|
2592 | |||
2589 | return err |
|
2593 | return err | |
2590 |
|
2594 | |||
2591 | def commit(ui, repo, commitfunc, pats, opts): |
|
2595 | def commit(ui, repo, commitfunc, pats, opts): | |
2592 | '''commit the specified files or all outstanding changes''' |
|
2596 | '''commit the specified files or all outstanding changes''' | |
2593 | date = opts.get('date') |
|
2597 | date = opts.get('date') | |
2594 | if date: |
|
2598 | if date: | |
2595 | opts['date'] = util.parsedate(date) |
|
2599 | opts['date'] = util.parsedate(date) | |
2596 | message = logmessage(ui, opts) |
|
2600 | message = logmessage(ui, opts) | |
2597 | matcher = scmutil.match(repo[None], pats, opts) |
|
2601 | matcher = scmutil.match(repo[None], pats, opts) | |
2598 |
|
2602 | |||
2599 | # extract addremove carefully -- this function can be called from a command |
|
2603 | # extract addremove carefully -- this function can be called from a command | |
2600 | # that doesn't support addremove |
|
2604 | # that doesn't support addremove | |
2601 | if opts.get('addremove'): |
|
2605 | if opts.get('addremove'): | |
2602 | if scmutil.addremove(repo, matcher, "", opts) != 0: |
|
2606 | if scmutil.addremove(repo, matcher, "", opts) != 0: | |
2603 | raise error.Abort( |
|
2607 | raise error.Abort( | |
2604 | _("failed to mark all new/missing files as added/removed")) |
|
2608 | _("failed to mark all new/missing files as added/removed")) | |
2605 |
|
2609 | |||
2606 | return commitfunc(ui, repo, message, matcher, opts) |
|
2610 | return commitfunc(ui, repo, message, matcher, opts) | |
2607 |
|
2611 | |||
2608 | def amend(ui, repo, commitfunc, old, extra, pats, opts): |
|
2612 | def amend(ui, repo, commitfunc, old, extra, pats, opts): | |
2609 | # avoid cycle context -> subrepo -> cmdutil |
|
2613 | # avoid cycle context -> subrepo -> cmdutil | |
2610 | from . import context |
|
2614 | from . import context | |
2611 |
|
2615 | |||
2612 | # amend will reuse the existing user if not specified, but the obsolete |
|
2616 | # amend will reuse the existing user if not specified, but the obsolete | |
2613 | # marker creation requires that the current user's name is specified. |
|
2617 | # marker creation requires that the current user's name is specified. | |
2614 | if obsolete.isenabled(repo, obsolete.createmarkersopt): |
|
2618 | if obsolete.isenabled(repo, obsolete.createmarkersopt): | |
2615 | ui.username() # raise exception if username not set |
|
2619 | ui.username() # raise exception if username not set | |
2616 |
|
2620 | |||
2617 | ui.note(_('amending changeset %s\n') % old) |
|
2621 | ui.note(_('amending changeset %s\n') % old) | |
2618 | base = old.p1() |
|
2622 | base = old.p1() | |
2619 | createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) |
|
2623 | createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) | |
2620 |
|
2624 | |||
2621 | wlock = lock = newid = None |
|
2625 | wlock = lock = newid = None | |
2622 | try: |
|
2626 | try: | |
2623 | wlock = repo.wlock() |
|
2627 | wlock = repo.wlock() | |
2624 | lock = repo.lock() |
|
2628 | lock = repo.lock() | |
2625 | with repo.transaction('amend') as tr: |
|
2629 | with repo.transaction('amend') as tr: | |
2626 | # See if we got a message from -m or -l, if not, open the editor |
|
2630 | # See if we got a message from -m or -l, if not, open the editor | |
2627 | # with the message of the changeset to amend |
|
2631 | # with the message of the changeset to amend | |
2628 | message = logmessage(ui, opts) |
|
2632 | message = logmessage(ui, opts) | |
2629 | # ensure logfile does not conflict with later enforcement of the |
|
2633 | # ensure logfile does not conflict with later enforcement of the | |
2630 | # message. potential logfile content has been processed by |
|
2634 | # message. potential logfile content has been processed by | |
2631 | # `logmessage` anyway. |
|
2635 | # `logmessage` anyway. | |
2632 | opts.pop('logfile') |
|
2636 | opts.pop('logfile') | |
2633 | # First, do a regular commit to record all changes in the working |
|
2637 | # First, do a regular commit to record all changes in the working | |
2634 | # directory (if there are any) |
|
2638 | # directory (if there are any) | |
2635 | ui.callhooks = False |
|
2639 | ui.callhooks = False | |
2636 | activebookmark = repo._bookmarks.active |
|
2640 | activebookmark = repo._bookmarks.active | |
2637 | try: |
|
2641 | try: | |
2638 | repo._bookmarks.active = None |
|
2642 | repo._bookmarks.active = None | |
2639 | opts['message'] = 'temporary amend commit for %s' % old |
|
2643 | opts['message'] = 'temporary amend commit for %s' % old | |
2640 | node = commit(ui, repo, commitfunc, pats, opts) |
|
2644 | node = commit(ui, repo, commitfunc, pats, opts) | |
2641 | finally: |
|
2645 | finally: | |
2642 | repo._bookmarks.active = activebookmark |
|
2646 | repo._bookmarks.active = activebookmark | |
2643 | repo._bookmarks.recordchange(tr) |
|
2647 | repo._bookmarks.recordchange(tr) | |
2644 | ui.callhooks = True |
|
2648 | ui.callhooks = True | |
2645 | ctx = repo[node] |
|
2649 | ctx = repo[node] | |
2646 |
|
2650 | |||
2647 | # Participating changesets: |
|
2651 | # Participating changesets: | |
2648 | # |
|
2652 | # | |
2649 | # node/ctx o - new (intermediate) commit that contains changes |
|
2653 | # node/ctx o - new (intermediate) commit that contains changes | |
2650 | # | from working dir to go into amending commit |
|
2654 | # | from working dir to go into amending commit | |
2651 | # | (or a workingctx if there were no changes) |
|
2655 | # | (or a workingctx if there were no changes) | |
2652 | # | |
|
2656 | # | | |
2653 | # old o - changeset to amend |
|
2657 | # old o - changeset to amend | |
2654 | # | |
|
2658 | # | | |
2655 | # base o - parent of amending changeset |
|
2659 | # base o - parent of amending changeset | |
2656 |
|
2660 | |||
2657 | # Update extra dict from amended commit (e.g. to preserve graft |
|
2661 | # Update extra dict from amended commit (e.g. to preserve graft | |
2658 | # source) |
|
2662 | # source) | |
2659 | extra.update(old.extra()) |
|
2663 | extra.update(old.extra()) | |
2660 |
|
2664 | |||
2661 | # Also update it from the intermediate commit or from the wctx |
|
2665 | # Also update it from the intermediate commit or from the wctx | |
2662 | extra.update(ctx.extra()) |
|
2666 | extra.update(ctx.extra()) | |
2663 |
|
2667 | |||
2664 | if len(old.parents()) > 1: |
|
2668 | if len(old.parents()) > 1: | |
2665 | # ctx.files() isn't reliable for merges, so fall back to the |
|
2669 | # ctx.files() isn't reliable for merges, so fall back to the | |
2666 | # slower repo.status() method |
|
2670 | # slower repo.status() method | |
2667 | files = set([fn for st in repo.status(base, old)[:3] |
|
2671 | files = set([fn for st in repo.status(base, old)[:3] | |
2668 | for fn in st]) |
|
2672 | for fn in st]) | |
2669 | else: |
|
2673 | else: | |
2670 | files = set(old.files()) |
|
2674 | files = set(old.files()) | |
2671 |
|
2675 | |||
2672 | # Second, we use either the commit we just did, or if there were no |
|
2676 | # Second, we use either the commit we just did, or if there were no | |
2673 | # changes the parent of the working directory as the version of the |
|
2677 | # changes the parent of the working directory as the version of the | |
2674 | # files in the final amend commit |
|
2678 | # files in the final amend commit | |
2675 | if node: |
|
2679 | if node: | |
2676 | ui.note(_('copying changeset %s to %s\n') % (ctx, base)) |
|
2680 | ui.note(_('copying changeset %s to %s\n') % (ctx, base)) | |
2677 |
|
2681 | |||
2678 | user = ctx.user() |
|
2682 | user = ctx.user() | |
2679 | date = ctx.date() |
|
2683 | date = ctx.date() | |
2680 | # Recompute copies (avoid recording a -> b -> a) |
|
2684 | # Recompute copies (avoid recording a -> b -> a) | |
2681 | copied = copies.pathcopies(base, ctx) |
|
2685 | copied = copies.pathcopies(base, ctx) | |
2682 | if old.p2: |
|
2686 | if old.p2: | |
2683 | copied.update(copies.pathcopies(old.p2(), ctx)) |
|
2687 | copied.update(copies.pathcopies(old.p2(), ctx)) | |
2684 |
|
2688 | |||
2685 | # Prune files which were reverted by the updates: if old |
|
2689 | # Prune files which were reverted by the updates: if old | |
2686 | # introduced file X and our intermediate commit, node, |
|
2690 | # introduced file X and our intermediate commit, node, | |
2687 | # renamed that file, then those two files are the same and |
|
2691 | # renamed that file, then those two files are the same and | |
2688 | # we can discard X from our list of files. Likewise if X |
|
2692 | # we can discard X from our list of files. Likewise if X | |
2689 | # was deleted, it's no longer relevant |
|
2693 | # was deleted, it's no longer relevant | |
2690 | files.update(ctx.files()) |
|
2694 | files.update(ctx.files()) | |
2691 |
|
2695 | |||
2692 | def samefile(f): |
|
2696 | def samefile(f): | |
2693 | if f in ctx.manifest(): |
|
2697 | if f in ctx.manifest(): | |
2694 | a = ctx.filectx(f) |
|
2698 | a = ctx.filectx(f) | |
2695 | if f in base.manifest(): |
|
2699 | if f in base.manifest(): | |
2696 | b = base.filectx(f) |
|
2700 | b = base.filectx(f) | |
2697 | return (not a.cmp(b) |
|
2701 | return (not a.cmp(b) | |
2698 | and a.flags() == b.flags()) |
|
2702 | and a.flags() == b.flags()) | |
2699 | else: |
|
2703 | else: | |
2700 | return False |
|
2704 | return False | |
2701 | else: |
|
2705 | else: | |
2702 | return f not in base.manifest() |
|
2706 | return f not in base.manifest() | |
2703 | files = [f for f in files if not samefile(f)] |
|
2707 | files = [f for f in files if not samefile(f)] | |
2704 |
|
2708 | |||
2705 | def filectxfn(repo, ctx_, path): |
|
2709 | def filectxfn(repo, ctx_, path): | |
2706 | try: |
|
2710 | try: | |
2707 | fctx = ctx[path] |
|
2711 | fctx = ctx[path] | |
2708 | flags = fctx.flags() |
|
2712 | flags = fctx.flags() | |
2709 | mctx = context.memfilectx(repo, |
|
2713 | mctx = context.memfilectx(repo, | |
2710 | fctx.path(), fctx.data(), |
|
2714 | fctx.path(), fctx.data(), | |
2711 | islink='l' in flags, |
|
2715 | islink='l' in flags, | |
2712 | isexec='x' in flags, |
|
2716 | isexec='x' in flags, | |
2713 | copied=copied.get(path)) |
|
2717 | copied=copied.get(path)) | |
2714 | return mctx |
|
2718 | return mctx | |
2715 | except KeyError: |
|
2719 | except KeyError: | |
2716 | return None |
|
2720 | return None | |
2717 | else: |
|
2721 | else: | |
2718 | ui.note(_('copying changeset %s to %s\n') % (old, base)) |
|
2722 | ui.note(_('copying changeset %s to %s\n') % (old, base)) | |
2719 |
|
2723 | |||
2720 | # Use version of files as in the old cset |
|
2724 | # Use version of files as in the old cset | |
2721 | def filectxfn(repo, ctx_, path): |
|
2725 | def filectxfn(repo, ctx_, path): | |
2722 | try: |
|
2726 | try: | |
2723 | return old.filectx(path) |
|
2727 | return old.filectx(path) | |
2724 | except KeyError: |
|
2728 | except KeyError: | |
2725 | return None |
|
2729 | return None | |
2726 |
|
2730 | |||
2727 | user = opts.get('user') or old.user() |
|
2731 | user = opts.get('user') or old.user() | |
2728 | date = opts.get('date') or old.date() |
|
2732 | date = opts.get('date') or old.date() | |
2729 | editform = mergeeditform(old, 'commit.amend') |
|
2733 | editform = mergeeditform(old, 'commit.amend') | |
2730 | editor = getcommiteditor(editform=editform, **opts) |
|
2734 | editor = getcommiteditor(editform=editform, **opts) | |
2731 | if not message: |
|
2735 | if not message: | |
2732 | editor = getcommiteditor(edit=True, editform=editform) |
|
2736 | editor = getcommiteditor(edit=True, editform=editform) | |
2733 | message = old.description() |
|
2737 | message = old.description() | |
2734 |
|
2738 | |||
2735 | pureextra = extra.copy() |
|
2739 | pureextra = extra.copy() | |
2736 | extra['amend_source'] = old.hex() |
|
2740 | extra['amend_source'] = old.hex() | |
2737 |
|
2741 | |||
2738 | new = context.memctx(repo, |
|
2742 | new = context.memctx(repo, | |
2739 | parents=[base.node(), old.p2().node()], |
|
2743 | parents=[base.node(), old.p2().node()], | |
2740 | text=message, |
|
2744 | text=message, | |
2741 | files=files, |
|
2745 | files=files, | |
2742 | filectxfn=filectxfn, |
|
2746 | filectxfn=filectxfn, | |
2743 | user=user, |
|
2747 | user=user, | |
2744 | date=date, |
|
2748 | date=date, | |
2745 | extra=extra, |
|
2749 | extra=extra, | |
2746 | editor=editor) |
|
2750 | editor=editor) | |
2747 |
|
2751 | |||
2748 | newdesc = changelog.stripdesc(new.description()) |
|
2752 | newdesc = changelog.stripdesc(new.description()) | |
2749 | if ((not node) |
|
2753 | if ((not node) | |
2750 | and newdesc == old.description() |
|
2754 | and newdesc == old.description() | |
2751 | and user == old.user() |
|
2755 | and user == old.user() | |
2752 | and date == old.date() |
|
2756 | and date == old.date() | |
2753 | and pureextra == old.extra()): |
|
2757 | and pureextra == old.extra()): | |
2754 | # nothing changed. continuing here would create a new node |
|
2758 | # nothing changed. continuing here would create a new node | |
2755 | # anyway because of the amend_source noise. |
|
2759 | # anyway because of the amend_source noise. | |
2756 | # |
|
2760 | # | |
2757 | # This not what we expect from amend. |
|
2761 | # This not what we expect from amend. | |
2758 | return old.node() |
|
2762 | return old.node() | |
2759 |
|
2763 | |||
2760 | ph = repo.ui.config('phases', 'new-commit', phases.draft) |
|
2764 | ph = repo.ui.config('phases', 'new-commit', phases.draft) | |
2761 | try: |
|
2765 | try: | |
2762 | if opts.get('secret'): |
|
2766 | if opts.get('secret'): | |
2763 | commitphase = 'secret' |
|
2767 | commitphase = 'secret' | |
2764 | else: |
|
2768 | else: | |
2765 | commitphase = old.phase() |
|
2769 | commitphase = old.phase() | |
2766 | repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend') |
|
2770 | repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend') | |
2767 | newid = repo.commitctx(new) |
|
2771 | newid = repo.commitctx(new) | |
2768 | finally: |
|
2772 | finally: | |
2769 | repo.ui.setconfig('phases', 'new-commit', ph, 'amend') |
|
2773 | repo.ui.setconfig('phases', 'new-commit', ph, 'amend') | |
2770 | if newid != old.node(): |
|
2774 | if newid != old.node(): | |
2771 | # Reroute the working copy parent to the new changeset |
|
2775 | # Reroute the working copy parent to the new changeset | |
2772 | repo.setparents(newid, nullid) |
|
2776 | repo.setparents(newid, nullid) | |
2773 |
|
2777 | |||
2774 | # Move bookmarks from old parent to amend commit |
|
2778 | # Move bookmarks from old parent to amend commit | |
2775 | bms = repo.nodebookmarks(old.node()) |
|
2779 | bms = repo.nodebookmarks(old.node()) | |
2776 | if bms: |
|
2780 | if bms: | |
2777 | marks = repo._bookmarks |
|
2781 | marks = repo._bookmarks | |
2778 | for bm in bms: |
|
2782 | for bm in bms: | |
2779 | ui.debug('moving bookmarks %r from %s to %s\n' % |
|
2783 | ui.debug('moving bookmarks %r from %s to %s\n' % | |
2780 | (marks, old.hex(), hex(newid))) |
|
2784 | (marks, old.hex(), hex(newid))) | |
2781 | marks[bm] = newid |
|
2785 | marks[bm] = newid | |
2782 | marks.recordchange(tr) |
|
2786 | marks.recordchange(tr) | |
2783 | #commit the whole amend process |
|
2787 | #commit the whole amend process | |
2784 | if createmarkers: |
|
2788 | if createmarkers: | |
2785 | # mark the new changeset as successor of the rewritten one |
|
2789 | # mark the new changeset as successor of the rewritten one | |
2786 | new = repo[newid] |
|
2790 | new = repo[newid] | |
2787 | obs = [(old, (new,))] |
|
2791 | obs = [(old, (new,))] | |
2788 | if node: |
|
2792 | if node: | |
2789 | obs.append((ctx, ())) |
|
2793 | obs.append((ctx, ())) | |
2790 |
|
2794 | |||
2791 | obsolete.createmarkers(repo, obs) |
|
2795 | obsolete.createmarkers(repo, obs) | |
2792 | if not createmarkers and newid != old.node(): |
|
2796 | if not createmarkers and newid != old.node(): | |
2793 | # Strip the intermediate commit (if there was one) and the amended |
|
2797 | # Strip the intermediate commit (if there was one) and the amended | |
2794 | # commit |
|
2798 | # commit | |
2795 | if node: |
|
2799 | if node: | |
2796 | ui.note(_('stripping intermediate changeset %s\n') % ctx) |
|
2800 | ui.note(_('stripping intermediate changeset %s\n') % ctx) | |
2797 | ui.note(_('stripping amended changeset %s\n') % old) |
|
2801 | ui.note(_('stripping amended changeset %s\n') % old) | |
2798 | repair.strip(ui, repo, old.node(), topic='amend-backup') |
|
2802 | repair.strip(ui, repo, old.node(), topic='amend-backup') | |
2799 | finally: |
|
2803 | finally: | |
2800 | lockmod.release(lock, wlock) |
|
2804 | lockmod.release(lock, wlock) | |
2801 | return newid |
|
2805 | return newid | |
2802 |
|
2806 | |||
2803 | def commiteditor(repo, ctx, subs, editform=''): |
|
2807 | def commiteditor(repo, ctx, subs, editform=''): | |
2804 | if ctx.description(): |
|
2808 | if ctx.description(): | |
2805 | return ctx.description() |
|
2809 | return ctx.description() | |
2806 | return commitforceeditor(repo, ctx, subs, editform=editform, |
|
2810 | return commitforceeditor(repo, ctx, subs, editform=editform, | |
2807 | unchangedmessagedetection=True) |
|
2811 | unchangedmessagedetection=True) | |
2808 |
|
2812 | |||
2809 | def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None, |
|
2813 | def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None, | |
2810 | editform='', unchangedmessagedetection=False): |
|
2814 | editform='', unchangedmessagedetection=False): | |
2811 | if not extramsg: |
|
2815 | if not extramsg: | |
2812 | extramsg = _("Leave message empty to abort commit.") |
|
2816 | extramsg = _("Leave message empty to abort commit.") | |
2813 |
|
2817 | |||
2814 | forms = [e for e in editform.split('.') if e] |
|
2818 | forms = [e for e in editform.split('.') if e] | |
2815 | forms.insert(0, 'changeset') |
|
2819 | forms.insert(0, 'changeset') | |
2816 | templatetext = None |
|
2820 | templatetext = None | |
2817 | while forms: |
|
2821 | while forms: | |
2818 | tmpl = repo.ui.config('committemplate', '.'.join(forms)) |
|
2822 | tmpl = repo.ui.config('committemplate', '.'.join(forms)) | |
2819 | if tmpl: |
|
2823 | if tmpl: | |
2820 | templatetext = committext = buildcommittemplate( |
|
2824 | templatetext = committext = buildcommittemplate( | |
2821 | repo, ctx, subs, extramsg, tmpl) |
|
2825 | repo, ctx, subs, extramsg, tmpl) | |
2822 | break |
|
2826 | break | |
2823 | forms.pop() |
|
2827 | forms.pop() | |
2824 | else: |
|
2828 | else: | |
2825 | committext = buildcommittext(repo, ctx, subs, extramsg) |
|
2829 | committext = buildcommittext(repo, ctx, subs, extramsg) | |
2826 |
|
2830 | |||
2827 | # run editor in the repository root |
|
2831 | # run editor in the repository root | |
2828 | olddir = os.getcwd() |
|
2832 | olddir = os.getcwd() | |
2829 | os.chdir(repo.root) |
|
2833 | os.chdir(repo.root) | |
2830 |
|
2834 | |||
2831 | # make in-memory changes visible to external process |
|
2835 | # make in-memory changes visible to external process | |
2832 | tr = repo.currenttransaction() |
|
2836 | tr = repo.currenttransaction() | |
2833 | repo.dirstate.write(tr) |
|
2837 | repo.dirstate.write(tr) | |
2834 | pending = tr and tr.writepending() and repo.root |
|
2838 | pending = tr and tr.writepending() and repo.root | |
2835 |
|
2839 | |||
2836 | editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(), |
|
2840 | editortext = repo.ui.edit(committext, ctx.user(), ctx.extra(), | |
2837 | editform=editform, pending=pending) |
|
2841 | editform=editform, pending=pending) | |
2838 | text = re.sub("(?m)^HG:.*(\n|$)", "", editortext) |
|
2842 | text = re.sub("(?m)^HG:.*(\n|$)", "", editortext) | |
2839 | os.chdir(olddir) |
|
2843 | os.chdir(olddir) | |
2840 |
|
2844 | |||
2841 | if finishdesc: |
|
2845 | if finishdesc: | |
2842 | text = finishdesc(text) |
|
2846 | text = finishdesc(text) | |
2843 | if not text.strip(): |
|
2847 | if not text.strip(): | |
2844 | raise error.Abort(_("empty commit message")) |
|
2848 | raise error.Abort(_("empty commit message")) | |
2845 | if unchangedmessagedetection and editortext == templatetext: |
|
2849 | if unchangedmessagedetection and editortext == templatetext: | |
2846 | raise error.Abort(_("commit message unchanged")) |
|
2850 | raise error.Abort(_("commit message unchanged")) | |
2847 |
|
2851 | |||
2848 | return text |
|
2852 | return text | |
2849 |
|
2853 | |||
2850 | def buildcommittemplate(repo, ctx, subs, extramsg, tmpl): |
|
2854 | def buildcommittemplate(repo, ctx, subs, extramsg, tmpl): | |
2851 | ui = repo.ui |
|
2855 | ui = repo.ui | |
2852 | tmpl, mapfile = gettemplate(ui, tmpl, None) |
|
2856 | tmpl, mapfile = gettemplate(ui, tmpl, None) | |
2853 |
|
2857 | |||
2854 | t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) |
|
2858 | t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) | |
2855 |
|
2859 | |||
2856 | for k, v in repo.ui.configitems('committemplate'): |
|
2860 | for k, v in repo.ui.configitems('committemplate'): | |
2857 | if k != 'changeset': |
|
2861 | if k != 'changeset': | |
2858 | t.t.cache[k] = v |
|
2862 | t.t.cache[k] = v | |
2859 |
|
2863 | |||
2860 | if not extramsg: |
|
2864 | if not extramsg: | |
2861 | extramsg = '' # ensure that extramsg is string |
|
2865 | extramsg = '' # ensure that extramsg is string | |
2862 |
|
2866 | |||
2863 | ui.pushbuffer() |
|
2867 | ui.pushbuffer() | |
2864 | t.show(ctx, extramsg=extramsg) |
|
2868 | t.show(ctx, extramsg=extramsg) | |
2865 | return ui.popbuffer() |
|
2869 | return ui.popbuffer() | |
2866 |
|
2870 | |||
2867 | def hgprefix(msg): |
|
2871 | def hgprefix(msg): | |
2868 | return "\n".join(["HG: %s" % a for a in msg.split("\n") if a]) |
|
2872 | return "\n".join(["HG: %s" % a for a in msg.split("\n") if a]) | |
2869 |
|
2873 | |||
2870 | def buildcommittext(repo, ctx, subs, extramsg): |
|
2874 | def buildcommittext(repo, ctx, subs, extramsg): | |
2871 | edittext = [] |
|
2875 | edittext = [] | |
2872 | modified, added, removed = ctx.modified(), ctx.added(), ctx.removed() |
|
2876 | modified, added, removed = ctx.modified(), ctx.added(), ctx.removed() | |
2873 | if ctx.description(): |
|
2877 | if ctx.description(): | |
2874 | edittext.append(ctx.description()) |
|
2878 | edittext.append(ctx.description()) | |
2875 | edittext.append("") |
|
2879 | edittext.append("") | |
2876 | edittext.append("") # Empty line between message and comments. |
|
2880 | edittext.append("") # Empty line between message and comments. | |
2877 | edittext.append(hgprefix(_("Enter commit message." |
|
2881 | edittext.append(hgprefix(_("Enter commit message." | |
2878 | " Lines beginning with 'HG:' are removed."))) |
|
2882 | " Lines beginning with 'HG:' are removed."))) | |
2879 | edittext.append(hgprefix(extramsg)) |
|
2883 | edittext.append(hgprefix(extramsg)) | |
2880 | edittext.append("HG: --") |
|
2884 | edittext.append("HG: --") | |
2881 | edittext.append(hgprefix(_("user: %s") % ctx.user())) |
|
2885 | edittext.append(hgprefix(_("user: %s") % ctx.user())) | |
2882 | if ctx.p2(): |
|
2886 | if ctx.p2(): | |
2883 | edittext.append(hgprefix(_("branch merge"))) |
|
2887 | edittext.append(hgprefix(_("branch merge"))) | |
2884 | if ctx.branch(): |
|
2888 | if ctx.branch(): | |
2885 | edittext.append(hgprefix(_("branch '%s'") % ctx.branch())) |
|
2889 | edittext.append(hgprefix(_("branch '%s'") % ctx.branch())) | |
2886 | if bookmarks.isactivewdirparent(repo): |
|
2890 | if bookmarks.isactivewdirparent(repo): | |
2887 | edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark)) |
|
2891 | edittext.append(hgprefix(_("bookmark '%s'") % repo._activebookmark)) | |
2888 | edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs]) |
|
2892 | edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs]) | |
2889 | edittext.extend([hgprefix(_("added %s") % f) for f in added]) |
|
2893 | edittext.extend([hgprefix(_("added %s") % f) for f in added]) | |
2890 | edittext.extend([hgprefix(_("changed %s") % f) for f in modified]) |
|
2894 | edittext.extend([hgprefix(_("changed %s") % f) for f in modified]) | |
2891 | edittext.extend([hgprefix(_("removed %s") % f) for f in removed]) |
|
2895 | edittext.extend([hgprefix(_("removed %s") % f) for f in removed]) | |
2892 | if not added and not modified and not removed: |
|
2896 | if not added and not modified and not removed: | |
2893 | edittext.append(hgprefix(_("no files changed"))) |
|
2897 | edittext.append(hgprefix(_("no files changed"))) | |
2894 | edittext.append("") |
|
2898 | edittext.append("") | |
2895 |
|
2899 | |||
2896 | return "\n".join(edittext) |
|
2900 | return "\n".join(edittext) | |
2897 |
|
2901 | |||
2898 | def commitstatus(repo, node, branch, bheads=None, opts=None): |
|
2902 | def commitstatus(repo, node, branch, bheads=None, opts=None): | |
2899 | if opts is None: |
|
2903 | if opts is None: | |
2900 | opts = {} |
|
2904 | opts = {} | |
2901 | ctx = repo[node] |
|
2905 | ctx = repo[node] | |
2902 | parents = ctx.parents() |
|
2906 | parents = ctx.parents() | |
2903 |
|
2907 | |||
2904 | if (not opts.get('amend') and bheads and node not in bheads and not |
|
2908 | if (not opts.get('amend') and bheads and node not in bheads and not | |
2905 | [x for x in parents if x.node() in bheads and x.branch() == branch]): |
|
2909 | [x for x in parents if x.node() in bheads and x.branch() == branch]): | |
2906 | repo.ui.status(_('created new head\n')) |
|
2910 | repo.ui.status(_('created new head\n')) | |
2907 | # The message is not printed for initial roots. For the other |
|
2911 | # The message is not printed for initial roots. For the other | |
2908 | # changesets, it is printed in the following situations: |
|
2912 | # changesets, it is printed in the following situations: | |
2909 | # |
|
2913 | # | |
2910 | # Par column: for the 2 parents with ... |
|
2914 | # Par column: for the 2 parents with ... | |
2911 | # N: null or no parent |
|
2915 | # N: null or no parent | |
2912 | # B: parent is on another named branch |
|
2916 | # B: parent is on another named branch | |
2913 | # C: parent is a regular non head changeset |
|
2917 | # C: parent is a regular non head changeset | |
2914 | # H: parent was a branch head of the current branch |
|
2918 | # H: parent was a branch head of the current branch | |
2915 | # Msg column: whether we print "created new head" message |
|
2919 | # Msg column: whether we print "created new head" message | |
2916 | # In the following, it is assumed that there already exists some |
|
2920 | # In the following, it is assumed that there already exists some | |
2917 | # initial branch heads of the current branch, otherwise nothing is |
|
2921 | # initial branch heads of the current branch, otherwise nothing is | |
2918 | # printed anyway. |
|
2922 | # printed anyway. | |
2919 | # |
|
2923 | # | |
2920 | # Par Msg Comment |
|
2924 | # Par Msg Comment | |
2921 | # N N y additional topo root |
|
2925 | # N N y additional topo root | |
2922 | # |
|
2926 | # | |
2923 | # B N y additional branch root |
|
2927 | # B N y additional branch root | |
2924 | # C N y additional topo head |
|
2928 | # C N y additional topo head | |
2925 | # H N n usual case |
|
2929 | # H N n usual case | |
2926 | # |
|
2930 | # | |
2927 | # B B y weird additional branch root |
|
2931 | # B B y weird additional branch root | |
2928 | # C B y branch merge |
|
2932 | # C B y branch merge | |
2929 | # H B n merge with named branch |
|
2933 | # H B n merge with named branch | |
2930 | # |
|
2934 | # | |
2931 | # C C y additional head from merge |
|
2935 | # C C y additional head from merge | |
2932 | # C H n merge with a head |
|
2936 | # C H n merge with a head | |
2933 | # |
|
2937 | # | |
2934 | # H H n head merge: head count decreases |
|
2938 | # H H n head merge: head count decreases | |
2935 |
|
2939 | |||
2936 | if not opts.get('close_branch'): |
|
2940 | if not opts.get('close_branch'): | |
2937 | for r in parents: |
|
2941 | for r in parents: | |
2938 | if r.closesbranch() and r.branch() == branch: |
|
2942 | if r.closesbranch() and r.branch() == branch: | |
2939 | repo.ui.status(_('reopening closed branch head %d\n') % r) |
|
2943 | repo.ui.status(_('reopening closed branch head %d\n') % r) | |
2940 |
|
2944 | |||
2941 | if repo.ui.debugflag: |
|
2945 | if repo.ui.debugflag: | |
2942 | repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex())) |
|
2946 | repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex())) | |
2943 | elif repo.ui.verbose: |
|
2947 | elif repo.ui.verbose: | |
2944 | repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx)) |
|
2948 | repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx)) | |
2945 |
|
2949 | |||
2946 | def postcommitstatus(repo, pats, opts): |
|
2950 | def postcommitstatus(repo, pats, opts): | |
2947 | return repo.status(match=scmutil.match(repo[None], pats, opts)) |
|
2951 | return repo.status(match=scmutil.match(repo[None], pats, opts)) | |
2948 |
|
2952 | |||
2949 | def revert(ui, repo, ctx, parents, *pats, **opts): |
|
2953 | def revert(ui, repo, ctx, parents, *pats, **opts): | |
2950 | parent, p2 = parents |
|
2954 | parent, p2 = parents | |
2951 | node = ctx.node() |
|
2955 | node = ctx.node() | |
2952 |
|
2956 | |||
2953 | mf = ctx.manifest() |
|
2957 | mf = ctx.manifest() | |
2954 | if node == p2: |
|
2958 | if node == p2: | |
2955 | parent = p2 |
|
2959 | parent = p2 | |
2956 |
|
2960 | |||
2957 | # need all matching names in dirstate and manifest of target rev, |
|
2961 | # need all matching names in dirstate and manifest of target rev, | |
2958 | # so have to walk both. do not print errors if files exist in one |
|
2962 | # so have to walk both. do not print errors if files exist in one | |
2959 | # but not other. in both cases, filesets should be evaluated against |
|
2963 | # but not other. in both cases, filesets should be evaluated against | |
2960 | # workingctx to get consistent result (issue4497). this means 'set:**' |
|
2964 | # workingctx to get consistent result (issue4497). this means 'set:**' | |
2961 | # cannot be used to select missing files from target rev. |
|
2965 | # cannot be used to select missing files from target rev. | |
2962 |
|
2966 | |||
2963 | # `names` is a mapping for all elements in working copy and target revision |
|
2967 | # `names` is a mapping for all elements in working copy and target revision | |
2964 | # The mapping is in the form: |
|
2968 | # The mapping is in the form: | |
2965 | # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>) |
|
2969 | # <asb path in repo> -> (<path from CWD>, <exactly specified by matcher?>) | |
2966 | names = {} |
|
2970 | names = {} | |
2967 |
|
2971 | |||
2968 | with repo.wlock(): |
|
2972 | with repo.wlock(): | |
2969 | ## filling of the `names` mapping |
|
2973 | ## filling of the `names` mapping | |
2970 | # walk dirstate to fill `names` |
|
2974 | # walk dirstate to fill `names` | |
2971 |
|
2975 | |||
2972 | interactive = opts.get('interactive', False) |
|
2976 | interactive = opts.get('interactive', False) | |
2973 | wctx = repo[None] |
|
2977 | wctx = repo[None] | |
2974 | m = scmutil.match(wctx, pats, opts) |
|
2978 | m = scmutil.match(wctx, pats, opts) | |
2975 |
|
2979 | |||
2976 | # we'll need this later |
|
2980 | # we'll need this later | |
2977 | targetsubs = sorted(s for s in wctx.substate if m(s)) |
|
2981 | targetsubs = sorted(s for s in wctx.substate if m(s)) | |
2978 |
|
2982 | |||
2979 | if not m.always(): |
|
2983 | if not m.always(): | |
2980 | for abs in repo.walk(matchmod.badmatch(m, lambda x, y: False)): |
|
2984 | for abs in repo.walk(matchmod.badmatch(m, lambda x, y: False)): | |
2981 | names[abs] = m.rel(abs), m.exact(abs) |
|
2985 | names[abs] = m.rel(abs), m.exact(abs) | |
2982 |
|
2986 | |||
2983 | # walk target manifest to fill `names` |
|
2987 | # walk target manifest to fill `names` | |
2984 |
|
2988 | |||
2985 | def badfn(path, msg): |
|
2989 | def badfn(path, msg): | |
2986 | if path in names: |
|
2990 | if path in names: | |
2987 | return |
|
2991 | return | |
2988 | if path in ctx.substate: |
|
2992 | if path in ctx.substate: | |
2989 | return |
|
2993 | return | |
2990 | path_ = path + '/' |
|
2994 | path_ = path + '/' | |
2991 | for f in names: |
|
2995 | for f in names: | |
2992 | if f.startswith(path_): |
|
2996 | if f.startswith(path_): | |
2993 | return |
|
2997 | return | |
2994 | ui.warn("%s: %s\n" % (m.rel(path), msg)) |
|
2998 | ui.warn("%s: %s\n" % (m.rel(path), msg)) | |
2995 |
|
2999 | |||
2996 | for abs in ctx.walk(matchmod.badmatch(m, badfn)): |
|
3000 | for abs in ctx.walk(matchmod.badmatch(m, badfn)): | |
2997 | if abs not in names: |
|
3001 | if abs not in names: | |
2998 | names[abs] = m.rel(abs), m.exact(abs) |
|
3002 | names[abs] = m.rel(abs), m.exact(abs) | |
2999 |
|
3003 | |||
3000 | # Find status of all file in `names`. |
|
3004 | # Find status of all file in `names`. | |
3001 | m = scmutil.matchfiles(repo, names) |
|
3005 | m = scmutil.matchfiles(repo, names) | |
3002 |
|
3006 | |||
3003 | changes = repo.status(node1=node, match=m, |
|
3007 | changes = repo.status(node1=node, match=m, | |
3004 | unknown=True, ignored=True, clean=True) |
|
3008 | unknown=True, ignored=True, clean=True) | |
3005 | else: |
|
3009 | else: | |
3006 | changes = repo.status(node1=node, match=m) |
|
3010 | changes = repo.status(node1=node, match=m) | |
3007 | for kind in changes: |
|
3011 | for kind in changes: | |
3008 | for abs in kind: |
|
3012 | for abs in kind: | |
3009 | names[abs] = m.rel(abs), m.exact(abs) |
|
3013 | names[abs] = m.rel(abs), m.exact(abs) | |
3010 |
|
3014 | |||
3011 | m = scmutil.matchfiles(repo, names) |
|
3015 | m = scmutil.matchfiles(repo, names) | |
3012 |
|
3016 | |||
3013 | modified = set(changes.modified) |
|
3017 | modified = set(changes.modified) | |
3014 | added = set(changes.added) |
|
3018 | added = set(changes.added) | |
3015 | removed = set(changes.removed) |
|
3019 | removed = set(changes.removed) | |
3016 | _deleted = set(changes.deleted) |
|
3020 | _deleted = set(changes.deleted) | |
3017 | unknown = set(changes.unknown) |
|
3021 | unknown = set(changes.unknown) | |
3018 | unknown.update(changes.ignored) |
|
3022 | unknown.update(changes.ignored) | |
3019 | clean = set(changes.clean) |
|
3023 | clean = set(changes.clean) | |
3020 | modadded = set() |
|
3024 | modadded = set() | |
3021 |
|
3025 | |||
3022 | # split between files known in target manifest and the others |
|
3026 | # split between files known in target manifest and the others | |
3023 | smf = set(mf) |
|
3027 | smf = set(mf) | |
3024 |
|
3028 | |||
3025 | # determine the exact nature of the deleted changesets |
|
3029 | # determine the exact nature of the deleted changesets | |
3026 | deladded = _deleted - smf |
|
3030 | deladded = _deleted - smf | |
3027 | deleted = _deleted - deladded |
|
3031 | deleted = _deleted - deladded | |
3028 |
|
3032 | |||
3029 | # We need to account for the state of the file in the dirstate, |
|
3033 | # We need to account for the state of the file in the dirstate, | |
3030 | # even when we revert against something else than parent. This will |
|
3034 | # even when we revert against something else than parent. This will | |
3031 | # slightly alter the behavior of revert (doing back up or not, delete |
|
3035 | # slightly alter the behavior of revert (doing back up or not, delete | |
3032 | # or just forget etc). |
|
3036 | # or just forget etc). | |
3033 | if parent == node: |
|
3037 | if parent == node: | |
3034 | dsmodified = modified |
|
3038 | dsmodified = modified | |
3035 | dsadded = added |
|
3039 | dsadded = added | |
3036 | dsremoved = removed |
|
3040 | dsremoved = removed | |
3037 | # store all local modifications, useful later for rename detection |
|
3041 | # store all local modifications, useful later for rename detection | |
3038 | localchanges = dsmodified | dsadded |
|
3042 | localchanges = dsmodified | dsadded | |
3039 | modified, added, removed = set(), set(), set() |
|
3043 | modified, added, removed = set(), set(), set() | |
3040 | else: |
|
3044 | else: | |
3041 | changes = repo.status(node1=parent, match=m) |
|
3045 | changes = repo.status(node1=parent, match=m) | |
3042 | dsmodified = set(changes.modified) |
|
3046 | dsmodified = set(changes.modified) | |
3043 | dsadded = set(changes.added) |
|
3047 | dsadded = set(changes.added) | |
3044 | dsremoved = set(changes.removed) |
|
3048 | dsremoved = set(changes.removed) | |
3045 | # store all local modifications, useful later for rename detection |
|
3049 | # store all local modifications, useful later for rename detection | |
3046 | localchanges = dsmodified | dsadded |
|
3050 | localchanges = dsmodified | dsadded | |
3047 |
|
3051 | |||
3048 | # only take into account for removes between wc and target |
|
3052 | # only take into account for removes between wc and target | |
3049 | clean |= dsremoved - removed |
|
3053 | clean |= dsremoved - removed | |
3050 | dsremoved &= removed |
|
3054 | dsremoved &= removed | |
3051 | # distinct between dirstate remove and other |
|
3055 | # distinct between dirstate remove and other | |
3052 | removed -= dsremoved |
|
3056 | removed -= dsremoved | |
3053 |
|
3057 | |||
3054 | modadded = added & dsmodified |
|
3058 | modadded = added & dsmodified | |
3055 | added -= modadded |
|
3059 | added -= modadded | |
3056 |
|
3060 | |||
3057 | # tell newly modified apart. |
|
3061 | # tell newly modified apart. | |
3058 | dsmodified &= modified |
|
3062 | dsmodified &= modified | |
3059 | dsmodified |= modified & dsadded # dirstate added may needs backup |
|
3063 | dsmodified |= modified & dsadded # dirstate added may needs backup | |
3060 | modified -= dsmodified |
|
3064 | modified -= dsmodified | |
3061 |
|
3065 | |||
3062 | # We need to wait for some post-processing to update this set |
|
3066 | # We need to wait for some post-processing to update this set | |
3063 | # before making the distinction. The dirstate will be used for |
|
3067 | # before making the distinction. The dirstate will be used for | |
3064 | # that purpose. |
|
3068 | # that purpose. | |
3065 | dsadded = added |
|
3069 | dsadded = added | |
3066 |
|
3070 | |||
3067 | # in case of merge, files that are actually added can be reported as |
|
3071 | # in case of merge, files that are actually added can be reported as | |
3068 | # modified, we need to post process the result |
|
3072 | # modified, we need to post process the result | |
3069 | if p2 != nullid: |
|
3073 | if p2 != nullid: | |
3070 | mergeadd = dsmodified - smf |
|
3074 | mergeadd = dsmodified - smf | |
3071 | dsadded |= mergeadd |
|
3075 | dsadded |= mergeadd | |
3072 | dsmodified -= mergeadd |
|
3076 | dsmodified -= mergeadd | |
3073 |
|
3077 | |||
3074 | # if f is a rename, update `names` to also revert the source |
|
3078 | # if f is a rename, update `names` to also revert the source | |
3075 | cwd = repo.getcwd() |
|
3079 | cwd = repo.getcwd() | |
3076 | for f in localchanges: |
|
3080 | for f in localchanges: | |
3077 | src = repo.dirstate.copied(f) |
|
3081 | src = repo.dirstate.copied(f) | |
3078 | # XXX should we check for rename down to target node? |
|
3082 | # XXX should we check for rename down to target node? | |
3079 | if src and src not in names and repo.dirstate[src] == 'r': |
|
3083 | if src and src not in names and repo.dirstate[src] == 'r': | |
3080 | dsremoved.add(src) |
|
3084 | dsremoved.add(src) | |
3081 | names[src] = (repo.pathto(src, cwd), True) |
|
3085 | names[src] = (repo.pathto(src, cwd), True) | |
3082 |
|
3086 | |||
3083 | # distinguish between file to forget and the other |
|
3087 | # distinguish between file to forget and the other | |
3084 | added = set() |
|
3088 | added = set() | |
3085 | for abs in dsadded: |
|
3089 | for abs in dsadded: | |
3086 | if repo.dirstate[abs] != 'a': |
|
3090 | if repo.dirstate[abs] != 'a': | |
3087 | added.add(abs) |
|
3091 | added.add(abs) | |
3088 | dsadded -= added |
|
3092 | dsadded -= added | |
3089 |
|
3093 | |||
3090 | for abs in deladded: |
|
3094 | for abs in deladded: | |
3091 | if repo.dirstate[abs] == 'a': |
|
3095 | if repo.dirstate[abs] == 'a': | |
3092 | dsadded.add(abs) |
|
3096 | dsadded.add(abs) | |
3093 | deladded -= dsadded |
|
3097 | deladded -= dsadded | |
3094 |
|
3098 | |||
3095 | # For files marked as removed, we check if an unknown file is present at |
|
3099 | # For files marked as removed, we check if an unknown file is present at | |
3096 | # the same path. If a such file exists it may need to be backed up. |
|
3100 | # the same path. If a such file exists it may need to be backed up. | |
3097 | # Making the distinction at this stage helps have simpler backup |
|
3101 | # Making the distinction at this stage helps have simpler backup | |
3098 | # logic. |
|
3102 | # logic. | |
3099 | removunk = set() |
|
3103 | removunk = set() | |
3100 | for abs in removed: |
|
3104 | for abs in removed: | |
3101 | target = repo.wjoin(abs) |
|
3105 | target = repo.wjoin(abs) | |
3102 | if os.path.lexists(target): |
|
3106 | if os.path.lexists(target): | |
3103 | removunk.add(abs) |
|
3107 | removunk.add(abs) | |
3104 | removed -= removunk |
|
3108 | removed -= removunk | |
3105 |
|
3109 | |||
3106 | dsremovunk = set() |
|
3110 | dsremovunk = set() | |
3107 | for abs in dsremoved: |
|
3111 | for abs in dsremoved: | |
3108 | target = repo.wjoin(abs) |
|
3112 | target = repo.wjoin(abs) | |
3109 | if os.path.lexists(target): |
|
3113 | if os.path.lexists(target): | |
3110 | dsremovunk.add(abs) |
|
3114 | dsremovunk.add(abs) | |
3111 | dsremoved -= dsremovunk |
|
3115 | dsremoved -= dsremovunk | |
3112 |
|
3116 | |||
3113 | # action to be actually performed by revert |
|
3117 | # action to be actually performed by revert | |
3114 | # (<list of file>, message>) tuple |
|
3118 | # (<list of file>, message>) tuple | |
3115 | actions = {'revert': ([], _('reverting %s\n')), |
|
3119 | actions = {'revert': ([], _('reverting %s\n')), | |
3116 | 'add': ([], _('adding %s\n')), |
|
3120 | 'add': ([], _('adding %s\n')), | |
3117 | 'remove': ([], _('removing %s\n')), |
|
3121 | 'remove': ([], _('removing %s\n')), | |
3118 | 'drop': ([], _('removing %s\n')), |
|
3122 | 'drop': ([], _('removing %s\n')), | |
3119 | 'forget': ([], _('forgetting %s\n')), |
|
3123 | 'forget': ([], _('forgetting %s\n')), | |
3120 | 'undelete': ([], _('undeleting %s\n')), |
|
3124 | 'undelete': ([], _('undeleting %s\n')), | |
3121 | 'noop': (None, _('no changes needed to %s\n')), |
|
3125 | 'noop': (None, _('no changes needed to %s\n')), | |
3122 | 'unknown': (None, _('file not managed: %s\n')), |
|
3126 | 'unknown': (None, _('file not managed: %s\n')), | |
3123 | } |
|
3127 | } | |
3124 |
|
3128 | |||
3125 | # "constant" that convey the backup strategy. |
|
3129 | # "constant" that convey the backup strategy. | |
3126 | # All set to `discard` if `no-backup` is set do avoid checking |
|
3130 | # All set to `discard` if `no-backup` is set do avoid checking | |
3127 | # no_backup lower in the code. |
|
3131 | # no_backup lower in the code. | |
3128 | # These values are ordered for comparison purposes |
|
3132 | # These values are ordered for comparison purposes | |
3129 | backup = 2 # unconditionally do backup |
|
3133 | backup = 2 # unconditionally do backup | |
3130 | check = 1 # check if the existing file differs from target |
|
3134 | check = 1 # check if the existing file differs from target | |
3131 | discard = 0 # never do backup |
|
3135 | discard = 0 # never do backup | |
3132 | if opts.get('no_backup'): |
|
3136 | if opts.get('no_backup'): | |
3133 | backup = check = discard |
|
3137 | backup = check = discard | |
3134 |
|
3138 | |||
3135 | backupanddel = actions['remove'] |
|
3139 | backupanddel = actions['remove'] | |
3136 | if not opts.get('no_backup'): |
|
3140 | if not opts.get('no_backup'): | |
3137 | backupanddel = actions['drop'] |
|
3141 | backupanddel = actions['drop'] | |
3138 |
|
3142 | |||
3139 | disptable = ( |
|
3143 | disptable = ( | |
3140 | # dispatch table: |
|
3144 | # dispatch table: | |
3141 | # file state |
|
3145 | # file state | |
3142 | # action |
|
3146 | # action | |
3143 | # make backup |
|
3147 | # make backup | |
3144 |
|
3148 | |||
3145 | ## Sets that results that will change file on disk |
|
3149 | ## Sets that results that will change file on disk | |
3146 | # Modified compared to target, no local change |
|
3150 | # Modified compared to target, no local change | |
3147 | (modified, actions['revert'], discard), |
|
3151 | (modified, actions['revert'], discard), | |
3148 | # Modified compared to target, but local file is deleted |
|
3152 | # Modified compared to target, but local file is deleted | |
3149 | (deleted, actions['revert'], discard), |
|
3153 | (deleted, actions['revert'], discard), | |
3150 | # Modified compared to target, local change |
|
3154 | # Modified compared to target, local change | |
3151 | (dsmodified, actions['revert'], backup), |
|
3155 | (dsmodified, actions['revert'], backup), | |
3152 | # Added since target |
|
3156 | # Added since target | |
3153 | (added, actions['remove'], discard), |
|
3157 | (added, actions['remove'], discard), | |
3154 | # Added in working directory |
|
3158 | # Added in working directory | |
3155 | (dsadded, actions['forget'], discard), |
|
3159 | (dsadded, actions['forget'], discard), | |
3156 | # Added since target, have local modification |
|
3160 | # Added since target, have local modification | |
3157 | (modadded, backupanddel, backup), |
|
3161 | (modadded, backupanddel, backup), | |
3158 | # Added since target but file is missing in working directory |
|
3162 | # Added since target but file is missing in working directory | |
3159 | (deladded, actions['drop'], discard), |
|
3163 | (deladded, actions['drop'], discard), | |
3160 | # Removed since target, before working copy parent |
|
3164 | # Removed since target, before working copy parent | |
3161 | (removed, actions['add'], discard), |
|
3165 | (removed, actions['add'], discard), | |
3162 | # Same as `removed` but an unknown file exists at the same path |
|
3166 | # Same as `removed` but an unknown file exists at the same path | |
3163 | (removunk, actions['add'], check), |
|
3167 | (removunk, actions['add'], check), | |
3164 | # Removed since targe, marked as such in working copy parent |
|
3168 | # Removed since targe, marked as such in working copy parent | |
3165 | (dsremoved, actions['undelete'], discard), |
|
3169 | (dsremoved, actions['undelete'], discard), | |
3166 | # Same as `dsremoved` but an unknown file exists at the same path |
|
3170 | # Same as `dsremoved` but an unknown file exists at the same path | |
3167 | (dsremovunk, actions['undelete'], check), |
|
3171 | (dsremovunk, actions['undelete'], check), | |
3168 | ## the following sets does not result in any file changes |
|
3172 | ## the following sets does not result in any file changes | |
3169 | # File with no modification |
|
3173 | # File with no modification | |
3170 | (clean, actions['noop'], discard), |
|
3174 | (clean, actions['noop'], discard), | |
3171 | # Existing file, not tracked anywhere |
|
3175 | # Existing file, not tracked anywhere | |
3172 | (unknown, actions['unknown'], discard), |
|
3176 | (unknown, actions['unknown'], discard), | |
3173 | ) |
|
3177 | ) | |
3174 |
|
3178 | |||
3175 | for abs, (rel, exact) in sorted(names.items()): |
|
3179 | for abs, (rel, exact) in sorted(names.items()): | |
3176 | # target file to be touch on disk (relative to cwd) |
|
3180 | # target file to be touch on disk (relative to cwd) | |
3177 | target = repo.wjoin(abs) |
|
3181 | target = repo.wjoin(abs) | |
3178 | # search the entry in the dispatch table. |
|
3182 | # search the entry in the dispatch table. | |
3179 | # if the file is in any of these sets, it was touched in the working |
|
3183 | # if the file is in any of these sets, it was touched in the working | |
3180 | # directory parent and we are sure it needs to be reverted. |
|
3184 | # directory parent and we are sure it needs to be reverted. | |
3181 | for table, (xlist, msg), dobackup in disptable: |
|
3185 | for table, (xlist, msg), dobackup in disptable: | |
3182 | if abs not in table: |
|
3186 | if abs not in table: | |
3183 | continue |
|
3187 | continue | |
3184 | if xlist is not None: |
|
3188 | if xlist is not None: | |
3185 | xlist.append(abs) |
|
3189 | xlist.append(abs) | |
3186 | if dobackup and (backup <= dobackup |
|
3190 | if dobackup and (backup <= dobackup | |
3187 | or wctx[abs].cmp(ctx[abs])): |
|
3191 | or wctx[abs].cmp(ctx[abs])): | |
3188 | bakname = scmutil.origpath(ui, repo, rel) |
|
3192 | bakname = scmutil.origpath(ui, repo, rel) | |
3189 | ui.note(_('saving current version of %s as %s\n') % |
|
3193 | ui.note(_('saving current version of %s as %s\n') % | |
3190 | (rel, bakname)) |
|
3194 | (rel, bakname)) | |
3191 | if not opts.get('dry_run'): |
|
3195 | if not opts.get('dry_run'): | |
3192 | if interactive: |
|
3196 | if interactive: | |
3193 | util.copyfile(target, bakname) |
|
3197 | util.copyfile(target, bakname) | |
3194 | else: |
|
3198 | else: | |
3195 | util.rename(target, bakname) |
|
3199 | util.rename(target, bakname) | |
3196 | if ui.verbose or not exact: |
|
3200 | if ui.verbose or not exact: | |
3197 | if not isinstance(msg, basestring): |
|
3201 | if not isinstance(msg, basestring): | |
3198 | msg = msg(abs) |
|
3202 | msg = msg(abs) | |
3199 | ui.status(msg % rel) |
|
3203 | ui.status(msg % rel) | |
3200 | elif exact: |
|
3204 | elif exact: | |
3201 | ui.warn(msg % rel) |
|
3205 | ui.warn(msg % rel) | |
3202 | break |
|
3206 | break | |
3203 |
|
3207 | |||
3204 | if not opts.get('dry_run'): |
|
3208 | if not opts.get('dry_run'): | |
3205 | needdata = ('revert', 'add', 'undelete') |
|
3209 | needdata = ('revert', 'add', 'undelete') | |
3206 | _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) |
|
3210 | _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) | |
3207 | _performrevert(repo, parents, ctx, actions, interactive) |
|
3211 | _performrevert(repo, parents, ctx, actions, interactive) | |
3208 |
|
3212 | |||
3209 | if targetsubs: |
|
3213 | if targetsubs: | |
3210 | # Revert the subrepos on the revert list |
|
3214 | # Revert the subrepos on the revert list | |
3211 | for sub in targetsubs: |
|
3215 | for sub in targetsubs: | |
3212 | try: |
|
3216 | try: | |
3213 | wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) |
|
3217 | wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) | |
3214 | except KeyError: |
|
3218 | except KeyError: | |
3215 | raise error.Abort("subrepository '%s' does not exist in %s!" |
|
3219 | raise error.Abort("subrepository '%s' does not exist in %s!" | |
3216 | % (sub, short(ctx.node()))) |
|
3220 | % (sub, short(ctx.node()))) | |
3217 |
|
3221 | |||
3218 | def _revertprefetch(repo, ctx, *files): |
|
3222 | def _revertprefetch(repo, ctx, *files): | |
3219 | """Let extension changing the storage layer prefetch content""" |
|
3223 | """Let extension changing the storage layer prefetch content""" | |
3220 | pass |
|
3224 | pass | |
3221 |
|
3225 | |||
3222 | def _performrevert(repo, parents, ctx, actions, interactive=False): |
|
3226 | def _performrevert(repo, parents, ctx, actions, interactive=False): | |
3223 | """function that actually perform all the actions computed for revert |
|
3227 | """function that actually perform all the actions computed for revert | |
3224 |
|
3228 | |||
3225 | This is an independent function to let extension to plug in and react to |
|
3229 | This is an independent function to let extension to plug in and react to | |
3226 | the imminent revert. |
|
3230 | the imminent revert. | |
3227 |
|
3231 | |||
3228 | Make sure you have the working directory locked when calling this function. |
|
3232 | Make sure you have the working directory locked when calling this function. | |
3229 | """ |
|
3233 | """ | |
3230 | parent, p2 = parents |
|
3234 | parent, p2 = parents | |
3231 | node = ctx.node() |
|
3235 | node = ctx.node() | |
3232 | excluded_files = [] |
|
3236 | excluded_files = [] | |
3233 | matcher_opts = {"exclude": excluded_files} |
|
3237 | matcher_opts = {"exclude": excluded_files} | |
3234 |
|
3238 | |||
3235 | def checkout(f): |
|
3239 | def checkout(f): | |
3236 | fc = ctx[f] |
|
3240 | fc = ctx[f] | |
3237 | repo.wwrite(f, fc.data(), fc.flags()) |
|
3241 | repo.wwrite(f, fc.data(), fc.flags()) | |
3238 |
|
3242 | |||
3239 | audit_path = pathutil.pathauditor(repo.root) |
|
3243 | audit_path = pathutil.pathauditor(repo.root) | |
3240 | for f in actions['forget'][0]: |
|
3244 | for f in actions['forget'][0]: | |
3241 | if interactive: |
|
3245 | if interactive: | |
3242 | choice = \ |
|
3246 | choice = \ | |
3243 | repo.ui.promptchoice( |
|
3247 | repo.ui.promptchoice( | |
3244 | _("forget added file %s (yn)?$$ &Yes $$ &No") |
|
3248 | _("forget added file %s (yn)?$$ &Yes $$ &No") | |
3245 | % f) |
|
3249 | % f) | |
3246 | if choice == 0: |
|
3250 | if choice == 0: | |
3247 | repo.dirstate.drop(f) |
|
3251 | repo.dirstate.drop(f) | |
3248 | else: |
|
3252 | else: | |
3249 | excluded_files.append(repo.wjoin(f)) |
|
3253 | excluded_files.append(repo.wjoin(f)) | |
3250 | else: |
|
3254 | else: | |
3251 | repo.dirstate.drop(f) |
|
3255 | repo.dirstate.drop(f) | |
3252 | for f in actions['remove'][0]: |
|
3256 | for f in actions['remove'][0]: | |
3253 | audit_path(f) |
|
3257 | audit_path(f) | |
3254 | try: |
|
3258 | try: | |
3255 | util.unlinkpath(repo.wjoin(f)) |
|
3259 | util.unlinkpath(repo.wjoin(f)) | |
3256 | except OSError: |
|
3260 | except OSError: | |
3257 | pass |
|
3261 | pass | |
3258 | repo.dirstate.remove(f) |
|
3262 | repo.dirstate.remove(f) | |
3259 | for f in actions['drop'][0]: |
|
3263 | for f in actions['drop'][0]: | |
3260 | audit_path(f) |
|
3264 | audit_path(f) | |
3261 | repo.dirstate.remove(f) |
|
3265 | repo.dirstate.remove(f) | |
3262 |
|
3266 | |||
3263 | normal = None |
|
3267 | normal = None | |
3264 | if node == parent: |
|
3268 | if node == parent: | |
3265 | # We're reverting to our parent. If possible, we'd like status |
|
3269 | # We're reverting to our parent. If possible, we'd like status | |
3266 | # to report the file as clean. We have to use normallookup for |
|
3270 | # to report the file as clean. We have to use normallookup for | |
3267 | # merges to avoid losing information about merged/dirty files. |
|
3271 | # merges to avoid losing information about merged/dirty files. | |
3268 | if p2 != nullid: |
|
3272 | if p2 != nullid: | |
3269 | normal = repo.dirstate.normallookup |
|
3273 | normal = repo.dirstate.normallookup | |
3270 | else: |
|
3274 | else: | |
3271 | normal = repo.dirstate.normal |
|
3275 | normal = repo.dirstate.normal | |
3272 |
|
3276 | |||
3273 | newlyaddedandmodifiedfiles = set() |
|
3277 | newlyaddedandmodifiedfiles = set() | |
3274 | if interactive: |
|
3278 | if interactive: | |
3275 | # Prompt the user for changes to revert |
|
3279 | # Prompt the user for changes to revert | |
3276 | torevert = [repo.wjoin(f) for f in actions['revert'][0]] |
|
3280 | torevert = [repo.wjoin(f) for f in actions['revert'][0]] | |
3277 | m = scmutil.match(ctx, torevert, matcher_opts) |
|
3281 | m = scmutil.match(ctx, torevert, matcher_opts) | |
3278 | diffopts = patch.difffeatureopts(repo.ui, whitespace=True) |
|
3282 | diffopts = patch.difffeatureopts(repo.ui, whitespace=True) | |
3279 | diffopts.nodates = True |
|
3283 | diffopts.nodates = True | |
3280 | diffopts.git = True |
|
3284 | diffopts.git = True | |
3281 | reversehunks = repo.ui.configbool('experimental', |
|
3285 | reversehunks = repo.ui.configbool('experimental', | |
3282 | 'revertalternateinteractivemode', |
|
3286 | 'revertalternateinteractivemode', | |
3283 | True) |
|
3287 | True) | |
3284 | if reversehunks: |
|
3288 | if reversehunks: | |
3285 | diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) |
|
3289 | diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts) | |
3286 | else: |
|
3290 | else: | |
3287 | diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) |
|
3291 | diff = patch.diff(repo, None, ctx.node(), m, opts=diffopts) | |
3288 | originalchunks = patch.parsepatch(diff) |
|
3292 | originalchunks = patch.parsepatch(diff) | |
3289 |
|
3293 | |||
3290 | try: |
|
3294 | try: | |
3291 |
|
3295 | |||
3292 | chunks, opts = recordfilter(repo.ui, originalchunks) |
|
3296 | chunks, opts = recordfilter(repo.ui, originalchunks) | |
3293 | if reversehunks: |
|
3297 | if reversehunks: | |
3294 | chunks = patch.reversehunks(chunks) |
|
3298 | chunks = patch.reversehunks(chunks) | |
3295 |
|
3299 | |||
3296 | except patch.PatchError as err: |
|
3300 | except patch.PatchError as err: | |
3297 | raise error.Abort(_('error parsing patch: %s') % err) |
|
3301 | raise error.Abort(_('error parsing patch: %s') % err) | |
3298 |
|
3302 | |||
3299 | newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) |
|
3303 | newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) | |
3300 | # Apply changes |
|
3304 | # Apply changes | |
3301 | fp = stringio() |
|
3305 | fp = stringio() | |
3302 | for c in chunks: |
|
3306 | for c in chunks: | |
3303 | c.write(fp) |
|
3307 | c.write(fp) | |
3304 | dopatch = fp.tell() |
|
3308 | dopatch = fp.tell() | |
3305 | fp.seek(0) |
|
3309 | fp.seek(0) | |
3306 | if dopatch: |
|
3310 | if dopatch: | |
3307 | try: |
|
3311 | try: | |
3308 | patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None) |
|
3312 | patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None) | |
3309 | except patch.PatchError as err: |
|
3313 | except patch.PatchError as err: | |
3310 | raise error.Abort(str(err)) |
|
3314 | raise error.Abort(str(err)) | |
3311 | del fp |
|
3315 | del fp | |
3312 | else: |
|
3316 | else: | |
3313 | for f in actions['revert'][0]: |
|
3317 | for f in actions['revert'][0]: | |
3314 | checkout(f) |
|
3318 | checkout(f) | |
3315 | if normal: |
|
3319 | if normal: | |
3316 | normal(f) |
|
3320 | normal(f) | |
3317 |
|
3321 | |||
3318 | for f in actions['add'][0]: |
|
3322 | for f in actions['add'][0]: | |
3319 | # Don't checkout modified files, they are already created by the diff |
|
3323 | # Don't checkout modified files, they are already created by the diff | |
3320 | if f not in newlyaddedandmodifiedfiles: |
|
3324 | if f not in newlyaddedandmodifiedfiles: | |
3321 | checkout(f) |
|
3325 | checkout(f) | |
3322 | repo.dirstate.add(f) |
|
3326 | repo.dirstate.add(f) | |
3323 |
|
3327 | |||
3324 | normal = repo.dirstate.normallookup |
|
3328 | normal = repo.dirstate.normallookup | |
3325 | if node == parent and p2 == nullid: |
|
3329 | if node == parent and p2 == nullid: | |
3326 | normal = repo.dirstate.normal |
|
3330 | normal = repo.dirstate.normal | |
3327 | for f in actions['undelete'][0]: |
|
3331 | for f in actions['undelete'][0]: | |
3328 | checkout(f) |
|
3332 | checkout(f) | |
3329 | normal(f) |
|
3333 | normal(f) | |
3330 |
|
3334 | |||
3331 | copied = copies.pathcopies(repo[parent], ctx) |
|
3335 | copied = copies.pathcopies(repo[parent], ctx) | |
3332 |
|
3336 | |||
3333 | for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]: |
|
3337 | for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]: | |
3334 | if f in copied: |
|
3338 | if f in copied: | |
3335 | repo.dirstate.copy(copied[f], f) |
|
3339 | repo.dirstate.copy(copied[f], f) | |
3336 |
|
3340 | |||
3337 | def command(table): |
|
3341 | def command(table): | |
3338 | """Returns a function object to be used as a decorator for making commands. |
|
3342 | """Returns a function object to be used as a decorator for making commands. | |
3339 |
|
3343 | |||
3340 | This function receives a command table as its argument. The table should |
|
3344 | This function receives a command table as its argument. The table should | |
3341 | be a dict. |
|
3345 | be a dict. | |
3342 |
|
3346 | |||
3343 | The returned function can be used as a decorator for adding commands |
|
3347 | The returned function can be used as a decorator for adding commands | |
3344 | to that command table. This function accepts multiple arguments to define |
|
3348 | to that command table. This function accepts multiple arguments to define | |
3345 | a command. |
|
3349 | a command. | |
3346 |
|
3350 | |||
3347 | The first argument is the command name. |
|
3351 | The first argument is the command name. | |
3348 |
|
3352 | |||
3349 | The options argument is an iterable of tuples defining command arguments. |
|
3353 | The options argument is an iterable of tuples defining command arguments. | |
3350 | See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple. |
|
3354 | See ``mercurial.fancyopts.fancyopts()`` for the format of each tuple. | |
3351 |
|
3355 | |||
3352 | The synopsis argument defines a short, one line summary of how to use the |
|
3356 | The synopsis argument defines a short, one line summary of how to use the | |
3353 | command. This shows up in the help output. |
|
3357 | command. This shows up in the help output. | |
3354 |
|
3358 | |||
3355 | The norepo argument defines whether the command does not require a |
|
3359 | The norepo argument defines whether the command does not require a | |
3356 | local repository. Most commands operate against a repository, thus the |
|
3360 | local repository. Most commands operate against a repository, thus the | |
3357 | default is False. |
|
3361 | default is False. | |
3358 |
|
3362 | |||
3359 | The optionalrepo argument defines whether the command optionally requires |
|
3363 | The optionalrepo argument defines whether the command optionally requires | |
3360 | a local repository. |
|
3364 | a local repository. | |
3361 |
|
3365 | |||
3362 | The inferrepo argument defines whether to try to find a repository from the |
|
3366 | The inferrepo argument defines whether to try to find a repository from the | |
3363 | command line arguments. If True, arguments will be examined for potential |
|
3367 | command line arguments. If True, arguments will be examined for potential | |
3364 | repository locations. See ``findrepo()``. If a repository is found, it |
|
3368 | repository locations. See ``findrepo()``. If a repository is found, it | |
3365 | will be used. |
|
3369 | will be used. | |
3366 | """ |
|
3370 | """ | |
3367 | def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False, |
|
3371 | def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False, | |
3368 | inferrepo=False): |
|
3372 | inferrepo=False): | |
3369 | def decorator(func): |
|
3373 | def decorator(func): | |
3370 | func.norepo = norepo |
|
3374 | func.norepo = norepo | |
3371 | func.optionalrepo = optionalrepo |
|
3375 | func.optionalrepo = optionalrepo | |
3372 | func.inferrepo = inferrepo |
|
3376 | func.inferrepo = inferrepo | |
3373 | if synopsis: |
|
3377 | if synopsis: | |
3374 | table[name] = func, list(options), synopsis |
|
3378 | table[name] = func, list(options), synopsis | |
3375 | else: |
|
3379 | else: | |
3376 | table[name] = func, list(options) |
|
3380 | table[name] = func, list(options) | |
3377 | return func |
|
3381 | return func | |
3378 | return decorator |
|
3382 | return decorator | |
3379 |
|
3383 | |||
3380 | return cmd |
|
3384 | return cmd | |
3381 |
|
3385 | |||
3382 | # a list of (ui, repo, otherpeer, opts, missing) functions called by |
|
3386 | # a list of (ui, repo, otherpeer, opts, missing) functions called by | |
3383 | # commands.outgoing. "missing" is "missing" of the result of |
|
3387 | # commands.outgoing. "missing" is "missing" of the result of | |
3384 | # "findcommonoutgoing()" |
|
3388 | # "findcommonoutgoing()" | |
3385 | outgoinghooks = util.hooks() |
|
3389 | outgoinghooks = util.hooks() | |
3386 |
|
3390 | |||
3387 | # a list of (ui, repo) functions called by commands.summary |
|
3391 | # a list of (ui, repo) functions called by commands.summary | |
3388 | summaryhooks = util.hooks() |
|
3392 | summaryhooks = util.hooks() | |
3389 |
|
3393 | |||
3390 | # a list of (ui, repo, opts, changes) functions called by commands.summary. |
|
3394 | # a list of (ui, repo, opts, changes) functions called by commands.summary. | |
3391 | # |
|
3395 | # | |
3392 | # functions should return tuple of booleans below, if 'changes' is None: |
|
3396 | # functions should return tuple of booleans below, if 'changes' is None: | |
3393 | # (whether-incomings-are-needed, whether-outgoings-are-needed) |
|
3397 | # (whether-incomings-are-needed, whether-outgoings-are-needed) | |
3394 | # |
|
3398 | # | |
3395 | # otherwise, 'changes' is a tuple of tuples below: |
|
3399 | # otherwise, 'changes' is a tuple of tuples below: | |
3396 | # - (sourceurl, sourcebranch, sourcepeer, incoming) |
|
3400 | # - (sourceurl, sourcebranch, sourcepeer, incoming) | |
3397 | # - (desturl, destbranch, destpeer, outgoing) |
|
3401 | # - (desturl, destbranch, destpeer, outgoing) | |
3398 | summaryremotehooks = util.hooks() |
|
3402 | summaryremotehooks = util.hooks() | |
3399 |
|
3403 | |||
3400 | # A list of state files kept by multistep operations like graft. |
|
3404 | # A list of state files kept by multistep operations like graft. | |
3401 | # Since graft cannot be aborted, it is considered 'clearable' by update. |
|
3405 | # Since graft cannot be aborted, it is considered 'clearable' by update. | |
3402 | # note: bisect is intentionally excluded |
|
3406 | # note: bisect is intentionally excluded | |
3403 | # (state file, clearable, allowcommit, error, hint) |
|
3407 | # (state file, clearable, allowcommit, error, hint) | |
3404 | unfinishedstates = [ |
|
3408 | unfinishedstates = [ | |
3405 | ('graftstate', True, False, _('graft in progress'), |
|
3409 | ('graftstate', True, False, _('graft in progress'), | |
3406 | _("use 'hg graft --continue' or 'hg update' to abort")), |
|
3410 | _("use 'hg graft --continue' or 'hg update' to abort")), | |
3407 | ('updatestate', True, False, _('last update was interrupted'), |
|
3411 | ('updatestate', True, False, _('last update was interrupted'), | |
3408 | _("use 'hg update' to get a consistent checkout")) |
|
3412 | _("use 'hg update' to get a consistent checkout")) | |
3409 | ] |
|
3413 | ] | |
3410 |
|
3414 | |||
3411 | def checkunfinished(repo, commit=False): |
|
3415 | def checkunfinished(repo, commit=False): | |
3412 | '''Look for an unfinished multistep operation, like graft, and abort |
|
3416 | '''Look for an unfinished multistep operation, like graft, and abort | |
3413 | if found. It's probably good to check this right before |
|
3417 | if found. It's probably good to check this right before | |
3414 | bailifchanged(). |
|
3418 | bailifchanged(). | |
3415 | ''' |
|
3419 | ''' | |
3416 | for f, clearable, allowcommit, msg, hint in unfinishedstates: |
|
3420 | for f, clearable, allowcommit, msg, hint in unfinishedstates: | |
3417 | if commit and allowcommit: |
|
3421 | if commit and allowcommit: | |
3418 | continue |
|
3422 | continue | |
3419 | if repo.vfs.exists(f): |
|
3423 | if repo.vfs.exists(f): | |
3420 | raise error.Abort(msg, hint=hint) |
|
3424 | raise error.Abort(msg, hint=hint) | |
3421 |
|
3425 | |||
3422 | def clearunfinished(repo): |
|
3426 | def clearunfinished(repo): | |
3423 | '''Check for unfinished operations (as above), and clear the ones |
|
3427 | '''Check for unfinished operations (as above), and clear the ones | |
3424 | that are clearable. |
|
3428 | that are clearable. | |
3425 | ''' |
|
3429 | ''' | |
3426 | for f, clearable, allowcommit, msg, hint in unfinishedstates: |
|
3430 | for f, clearable, allowcommit, msg, hint in unfinishedstates: | |
3427 | if not clearable and repo.vfs.exists(f): |
|
3431 | if not clearable and repo.vfs.exists(f): | |
3428 | raise error.Abort(msg, hint=hint) |
|
3432 | raise error.Abort(msg, hint=hint) | |
3429 | for f, clearable, allowcommit, msg, hint in unfinishedstates: |
|
3433 | for f, clearable, allowcommit, msg, hint in unfinishedstates: | |
3430 | if clearable and repo.vfs.exists(f): |
|
3434 | if clearable and repo.vfs.exists(f): | |
3431 | util.unlink(repo.join(f)) |
|
3435 | util.unlink(repo.join(f)) | |
3432 |
|
3436 | |||
3433 | afterresolvedstates = [ |
|
3437 | afterresolvedstates = [ | |
3434 | ('graftstate', |
|
3438 | ('graftstate', | |
3435 | _('hg graft --continue')), |
|
3439 | _('hg graft --continue')), | |
3436 | ] |
|
3440 | ] | |
3437 |
|
3441 | |||
3438 | def howtocontinue(repo): |
|
3442 | def howtocontinue(repo): | |
3439 | '''Check for an unfinished operation and return the command to finish |
|
3443 | '''Check for an unfinished operation and return the command to finish | |
3440 | it. |
|
3444 | it. | |
3441 |
|
3445 | |||
3442 | afterresolvedstates tupples define a .hg/{file} and the corresponding |
|
3446 | afterresolvedstates tupples define a .hg/{file} and the corresponding | |
3443 | command needed to finish it. |
|
3447 | command needed to finish it. | |
3444 |
|
3448 | |||
3445 | Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is |
|
3449 | Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is | |
3446 | a boolean. |
|
3450 | a boolean. | |
3447 | ''' |
|
3451 | ''' | |
3448 | contmsg = _("continue: %s") |
|
3452 | contmsg = _("continue: %s") | |
3449 | for f, msg in afterresolvedstates: |
|
3453 | for f, msg in afterresolvedstates: | |
3450 | if repo.vfs.exists(f): |
|
3454 | if repo.vfs.exists(f): | |
3451 | return contmsg % msg, True |
|
3455 | return contmsg % msg, True | |
3452 | workingctx = repo[None] |
|
3456 | workingctx = repo[None] | |
3453 | dirty = any(repo.status()) or any(workingctx.sub(s).dirty() |
|
3457 | dirty = any(repo.status()) or any(workingctx.sub(s).dirty() | |
3454 | for s in workingctx.substate) |
|
3458 | for s in workingctx.substate) | |
3455 | if dirty: |
|
3459 | if dirty: | |
3456 | return contmsg % _("hg commit"), False |
|
3460 | return contmsg % _("hg commit"), False | |
3457 | return None, None |
|
3461 | return None, None | |
3458 |
|
3462 | |||
3459 | def checkafterresolved(repo): |
|
3463 | def checkafterresolved(repo): | |
3460 | '''Inform the user about the next action after completing hg resolve |
|
3464 | '''Inform the user about the next action after completing hg resolve | |
3461 |
|
3465 | |||
3462 | If there's a matching afterresolvedstates, howtocontinue will yield |
|
3466 | If there's a matching afterresolvedstates, howtocontinue will yield | |
3463 | repo.ui.warn as the reporter. |
|
3467 | repo.ui.warn as the reporter. | |
3464 |
|
3468 | |||
3465 | Otherwise, it will yield repo.ui.note. |
|
3469 | Otherwise, it will yield repo.ui.note. | |
3466 | ''' |
|
3470 | ''' | |
3467 | msg, warning = howtocontinue(repo) |
|
3471 | msg, warning = howtocontinue(repo) | |
3468 | if msg is not None: |
|
3472 | if msg is not None: | |
3469 | if warning: |
|
3473 | if warning: | |
3470 | repo.ui.warn("%s\n" % msg) |
|
3474 | repo.ui.warn("%s\n" % msg) | |
3471 | else: |
|
3475 | else: | |
3472 | repo.ui.note("%s\n" % msg) |
|
3476 | repo.ui.note("%s\n" % msg) | |
3473 |
|
3477 | |||
3474 | def wrongtooltocontinue(repo, task): |
|
3478 | def wrongtooltocontinue(repo, task): | |
3475 | '''Raise an abort suggesting how to properly continue if there is an |
|
3479 | '''Raise an abort suggesting how to properly continue if there is an | |
3476 | active task. |
|
3480 | active task. | |
3477 |
|
3481 | |||
3478 | Uses howtocontinue() to find the active task. |
|
3482 | Uses howtocontinue() to find the active task. | |
3479 |
|
3483 | |||
3480 | If there's no task (repo.ui.note for 'hg commit'), it does not offer |
|
3484 | If there's no task (repo.ui.note for 'hg commit'), it does not offer | |
3481 | a hint. |
|
3485 | a hint. | |
3482 | ''' |
|
3486 | ''' | |
3483 | after = howtocontinue(repo) |
|
3487 | after = howtocontinue(repo) | |
3484 | hint = None |
|
3488 | hint = None | |
3485 | if after[1]: |
|
3489 | if after[1]: | |
3486 | hint = after[0] |
|
3490 | hint = after[0] | |
3487 | raise error.Abort(_('no %s in progress') % task, hint=hint) |
|
3491 | raise error.Abort(_('no %s in progress') % task, hint=hint) | |
3488 |
|
3492 | |||
3489 | class dirstateguard(object): |
|
3493 | class dirstateguard(object): | |
3490 | '''Restore dirstate at unexpected failure. |
|
3494 | '''Restore dirstate at unexpected failure. | |
3491 |
|
3495 | |||
3492 | At the construction, this class does: |
|
3496 | At the construction, this class does: | |
3493 |
|
3497 | |||
3494 | - write current ``repo.dirstate`` out, and |
|
3498 | - write current ``repo.dirstate`` out, and | |
3495 | - save ``.hg/dirstate`` into the backup file |
|
3499 | - save ``.hg/dirstate`` into the backup file | |
3496 |
|
3500 | |||
3497 | This restores ``.hg/dirstate`` from backup file, if ``release()`` |
|
3501 | This restores ``.hg/dirstate`` from backup file, if ``release()`` | |
3498 | is invoked before ``close()``. |
|
3502 | is invoked before ``close()``. | |
3499 |
|
3503 | |||
3500 | This just removes the backup file at ``close()`` before ``release()``. |
|
3504 | This just removes the backup file at ``close()`` before ``release()``. | |
3501 | ''' |
|
3505 | ''' | |
3502 |
|
3506 | |||
3503 | def __init__(self, repo, name): |
|
3507 | def __init__(self, repo, name): | |
3504 | self._repo = repo |
|
3508 | self._repo = repo | |
3505 | self._suffix = '.backup.%s.%d' % (name, id(self)) |
|
3509 | self._suffix = '.backup.%s.%d' % (name, id(self)) | |
3506 | repo.dirstate._savebackup(repo.currenttransaction(), self._suffix) |
|
3510 | repo.dirstate._savebackup(repo.currenttransaction(), self._suffix) | |
3507 | self._active = True |
|
3511 | self._active = True | |
3508 | self._closed = False |
|
3512 | self._closed = False | |
3509 |
|
3513 | |||
3510 | def __del__(self): |
|
3514 | def __del__(self): | |
3511 | if self._active: # still active |
|
3515 | if self._active: # still active | |
3512 | # this may occur, even if this class is used correctly: |
|
3516 | # this may occur, even if this class is used correctly: | |
3513 | # for example, releasing other resources like transaction |
|
3517 | # for example, releasing other resources like transaction | |
3514 | # may raise exception before ``dirstateguard.release`` in |
|
3518 | # may raise exception before ``dirstateguard.release`` in | |
3515 | # ``release(tr, ....)``. |
|
3519 | # ``release(tr, ....)``. | |
3516 | self._abort() |
|
3520 | self._abort() | |
3517 |
|
3521 | |||
3518 | def close(self): |
|
3522 | def close(self): | |
3519 | if not self._active: # already inactivated |
|
3523 | if not self._active: # already inactivated | |
3520 | msg = (_("can't close already inactivated backup: dirstate%s") |
|
3524 | msg = (_("can't close already inactivated backup: dirstate%s") | |
3521 | % self._suffix) |
|
3525 | % self._suffix) | |
3522 | raise error.Abort(msg) |
|
3526 | raise error.Abort(msg) | |
3523 |
|
3527 | |||
3524 | self._repo.dirstate._clearbackup(self._repo.currenttransaction(), |
|
3528 | self._repo.dirstate._clearbackup(self._repo.currenttransaction(), | |
3525 | self._suffix) |
|
3529 | self._suffix) | |
3526 | self._active = False |
|
3530 | self._active = False | |
3527 | self._closed = True |
|
3531 | self._closed = True | |
3528 |
|
3532 | |||
3529 | def _abort(self): |
|
3533 | def _abort(self): | |
3530 | self._repo.dirstate._restorebackup(self._repo.currenttransaction(), |
|
3534 | self._repo.dirstate._restorebackup(self._repo.currenttransaction(), | |
3531 | self._suffix) |
|
3535 | self._suffix) | |
3532 | self._active = False |
|
3536 | self._active = False | |
3533 |
|
3537 | |||
3534 | def release(self): |
|
3538 | def release(self): | |
3535 | if not self._closed: |
|
3539 | if not self._closed: | |
3536 | if not self._active: # already inactivated |
|
3540 | if not self._active: # already inactivated | |
3537 | msg = (_("can't release already inactivated backup:" |
|
3541 | msg = (_("can't release already inactivated backup:" | |
3538 | " dirstate%s") |
|
3542 | " dirstate%s") | |
3539 | % self._suffix) |
|
3543 | % self._suffix) | |
3540 | raise error.Abort(msg) |
|
3544 | raise error.Abort(msg) | |
3541 | self._abort() |
|
3545 | self._abort() |
@@ -1,655 +1,664 b'' | |||||
1 | # Revision graph generator for Mercurial |
|
1 | # Revision graph generator for Mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2008 Dirkjan Ochtman <dirkjan@ochtman.nl> |
|
3 | # Copyright 2008 Dirkjan Ochtman <dirkjan@ochtman.nl> | |
4 | # Copyright 2007 Joel Rosdahl <joel@rosdahl.net> |
|
4 | # Copyright 2007 Joel Rosdahl <joel@rosdahl.net> | |
5 | # |
|
5 | # | |
6 | # This software may be used and distributed according to the terms of the |
|
6 | # This software may be used and distributed according to the terms of the | |
7 | # GNU General Public License version 2 or any later version. |
|
7 | # GNU General Public License version 2 or any later version. | |
8 |
|
8 | |||
9 | """supports walking the history as DAGs suitable for graphical output |
|
9 | """supports walking the history as DAGs suitable for graphical output | |
10 |
|
10 | |||
11 | The most basic format we use is that of:: |
|
11 | The most basic format we use is that of:: | |
12 |
|
12 | |||
13 | (id, type, data, [parentids]) |
|
13 | (id, type, data, [parentids]) | |
14 |
|
14 | |||
15 | The node and parent ids are arbitrary integers which identify a node in the |
|
15 | The node and parent ids are arbitrary integers which identify a node in the | |
16 | context of the graph returned. Type is a constant specifying the node type. |
|
16 | context of the graph returned. Type is a constant specifying the node type. | |
17 | Data depends on type. |
|
17 | Data depends on type. | |
18 | """ |
|
18 | """ | |
19 |
|
19 | |||
20 | from __future__ import absolute_import |
|
20 | from __future__ import absolute_import | |
21 |
|
21 | |||
22 | import heapq |
|
22 | import heapq | |
23 |
|
23 | |||
24 | from .node import nullrev |
|
24 | from .node import nullrev | |
25 | from . import ( |
|
25 | from . import ( | |
26 | revset, |
|
26 | revset, | |
27 | util, |
|
27 | util, | |
28 | ) |
|
28 | ) | |
29 |
|
29 | |||
30 | CHANGESET = 'C' |
|
30 | CHANGESET = 'C' | |
31 | PARENT = 'P' |
|
31 | PARENT = 'P' | |
32 | GRANDPARENT = 'G' |
|
32 | GRANDPARENT = 'G' | |
33 | MISSINGPARENT = 'M' |
|
33 | MISSINGPARENT = 'M' | |
34 | # Style of line to draw. None signals a line that ends and is removed at this |
|
34 | # Style of line to draw. None signals a line that ends and is removed at this | |
35 | # point. |
|
35 | # point. | |
36 | EDGES = {PARENT: '|', GRANDPARENT: ':', MISSINGPARENT: None} |
|
36 | EDGES = {PARENT: '|', GRANDPARENT: ':', MISSINGPARENT: None} | |
37 |
|
37 | |||
38 | def groupbranchiter(revs, parentsfunc, firstbranch=()): |
|
38 | def groupbranchiter(revs, parentsfunc, firstbranch=()): | |
39 | """Yield revisions from heads to roots one (topo) branch at a time. |
|
39 | """Yield revisions from heads to roots one (topo) branch at a time. | |
40 |
|
40 | |||
41 | This function aims to be used by a graph generator that wishes to minimize |
|
41 | This function aims to be used by a graph generator that wishes to minimize | |
42 | the number of parallel branches and their interleaving. |
|
42 | the number of parallel branches and their interleaving. | |
43 |
|
43 | |||
44 | Example iteration order (numbers show the "true" order in a changelog): |
|
44 | Example iteration order (numbers show the "true" order in a changelog): | |
45 |
|
45 | |||
46 | o 4 |
|
46 | o 4 | |
47 | | |
|
47 | | | |
48 | o 1 |
|
48 | o 1 | |
49 | | |
|
49 | | | |
50 | | o 3 |
|
50 | | o 3 | |
51 | | | |
|
51 | | | | |
52 | | o 2 |
|
52 | | o 2 | |
53 | |/ |
|
53 | |/ | |
54 | o 0 |
|
54 | o 0 | |
55 |
|
55 | |||
56 | Note that the ancestors of merges are understood by the current |
|
56 | Note that the ancestors of merges are understood by the current | |
57 | algorithm to be on the same branch. This means no reordering will |
|
57 | algorithm to be on the same branch. This means no reordering will | |
58 | occur behind a merge. |
|
58 | occur behind a merge. | |
59 | """ |
|
59 | """ | |
60 |
|
60 | |||
61 | ### Quick summary of the algorithm |
|
61 | ### Quick summary of the algorithm | |
62 | # |
|
62 | # | |
63 | # This function is based around a "retention" principle. We keep revisions |
|
63 | # This function is based around a "retention" principle. We keep revisions | |
64 | # in memory until we are ready to emit a whole branch that immediately |
|
64 | # in memory until we are ready to emit a whole branch that immediately | |
65 | # "merges" into an existing one. This reduces the number of parallel |
|
65 | # "merges" into an existing one. This reduces the number of parallel | |
66 | # branches with interleaved revisions. |
|
66 | # branches with interleaved revisions. | |
67 | # |
|
67 | # | |
68 | # During iteration revs are split into two groups: |
|
68 | # During iteration revs are split into two groups: | |
69 | # A) revision already emitted |
|
69 | # A) revision already emitted | |
70 | # B) revision in "retention". They are stored as different subgroups. |
|
70 | # B) revision in "retention". They are stored as different subgroups. | |
71 | # |
|
71 | # | |
72 | # for each REV, we do the following logic: |
|
72 | # for each REV, we do the following logic: | |
73 | # |
|
73 | # | |
74 | # 1) if REV is a parent of (A), we will emit it. If there is a |
|
74 | # 1) if REV is a parent of (A), we will emit it. If there is a | |
75 | # retention group ((B) above) that is blocked on REV being |
|
75 | # retention group ((B) above) that is blocked on REV being | |
76 | # available, we emit all the revisions out of that retention |
|
76 | # available, we emit all the revisions out of that retention | |
77 | # group first. |
|
77 | # group first. | |
78 | # |
|
78 | # | |
79 | # 2) else, we'll search for a subgroup in (B) awaiting for REV to be |
|
79 | # 2) else, we'll search for a subgroup in (B) awaiting for REV to be | |
80 | # available, if such subgroup exist, we add REV to it and the subgroup is |
|
80 | # available, if such subgroup exist, we add REV to it and the subgroup is | |
81 | # now awaiting for REV.parents() to be available. |
|
81 | # now awaiting for REV.parents() to be available. | |
82 | # |
|
82 | # | |
83 | # 3) finally if no such group existed in (B), we create a new subgroup. |
|
83 | # 3) finally if no such group existed in (B), we create a new subgroup. | |
84 | # |
|
84 | # | |
85 | # |
|
85 | # | |
86 | # To bootstrap the algorithm, we emit the tipmost revision (which |
|
86 | # To bootstrap the algorithm, we emit the tipmost revision (which | |
87 | # puts it in group (A) from above). |
|
87 | # puts it in group (A) from above). | |
88 |
|
88 | |||
89 | revs.sort(reverse=True) |
|
89 | revs.sort(reverse=True) | |
90 |
|
90 | |||
91 | # Set of parents of revision that have been emitted. They can be considered |
|
91 | # Set of parents of revision that have been emitted. They can be considered | |
92 | # unblocked as the graph generator is already aware of them so there is no |
|
92 | # unblocked as the graph generator is already aware of them so there is no | |
93 | # need to delay the revisions that reference them. |
|
93 | # need to delay the revisions that reference them. | |
94 | # |
|
94 | # | |
95 | # If someone wants to prioritize a branch over the others, pre-filling this |
|
95 | # If someone wants to prioritize a branch over the others, pre-filling this | |
96 | # set will force all other branches to wait until this branch is ready to be |
|
96 | # set will force all other branches to wait until this branch is ready to be | |
97 | # emitted. |
|
97 | # emitted. | |
98 | unblocked = set(firstbranch) |
|
98 | unblocked = set(firstbranch) | |
99 |
|
99 | |||
100 | # list of groups waiting to be displayed, each group is defined by: |
|
100 | # list of groups waiting to be displayed, each group is defined by: | |
101 | # |
|
101 | # | |
102 | # (revs: lists of revs waiting to be displayed, |
|
102 | # (revs: lists of revs waiting to be displayed, | |
103 | # blocked: set of that cannot be displayed before those in 'revs') |
|
103 | # blocked: set of that cannot be displayed before those in 'revs') | |
104 | # |
|
104 | # | |
105 | # The second value ('blocked') correspond to parents of any revision in the |
|
105 | # The second value ('blocked') correspond to parents of any revision in the | |
106 | # group ('revs') that is not itself contained in the group. The main idea |
|
106 | # group ('revs') that is not itself contained in the group. The main idea | |
107 | # of this algorithm is to delay as much as possible the emission of any |
|
107 | # of this algorithm is to delay as much as possible the emission of any | |
108 | # revision. This means waiting for the moment we are about to display |
|
108 | # revision. This means waiting for the moment we are about to display | |
109 | # these parents to display the revs in a group. |
|
109 | # these parents to display the revs in a group. | |
110 | # |
|
110 | # | |
111 | # This first implementation is smart until it encounters a merge: it will |
|
111 | # This first implementation is smart until it encounters a merge: it will | |
112 | # emit revs as soon as any parent is about to be emitted and can grow an |
|
112 | # emit revs as soon as any parent is about to be emitted and can grow an | |
113 | # arbitrary number of revs in 'blocked'. In practice this mean we properly |
|
113 | # arbitrary number of revs in 'blocked'. In practice this mean we properly | |
114 | # retains new branches but gives up on any special ordering for ancestors |
|
114 | # retains new branches but gives up on any special ordering for ancestors | |
115 | # of merges. The implementation can be improved to handle this better. |
|
115 | # of merges. The implementation can be improved to handle this better. | |
116 | # |
|
116 | # | |
117 | # The first subgroup is special. It corresponds to all the revision that |
|
117 | # The first subgroup is special. It corresponds to all the revision that | |
118 | # were already emitted. The 'revs' lists is expected to be empty and the |
|
118 | # were already emitted. The 'revs' lists is expected to be empty and the | |
119 | # 'blocked' set contains the parents revisions of already emitted revision. |
|
119 | # 'blocked' set contains the parents revisions of already emitted revision. | |
120 | # |
|
120 | # | |
121 | # You could pre-seed the <parents> set of groups[0] to a specific |
|
121 | # You could pre-seed the <parents> set of groups[0] to a specific | |
122 | # changesets to select what the first emitted branch should be. |
|
122 | # changesets to select what the first emitted branch should be. | |
123 | groups = [([], unblocked)] |
|
123 | groups = [([], unblocked)] | |
124 | pendingheap = [] |
|
124 | pendingheap = [] | |
125 | pendingset = set() |
|
125 | pendingset = set() | |
126 |
|
126 | |||
127 | heapq.heapify(pendingheap) |
|
127 | heapq.heapify(pendingheap) | |
128 | heappop = heapq.heappop |
|
128 | heappop = heapq.heappop | |
129 | heappush = heapq.heappush |
|
129 | heappush = heapq.heappush | |
130 | for currentrev in revs: |
|
130 | for currentrev in revs: | |
131 | # Heap works with smallest element, we want highest so we invert |
|
131 | # Heap works with smallest element, we want highest so we invert | |
132 | if currentrev not in pendingset: |
|
132 | if currentrev not in pendingset: | |
133 | heappush(pendingheap, -currentrev) |
|
133 | heappush(pendingheap, -currentrev) | |
134 | pendingset.add(currentrev) |
|
134 | pendingset.add(currentrev) | |
135 | # iterates on pending rev until after the current rev have been |
|
135 | # iterates on pending rev until after the current rev have been | |
136 | # processed. |
|
136 | # processed. | |
137 | rev = None |
|
137 | rev = None | |
138 | while rev != currentrev: |
|
138 | while rev != currentrev: | |
139 | rev = -heappop(pendingheap) |
|
139 | rev = -heappop(pendingheap) | |
140 | pendingset.remove(rev) |
|
140 | pendingset.remove(rev) | |
141 |
|
141 | |||
142 | # Seek for a subgroup blocked, waiting for the current revision. |
|
142 | # Seek for a subgroup blocked, waiting for the current revision. | |
143 | matching = [i for i, g in enumerate(groups) if rev in g[1]] |
|
143 | matching = [i for i, g in enumerate(groups) if rev in g[1]] | |
144 |
|
144 | |||
145 | if matching: |
|
145 | if matching: | |
146 | # The main idea is to gather together all sets that are blocked |
|
146 | # The main idea is to gather together all sets that are blocked | |
147 | # on the same revision. |
|
147 | # on the same revision. | |
148 | # |
|
148 | # | |
149 | # Groups are merged when a common blocking ancestor is |
|
149 | # Groups are merged when a common blocking ancestor is | |
150 | # observed. For example, given two groups: |
|
150 | # observed. For example, given two groups: | |
151 | # |
|
151 | # | |
152 | # revs [5, 4] waiting for 1 |
|
152 | # revs [5, 4] waiting for 1 | |
153 | # revs [3, 2] waiting for 1 |
|
153 | # revs [3, 2] waiting for 1 | |
154 | # |
|
154 | # | |
155 | # These two groups will be merged when we process |
|
155 | # These two groups will be merged when we process | |
156 | # 1. In theory, we could have merged the groups when |
|
156 | # 1. In theory, we could have merged the groups when | |
157 | # we added 2 to the group it is now in (we could have |
|
157 | # we added 2 to the group it is now in (we could have | |
158 | # noticed the groups were both blocked on 1 then), but |
|
158 | # noticed the groups were both blocked on 1 then), but | |
159 | # the way it works now makes the algorithm simpler. |
|
159 | # the way it works now makes the algorithm simpler. | |
160 | # |
|
160 | # | |
161 | # We also always keep the oldest subgroup first. We can |
|
161 | # We also always keep the oldest subgroup first. We can | |
162 | # probably improve the behavior by having the longest set |
|
162 | # probably improve the behavior by having the longest set | |
163 | # first. That way, graph algorithms could minimise the length |
|
163 | # first. That way, graph algorithms could minimise the length | |
164 | # of parallel lines their drawing. This is currently not done. |
|
164 | # of parallel lines their drawing. This is currently not done. | |
165 | targetidx = matching.pop(0) |
|
165 | targetidx = matching.pop(0) | |
166 | trevs, tparents = groups[targetidx] |
|
166 | trevs, tparents = groups[targetidx] | |
167 | for i in matching: |
|
167 | for i in matching: | |
168 | gr = groups[i] |
|
168 | gr = groups[i] | |
169 | trevs.extend(gr[0]) |
|
169 | trevs.extend(gr[0]) | |
170 | tparents |= gr[1] |
|
170 | tparents |= gr[1] | |
171 | # delete all merged subgroups (except the one we kept) |
|
171 | # delete all merged subgroups (except the one we kept) | |
172 | # (starting from the last subgroup for performance and |
|
172 | # (starting from the last subgroup for performance and | |
173 | # sanity reasons) |
|
173 | # sanity reasons) | |
174 | for i in reversed(matching): |
|
174 | for i in reversed(matching): | |
175 | del groups[i] |
|
175 | del groups[i] | |
176 | else: |
|
176 | else: | |
177 | # This is a new head. We create a new subgroup for it. |
|
177 | # This is a new head. We create a new subgroup for it. | |
178 | targetidx = len(groups) |
|
178 | targetidx = len(groups) | |
179 | groups.append(([], set([rev]))) |
|
179 | groups.append(([], set([rev]))) | |
180 |
|
180 | |||
181 | gr = groups[targetidx] |
|
181 | gr = groups[targetidx] | |
182 |
|
182 | |||
183 | # We now add the current nodes to this subgroups. This is done |
|
183 | # We now add the current nodes to this subgroups. This is done | |
184 | # after the subgroup merging because all elements from a subgroup |
|
184 | # after the subgroup merging because all elements from a subgroup | |
185 | # that relied on this rev must precede it. |
|
185 | # that relied on this rev must precede it. | |
186 | # |
|
186 | # | |
187 | # we also update the <parents> set to include the parents of the |
|
187 | # we also update the <parents> set to include the parents of the | |
188 | # new nodes. |
|
188 | # new nodes. | |
189 | if rev == currentrev: # only display stuff in rev |
|
189 | if rev == currentrev: # only display stuff in rev | |
190 | gr[0].append(rev) |
|
190 | gr[0].append(rev) | |
191 | gr[1].remove(rev) |
|
191 | gr[1].remove(rev) | |
192 | parents = [p for p in parentsfunc(rev) if p > nullrev] |
|
192 | parents = [p for p in parentsfunc(rev) if p > nullrev] | |
193 | gr[1].update(parents) |
|
193 | gr[1].update(parents) | |
194 | for p in parents: |
|
194 | for p in parents: | |
195 | if p not in pendingset: |
|
195 | if p not in pendingset: | |
196 | pendingset.add(p) |
|
196 | pendingset.add(p) | |
197 | heappush(pendingheap, -p) |
|
197 | heappush(pendingheap, -p) | |
198 |
|
198 | |||
199 | # Look for a subgroup to display |
|
199 | # Look for a subgroup to display | |
200 | # |
|
200 | # | |
201 | # When unblocked is empty (if clause), we were not waiting for any |
|
201 | # When unblocked is empty (if clause), we were not waiting for any | |
202 | # revisions during the first iteration (if no priority was given) or |
|
202 | # revisions during the first iteration (if no priority was given) or | |
203 | # if we emitted a whole disconnected set of the graph (reached a |
|
203 | # if we emitted a whole disconnected set of the graph (reached a | |
204 | # root). In that case we arbitrarily take the oldest known |
|
204 | # root). In that case we arbitrarily take the oldest known | |
205 | # subgroup. The heuristic could probably be better. |
|
205 | # subgroup. The heuristic could probably be better. | |
206 | # |
|
206 | # | |
207 | # Otherwise (elif clause) if the subgroup is blocked on |
|
207 | # Otherwise (elif clause) if the subgroup is blocked on | |
208 | # a revision we just emitted, we can safely emit it as |
|
208 | # a revision we just emitted, we can safely emit it as | |
209 | # well. |
|
209 | # well. | |
210 | if not unblocked: |
|
210 | if not unblocked: | |
211 | if len(groups) > 1: # display other subset |
|
211 | if len(groups) > 1: # display other subset | |
212 | targetidx = 1 |
|
212 | targetidx = 1 | |
213 | gr = groups[1] |
|
213 | gr = groups[1] | |
214 | elif not gr[1] & unblocked: |
|
214 | elif not gr[1] & unblocked: | |
215 | gr = None |
|
215 | gr = None | |
216 |
|
216 | |||
217 | if gr is not None: |
|
217 | if gr is not None: | |
218 | # update the set of awaited revisions with the one from the |
|
218 | # update the set of awaited revisions with the one from the | |
219 | # subgroup |
|
219 | # subgroup | |
220 | unblocked |= gr[1] |
|
220 | unblocked |= gr[1] | |
221 | # output all revisions in the subgroup |
|
221 | # output all revisions in the subgroup | |
222 | for r in gr[0]: |
|
222 | for r in gr[0]: | |
223 | yield r |
|
223 | yield r | |
224 | # delete the subgroup that you just output |
|
224 | # delete the subgroup that you just output | |
225 | # unless it is groups[0] in which case you just empty it. |
|
225 | # unless it is groups[0] in which case you just empty it. | |
226 | if targetidx: |
|
226 | if targetidx: | |
227 | del groups[targetidx] |
|
227 | del groups[targetidx] | |
228 | else: |
|
228 | else: | |
229 | gr[0][:] = [] |
|
229 | gr[0][:] = [] | |
230 | # Check if we have some subgroup waiting for revisions we are not going to |
|
230 | # Check if we have some subgroup waiting for revisions we are not going to | |
231 | # iterate over |
|
231 | # iterate over | |
232 | for g in groups: |
|
232 | for g in groups: | |
233 | for r in g[0]: |
|
233 | for r in g[0]: | |
234 | yield r |
|
234 | yield r | |
235 |
|
235 | |||
236 | def dagwalker(repo, revs): |
|
236 | def dagwalker(repo, revs): | |
237 | """cset DAG generator yielding (id, CHANGESET, ctx, [parentinfo]) tuples |
|
237 | """cset DAG generator yielding (id, CHANGESET, ctx, [parentinfo]) tuples | |
238 |
|
238 | |||
239 | This generator function walks through revisions (which should be ordered |
|
239 | This generator function walks through revisions (which should be ordered | |
240 | from bigger to lower). It returns a tuple for each node. |
|
240 | from bigger to lower). It returns a tuple for each node. | |
241 |
|
241 | |||
242 | Each parentinfo entry is a tuple with (edgetype, parentid), where edgetype |
|
242 | Each parentinfo entry is a tuple with (edgetype, parentid), where edgetype | |
243 | is one of PARENT, GRANDPARENT or MISSINGPARENT. The node and parent ids |
|
243 | is one of PARENT, GRANDPARENT or MISSINGPARENT. The node and parent ids | |
244 | are arbitrary integers which identify a node in the context of the graph |
|
244 | are arbitrary integers which identify a node in the context of the graph | |
245 | returned. |
|
245 | returned. | |
246 |
|
246 | |||
247 | """ |
|
247 | """ | |
248 | if not revs: |
|
248 | if not revs: | |
249 | return |
|
249 | return | |
250 |
|
250 | |||
251 | gpcache = {} |
|
251 | gpcache = {} | |
252 |
|
252 | |||
253 | if repo.ui.configbool('experimental', 'graph-group-branches', False): |
|
253 | if repo.ui.configbool('experimental', 'graph-group-branches', False): | |
254 | firstbranch = () |
|
254 | firstbranch = () | |
255 | firstbranchrevset = repo.ui.config( |
|
255 | firstbranchrevset = repo.ui.config( | |
256 | 'experimental', 'graph-group-branches.firstbranch', '') |
|
256 | 'experimental', 'graph-group-branches.firstbranch', '') | |
257 | if firstbranchrevset: |
|
257 | if firstbranchrevset: | |
258 | firstbranch = repo.revs(firstbranchrevset) |
|
258 | firstbranch = repo.revs(firstbranchrevset) | |
259 | parentrevs = repo.changelog.parentrevs |
|
259 | parentrevs = repo.changelog.parentrevs | |
260 | revs = groupbranchiter(revs, parentrevs, firstbranch) |
|
260 | revs = groupbranchiter(revs, parentrevs, firstbranch) | |
261 | revs = revset.baseset(revs) |
|
261 | revs = revset.baseset(revs) | |
262 |
|
262 | |||
263 | for rev in revs: |
|
263 | for rev in revs: | |
264 | ctx = repo[rev] |
|
264 | ctx = repo[rev] | |
265 | # partition into parents in the rev set and missing parents, then |
|
265 | # partition into parents in the rev set and missing parents, then | |
266 | # augment the lists with markers, to inform graph drawing code about |
|
266 | # augment the lists with markers, to inform graph drawing code about | |
267 | # what kind of edge to draw between nodes. |
|
267 | # what kind of edge to draw between nodes. | |
268 | pset = set(p.rev() for p in ctx.parents() if p.rev() in revs) |
|
268 | pset = set(p.rev() for p in ctx.parents() if p.rev() in revs) | |
269 | mpars = [p.rev() for p in ctx.parents() |
|
269 | mpars = [p.rev() for p in ctx.parents() | |
270 | if p.rev() != nullrev and p.rev() not in pset] |
|
270 | if p.rev() != nullrev and p.rev() not in pset] | |
271 | parents = [(PARENT, p) for p in sorted(pset)] |
|
271 | parents = [(PARENT, p) for p in sorted(pset)] | |
272 |
|
272 | |||
273 | for mpar in mpars: |
|
273 | for mpar in mpars: | |
274 | gp = gpcache.get(mpar) |
|
274 | gp = gpcache.get(mpar) | |
275 | if gp is None: |
|
275 | if gp is None: | |
276 | # precompute slow query as we know reachableroots() goes |
|
276 | # precompute slow query as we know reachableroots() goes | |
277 | # through all revs (issue4782) |
|
277 | # through all revs (issue4782) | |
278 | if not isinstance(revs, revset.baseset): |
|
278 | if not isinstance(revs, revset.baseset): | |
279 | revs = revset.baseset(revs) |
|
279 | revs = revset.baseset(revs) | |
280 | gp = gpcache[mpar] = sorted(set(revset.reachableroots( |
|
280 | gp = gpcache[mpar] = sorted(set(revset.reachableroots( | |
281 | repo, revs, [mpar]))) |
|
281 | repo, revs, [mpar]))) | |
282 | if not gp: |
|
282 | if not gp: | |
283 | parents.append((MISSINGPARENT, mpar)) |
|
283 | parents.append((MISSINGPARENT, mpar)) | |
284 | pset.add(mpar) |
|
284 | pset.add(mpar) | |
285 | else: |
|
285 | else: | |
286 | parents.extend((GRANDPARENT, g) for g in gp if g not in pset) |
|
286 | parents.extend((GRANDPARENT, g) for g in gp if g not in pset) | |
287 | pset.update(gp) |
|
287 | pset.update(gp) | |
288 |
|
288 | |||
289 | yield (ctx.rev(), CHANGESET, ctx, parents) |
|
289 | yield (ctx.rev(), CHANGESET, ctx, parents) | |
290 |
|
290 | |||
291 | def nodes(repo, nodes): |
|
291 | def nodes(repo, nodes): | |
292 | """cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples |
|
292 | """cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples | |
293 |
|
293 | |||
294 | This generator function walks the given nodes. It only returns parents |
|
294 | This generator function walks the given nodes. It only returns parents | |
295 | that are in nodes, too. |
|
295 | that are in nodes, too. | |
296 | """ |
|
296 | """ | |
297 | include = set(nodes) |
|
297 | include = set(nodes) | |
298 | for node in nodes: |
|
298 | for node in nodes: | |
299 | ctx = repo[node] |
|
299 | ctx = repo[node] | |
300 | parents = set((PARENT, p.rev()) for p in ctx.parents() |
|
300 | parents = set((PARENT, p.rev()) for p in ctx.parents() | |
301 | if p.node() in include) |
|
301 | if p.node() in include) | |
302 | yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) |
|
302 | yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) | |
303 |
|
303 | |||
304 | def colored(dag, repo): |
|
304 | def colored(dag, repo): | |
305 | """annotates a DAG with colored edge information |
|
305 | """annotates a DAG with colored edge information | |
306 |
|
306 | |||
307 | For each DAG node this function emits tuples:: |
|
307 | For each DAG node this function emits tuples:: | |
308 |
|
308 | |||
309 | (id, type, data, (col, color), [(col, nextcol, color)]) |
|
309 | (id, type, data, (col, color), [(col, nextcol, color)]) | |
310 |
|
310 | |||
311 | with the following new elements: |
|
311 | with the following new elements: | |
312 |
|
312 | |||
313 | - Tuple (col, color) with column and color index for the current node |
|
313 | - Tuple (col, color) with column and color index for the current node | |
314 | - A list of tuples indicating the edges between the current node and its |
|
314 | - A list of tuples indicating the edges between the current node and its | |
315 | parents. |
|
315 | parents. | |
316 | """ |
|
316 | """ | |
317 | seen = [] |
|
317 | seen = [] | |
318 | colors = {} |
|
318 | colors = {} | |
319 | newcolor = 1 |
|
319 | newcolor = 1 | |
320 | config = {} |
|
320 | config = {} | |
321 |
|
321 | |||
322 | for key, val in repo.ui.configitems('graph'): |
|
322 | for key, val in repo.ui.configitems('graph'): | |
323 | if '.' in key: |
|
323 | if '.' in key: | |
324 | branch, setting = key.rsplit('.', 1) |
|
324 | branch, setting = key.rsplit('.', 1) | |
325 | # Validation |
|
325 | # Validation | |
326 | if setting == "width" and val.isdigit(): |
|
326 | if setting == "width" and val.isdigit(): | |
327 | config.setdefault(branch, {})[setting] = int(val) |
|
327 | config.setdefault(branch, {})[setting] = int(val) | |
328 | elif setting == "color" and val.isalnum(): |
|
328 | elif setting == "color" and val.isalnum(): | |
329 | config.setdefault(branch, {})[setting] = val |
|
329 | config.setdefault(branch, {})[setting] = val | |
330 |
|
330 | |||
331 | if config: |
|
331 | if config: | |
332 | getconf = util.lrucachefunc( |
|
332 | getconf = util.lrucachefunc( | |
333 | lambda rev: config.get(repo[rev].branch(), {})) |
|
333 | lambda rev: config.get(repo[rev].branch(), {})) | |
334 | else: |
|
334 | else: | |
335 | getconf = lambda rev: {} |
|
335 | getconf = lambda rev: {} | |
336 |
|
336 | |||
337 | for (cur, type, data, parents) in dag: |
|
337 | for (cur, type, data, parents) in dag: | |
338 |
|
338 | |||
339 | # Compute seen and next |
|
339 | # Compute seen and next | |
340 | if cur not in seen: |
|
340 | if cur not in seen: | |
341 | seen.append(cur) # new head |
|
341 | seen.append(cur) # new head | |
342 | colors[cur] = newcolor |
|
342 | colors[cur] = newcolor | |
343 | newcolor += 1 |
|
343 | newcolor += 1 | |
344 |
|
344 | |||
345 | col = seen.index(cur) |
|
345 | col = seen.index(cur) | |
346 | color = colors.pop(cur) |
|
346 | color = colors.pop(cur) | |
347 | next = seen[:] |
|
347 | next = seen[:] | |
348 |
|
348 | |||
349 | # Add parents to next |
|
349 | # Add parents to next | |
350 | addparents = [p for pt, p in parents if p not in next] |
|
350 | addparents = [p for pt, p in parents if p not in next] | |
351 | next[col:col + 1] = addparents |
|
351 | next[col:col + 1] = addparents | |
352 |
|
352 | |||
353 | # Set colors for the parents |
|
353 | # Set colors for the parents | |
354 | for i, p in enumerate(addparents): |
|
354 | for i, p in enumerate(addparents): | |
355 | if not i: |
|
355 | if not i: | |
356 | colors[p] = color |
|
356 | colors[p] = color | |
357 | else: |
|
357 | else: | |
358 | colors[p] = newcolor |
|
358 | colors[p] = newcolor | |
359 | newcolor += 1 |
|
359 | newcolor += 1 | |
360 |
|
360 | |||
361 | # Add edges to the graph |
|
361 | # Add edges to the graph | |
362 | edges = [] |
|
362 | edges = [] | |
363 | for ecol, eid in enumerate(seen): |
|
363 | for ecol, eid in enumerate(seen): | |
364 | if eid in next: |
|
364 | if eid in next: | |
365 | bconf = getconf(eid) |
|
365 | bconf = getconf(eid) | |
366 | edges.append(( |
|
366 | edges.append(( | |
367 | ecol, next.index(eid), colors[eid], |
|
367 | ecol, next.index(eid), colors[eid], | |
368 | bconf.get('width', -1), |
|
368 | bconf.get('width', -1), | |
369 | bconf.get('color', ''))) |
|
369 | bconf.get('color', ''))) | |
370 | elif eid == cur: |
|
370 | elif eid == cur: | |
371 | for ptype, p in parents: |
|
371 | for ptype, p in parents: | |
372 | bconf = getconf(p) |
|
372 | bconf = getconf(p) | |
373 | edges.append(( |
|
373 | edges.append(( | |
374 | ecol, next.index(p), color, |
|
374 | ecol, next.index(p), color, | |
375 | bconf.get('width', -1), |
|
375 | bconf.get('width', -1), | |
376 | bconf.get('color', ''))) |
|
376 | bconf.get('color', ''))) | |
377 |
|
377 | |||
378 | # Yield and move on |
|
378 | # Yield and move on | |
379 | yield (cur, type, data, (col, color), edges) |
|
379 | yield (cur, type, data, (col, color), edges) | |
380 | seen = next |
|
380 | seen = next | |
381 |
|
381 | |||
382 | def asciiedges(type, char, lines, state, rev, parents): |
|
382 | def asciiedges(type, char, lines, state, rev, parents): | |
383 | """adds edge info to changelog DAG walk suitable for ascii()""" |
|
383 | """adds edge info to changelog DAG walk suitable for ascii()""" | |
384 | seen = state['seen'] |
|
384 | seen = state['seen'] | |
385 | if rev not in seen: |
|
385 | if rev not in seen: | |
386 | seen.append(rev) |
|
386 | seen.append(rev) | |
387 | nodeidx = seen.index(rev) |
|
387 | nodeidx = seen.index(rev) | |
388 |
|
388 | |||
389 | knownparents = [] |
|
389 | knownparents = [] | |
390 | newparents = [] |
|
390 | newparents = [] | |
391 | for ptype, parent in parents: |
|
391 | for ptype, parent in parents: | |
392 | if parent in seen: |
|
392 | if parent in seen: | |
393 | knownparents.append(parent) |
|
393 | knownparents.append(parent) | |
394 | else: |
|
394 | else: | |
395 | newparents.append(parent) |
|
395 | newparents.append(parent) | |
396 | state['edges'][parent] = state['styles'].get(ptype, '|') |
|
396 | state['edges'][parent] = state['styles'].get(ptype, '|') | |
397 |
|
397 | |||
398 | ncols = len(seen) |
|
398 | ncols = len(seen) | |
399 | nextseen = seen[:] |
|
399 | nextseen = seen[:] | |
400 | nextseen[nodeidx:nodeidx + 1] = newparents |
|
400 | nextseen[nodeidx:nodeidx + 1] = newparents | |
401 | edges = [(nodeidx, nextseen.index(p)) |
|
401 | edges = [(nodeidx, nextseen.index(p)) | |
402 | for p in knownparents if p != nullrev] |
|
402 | for p in knownparents if p != nullrev] | |
403 |
|
403 | |||
404 | while len(newparents) > 2: |
|
404 | while len(newparents) > 2: | |
405 | # ascii() only knows how to add or remove a single column between two |
|
405 | # ascii() only knows how to add or remove a single column between two | |
406 | # calls. Nodes with more than two parents break this constraint so we |
|
406 | # calls. Nodes with more than two parents break this constraint so we | |
407 | # introduce intermediate expansion lines to grow the active node list |
|
407 | # introduce intermediate expansion lines to grow the active node list | |
408 | # slowly. |
|
408 | # slowly. | |
409 | edges.append((nodeidx, nodeidx)) |
|
409 | edges.append((nodeidx, nodeidx)) | |
410 | edges.append((nodeidx, nodeidx + 1)) |
|
410 | edges.append((nodeidx, nodeidx + 1)) | |
411 | nmorecols = 1 |
|
411 | nmorecols = 1 | |
412 | yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) |
|
412 | yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) | |
413 | char = '\\' |
|
413 | char = '\\' | |
414 | lines = [] |
|
414 | lines = [] | |
415 | nodeidx += 1 |
|
415 | nodeidx += 1 | |
416 | ncols += 1 |
|
416 | ncols += 1 | |
417 | edges = [] |
|
417 | edges = [] | |
418 | del newparents[0] |
|
418 | del newparents[0] | |
419 |
|
419 | |||
420 | if len(newparents) > 0: |
|
420 | if len(newparents) > 0: | |
421 | edges.append((nodeidx, nodeidx)) |
|
421 | edges.append((nodeidx, nodeidx)) | |
422 | if len(newparents) > 1: |
|
422 | if len(newparents) > 1: | |
423 | edges.append((nodeidx, nodeidx + 1)) |
|
423 | edges.append((nodeidx, nodeidx + 1)) | |
424 | nmorecols = len(nextseen) - ncols |
|
424 | nmorecols = len(nextseen) - ncols | |
425 | seen[:] = nextseen |
|
425 | seen[:] = nextseen | |
426 | # remove current node from edge characters, no longer needed |
|
426 | # remove current node from edge characters, no longer needed | |
427 | state['edges'].pop(rev, None) |
|
427 | state['edges'].pop(rev, None) | |
428 | yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) |
|
428 | yield (type, char, lines, (nodeidx, edges, ncols, nmorecols)) | |
429 |
|
429 | |||
430 | def _fixlongrightedges(edges): |
|
430 | def _fixlongrightedges(edges): | |
431 | for (i, (start, end)) in enumerate(edges): |
|
431 | for (i, (start, end)) in enumerate(edges): | |
432 | if end > start: |
|
432 | if end > start: | |
433 | edges[i] = (start, end + 1) |
|
433 | edges[i] = (start, end + 1) | |
434 |
|
434 | |||
435 | def _getnodelineedgestail( |
|
435 | def _getnodelineedgestail( | |
436 | echars, idx, pidx, ncols, coldiff, pdiff, fix_tail): |
|
436 | echars, idx, pidx, ncols, coldiff, pdiff, fix_tail): | |
437 | if fix_tail and coldiff == pdiff and coldiff != 0: |
|
437 | if fix_tail and coldiff == pdiff and coldiff != 0: | |
438 | # Still going in the same non-vertical direction. |
|
438 | # Still going in the same non-vertical direction. | |
439 | if coldiff == -1: |
|
439 | if coldiff == -1: | |
440 | start = max(idx + 1, pidx) |
|
440 | start = max(idx + 1, pidx) | |
441 | tail = echars[idx * 2:(start - 1) * 2] |
|
441 | tail = echars[idx * 2:(start - 1) * 2] | |
442 | tail.extend(["/", " "] * (ncols - start)) |
|
442 | tail.extend(["/", " "] * (ncols - start)) | |
443 | return tail |
|
443 | return tail | |
444 | else: |
|
444 | else: | |
445 | return ["\\", " "] * (ncols - idx - 1) |
|
445 | return ["\\", " "] * (ncols - idx - 1) | |
446 | else: |
|
446 | else: | |
447 | remainder = (ncols - idx - 1) |
|
447 | remainder = (ncols - idx - 1) | |
448 | return echars[-(remainder * 2):] if remainder > 0 else [] |
|
448 | return echars[-(remainder * 2):] if remainder > 0 else [] | |
449 |
|
449 | |||
450 | def _drawedges(echars, edges, nodeline, interline): |
|
450 | def _drawedges(echars, edges, nodeline, interline): | |
451 | for (start, end) in edges: |
|
451 | for (start, end) in edges: | |
452 | if start == end + 1: |
|
452 | if start == end + 1: | |
453 | interline[2 * end + 1] = "/" |
|
453 | interline[2 * end + 1] = "/" | |
454 | elif start == end - 1: |
|
454 | elif start == end - 1: | |
455 | interline[2 * start + 1] = "\\" |
|
455 | interline[2 * start + 1] = "\\" | |
456 | elif start == end: |
|
456 | elif start == end: | |
457 | interline[2 * start] = echars[2 * start] |
|
457 | interline[2 * start] = echars[2 * start] | |
458 | else: |
|
458 | else: | |
459 | if 2 * end >= len(nodeline): |
|
459 | if 2 * end >= len(nodeline): | |
460 | continue |
|
460 | continue | |
461 | nodeline[2 * end] = "+" |
|
461 | nodeline[2 * end] = "+" | |
462 | if start > end: |
|
462 | if start > end: | |
463 | (start, end) = (end, start) |
|
463 | (start, end) = (end, start) | |
464 | for i in range(2 * start + 1, 2 * end): |
|
464 | for i in range(2 * start + 1, 2 * end): | |
465 | if nodeline[i] != "+": |
|
465 | if nodeline[i] != "+": | |
466 | nodeline[i] = "-" |
|
466 | nodeline[i] = "-" | |
467 |
|
467 | |||
468 | def _getpaddingline(echars, idx, ncols, edges): |
|
468 | def _getpaddingline(echars, idx, ncols, edges): | |
469 | # all edges up to the current node |
|
469 | # all edges up to the current node | |
470 | line = echars[:idx * 2] |
|
470 | line = echars[:idx * 2] | |
471 | # an edge for the current node, if there is one |
|
471 | # an edge for the current node, if there is one | |
472 | if (idx, idx - 1) in edges or (idx, idx) in edges: |
|
472 | if (idx, idx - 1) in edges or (idx, idx) in edges: | |
473 | # (idx, idx - 1) (idx, idx) |
|
473 | # (idx, idx - 1) (idx, idx) | |
474 | # | | | | | | | | |
|
474 | # | | | | | | | | | |
475 | # +---o | | o---+ |
|
475 | # +---o | | o---+ | |
476 | # | | X | | X | | |
|
476 | # | | X | | X | | | |
477 | # | |/ / | |/ / |
|
477 | # | |/ / | |/ / | |
478 | # | | | | | | |
|
478 | # | | | | | | | |
479 | line.extend(echars[idx * 2:(idx + 1) * 2]) |
|
479 | line.extend(echars[idx * 2:(idx + 1) * 2]) | |
480 | else: |
|
480 | else: | |
481 | line.extend(' ') |
|
481 | line.extend(' ') | |
482 | # all edges to the right of the current node |
|
482 | # all edges to the right of the current node | |
483 | remainder = ncols - idx - 1 |
|
483 | remainder = ncols - idx - 1 | |
484 | if remainder > 0: |
|
484 | if remainder > 0: | |
485 | line.extend(echars[-(remainder * 2):]) |
|
485 | line.extend(echars[-(remainder * 2):]) | |
486 | return line |
|
486 | return line | |
487 |
|
487 | |||
488 | def _drawendinglines(lines, extra, edgemap, seen): |
|
488 | def _drawendinglines(lines, extra, edgemap, seen): | |
489 | """Draw ending lines for missing parent edges |
|
489 | """Draw ending lines for missing parent edges | |
490 |
|
490 | |||
491 | None indicates an edge that ends at between this node and the next |
|
491 | None indicates an edge that ends at between this node and the next | |
492 | Replace with a short line ending in ~ and add / lines to any edges to |
|
492 | Replace with a short line ending in ~ and add / lines to any edges to | |
493 | the right. |
|
493 | the right. | |
494 |
|
494 | |||
495 | """ |
|
495 | """ | |
496 | if None not in edgemap.values(): |
|
496 | if None not in edgemap.values(): | |
497 | return |
|
497 | return | |
498 |
|
498 | |||
499 | # Check for more edges to the right of our ending edges. |
|
499 | # Check for more edges to the right of our ending edges. | |
500 | # We need enough space to draw adjustment lines for these. |
|
500 | # We need enough space to draw adjustment lines for these. | |
501 | edgechars = extra[::2] |
|
501 | edgechars = extra[::2] | |
502 | while edgechars and edgechars[-1] is None: |
|
502 | while edgechars and edgechars[-1] is None: | |
503 | edgechars.pop() |
|
503 | edgechars.pop() | |
504 | shift_size = max((edgechars.count(None) * 2) - 1, 0) |
|
504 | shift_size = max((edgechars.count(None) * 2) - 1, 0) | |
505 | while len(lines) < 3 + shift_size: |
|
505 | while len(lines) < 3 + shift_size: | |
506 | lines.append(extra[:]) |
|
506 | lines.append(extra[:]) | |
507 |
|
507 | |||
508 | if shift_size: |
|
508 | if shift_size: | |
509 | empties = [] |
|
509 | empties = [] | |
510 | toshift = [] |
|
510 | toshift = [] | |
511 | first_empty = extra.index(None) |
|
511 | first_empty = extra.index(None) | |
512 | for i, c in enumerate(extra[first_empty::2], first_empty // 2): |
|
512 | for i, c in enumerate(extra[first_empty::2], first_empty // 2): | |
513 | if c is None: |
|
513 | if c is None: | |
514 | empties.append(i * 2) |
|
514 | empties.append(i * 2) | |
515 | else: |
|
515 | else: | |
516 | toshift.append(i * 2) |
|
516 | toshift.append(i * 2) | |
517 | targets = list(range(first_empty, first_empty + len(toshift) * 2, 2)) |
|
517 | targets = list(range(first_empty, first_empty + len(toshift) * 2, 2)) | |
518 | positions = toshift[:] |
|
518 | positions = toshift[:] | |
519 | for line in lines[-shift_size:]: |
|
519 | for line in lines[-shift_size:]: | |
520 | line[first_empty:] = [' '] * (len(line) - first_empty) |
|
520 | line[first_empty:] = [' '] * (len(line) - first_empty) | |
521 | for i in range(len(positions)): |
|
521 | for i in range(len(positions)): | |
522 | pos = positions[i] - 1 |
|
522 | pos = positions[i] - 1 | |
523 | positions[i] = max(pos, targets[i]) |
|
523 | positions[i] = max(pos, targets[i]) | |
524 | line[pos] = '/' if pos > targets[i] else extra[toshift[i]] |
|
524 | line[pos] = '/' if pos > targets[i] else extra[toshift[i]] | |
525 |
|
525 | |||
526 | map = {1: '|', 2: '~'} |
|
526 | map = {1: '|', 2: '~'} | |
527 | for i, line in enumerate(lines): |
|
527 | for i, line in enumerate(lines): | |
528 | if None not in line: |
|
528 | if None not in line: | |
529 | continue |
|
529 | continue | |
530 | line[:] = [c or map.get(i, ' ') for c in line] |
|
530 | line[:] = [c or map.get(i, ' ') for c in line] | |
531 |
|
531 | |||
532 | # remove edges that ended |
|
532 | # remove edges that ended | |
533 | remove = [p for p, c in edgemap.items() if c is None] |
|
533 | remove = [p for p, c in edgemap.items() if c is None] | |
534 | for parent in remove: |
|
534 | for parent in remove: | |
535 | del edgemap[parent] |
|
535 | del edgemap[parent] | |
536 | seen.remove(parent) |
|
536 | seen.remove(parent) | |
537 |
|
537 | |||
538 | def asciistate(): |
|
538 | def asciistate(): | |
539 | """returns the initial value for the "state" argument to ascii()""" |
|
539 | """returns the initial value for the "state" argument to ascii()""" | |
540 | return { |
|
540 | return { | |
541 | 'seen': [], |
|
541 | 'seen': [], | |
542 | 'edges': {}, |
|
542 | 'edges': {}, | |
543 | 'lastcoldiff': 0, |
|
543 | 'lastcoldiff': 0, | |
544 | 'lastindex': 0, |
|
544 | 'lastindex': 0, | |
545 | 'styles': EDGES.copy(), |
|
545 | 'styles': EDGES.copy(), | |
|
546 | 'graphshorten': False, | |||
546 | } |
|
547 | } | |
547 |
|
548 | |||
548 | def ascii(ui, state, type, char, text, coldata): |
|
549 | def ascii(ui, state, type, char, text, coldata): | |
549 | """prints an ASCII graph of the DAG |
|
550 | """prints an ASCII graph of the DAG | |
550 |
|
551 | |||
551 | takes the following arguments (one call per node in the graph): |
|
552 | takes the following arguments (one call per node in the graph): | |
552 |
|
553 | |||
553 | - ui to write to |
|
554 | - ui to write to | |
554 | - Somewhere to keep the needed state in (init to asciistate()) |
|
555 | - Somewhere to keep the needed state in (init to asciistate()) | |
555 | - Column of the current node in the set of ongoing edges. |
|
556 | - Column of the current node in the set of ongoing edges. | |
556 | - Type indicator of node data, usually 'C' for changesets. |
|
557 | - Type indicator of node data, usually 'C' for changesets. | |
557 | - Payload: (char, lines): |
|
558 | - Payload: (char, lines): | |
558 | - Character to use as node's symbol. |
|
559 | - Character to use as node's symbol. | |
559 | - List of lines to display as the node's text. |
|
560 | - List of lines to display as the node's text. | |
560 | - Edges; a list of (col, next_col) indicating the edges between |
|
561 | - Edges; a list of (col, next_col) indicating the edges between | |
561 | the current node and its parents. |
|
562 | the current node and its parents. | |
562 | - Number of columns (ongoing edges) in the current revision. |
|
563 | - Number of columns (ongoing edges) in the current revision. | |
563 | - The difference between the number of columns (ongoing edges) |
|
564 | - The difference between the number of columns (ongoing edges) | |
564 | in the next revision and the number of columns (ongoing edges) |
|
565 | in the next revision and the number of columns (ongoing edges) | |
565 | in the current revision. That is: -1 means one column removed; |
|
566 | in the current revision. That is: -1 means one column removed; | |
566 | 0 means no columns added or removed; 1 means one column added. |
|
567 | 0 means no columns added or removed; 1 means one column added. | |
567 | """ |
|
568 | """ | |
568 | idx, edges, ncols, coldiff = coldata |
|
569 | idx, edges, ncols, coldiff = coldata | |
569 | assert -2 < coldiff < 2 |
|
570 | assert -2 < coldiff < 2 | |
570 |
|
571 | |||
571 | edgemap, seen = state['edges'], state['seen'] |
|
572 | edgemap, seen = state['edges'], state['seen'] | |
572 | # Be tolerant of history issues; make sure we have at least ncols + coldiff |
|
573 | # Be tolerant of history issues; make sure we have at least ncols + coldiff | |
573 | # elements to work with. See test-glog.t for broken history test cases. |
|
574 | # elements to work with. See test-glog.t for broken history test cases. | |
574 | echars = [c for p in seen for c in (edgemap.get(p, '|'), ' ')] |
|
575 | echars = [c for p in seen for c in (edgemap.get(p, '|'), ' ')] | |
575 | echars.extend(('|', ' ') * max(ncols + coldiff - len(seen), 0)) |
|
576 | echars.extend(('|', ' ') * max(ncols + coldiff - len(seen), 0)) | |
576 |
|
577 | |||
577 | if coldiff == -1: |
|
578 | if coldiff == -1: | |
578 | # Transform |
|
579 | # Transform | |
579 | # |
|
580 | # | |
580 | # | | | | | | |
|
581 | # | | | | | | | |
581 | # o | | into o---+ |
|
582 | # o | | into o---+ | |
582 | # |X / |/ / |
|
583 | # |X / |/ / | |
583 | # | | | | |
|
584 | # | | | | | |
584 | _fixlongrightedges(edges) |
|
585 | _fixlongrightedges(edges) | |
585 |
|
586 | |||
586 | # add_padding_line says whether to rewrite |
|
587 | # add_padding_line says whether to rewrite | |
587 | # |
|
588 | # | |
588 | # | | | | | | | | |
|
589 | # | | | | | | | | | |
589 | # | o---+ into | o---+ |
|
590 | # | o---+ into | o---+ | |
590 | # | / / | | | # <--- padding line |
|
591 | # | / / | | | # <--- padding line | |
591 | # o | | | / / |
|
592 | # o | | | / / | |
592 | # o | | |
|
593 | # o | | | |
593 | add_padding_line = (len(text) > 2 and coldiff == -1 and |
|
594 | add_padding_line = (len(text) > 2 and coldiff == -1 and | |
594 | [x for (x, y) in edges if x + 1 < y]) |
|
595 | [x for (x, y) in edges if x + 1 < y]) | |
595 |
|
596 | |||
596 | # fix_nodeline_tail says whether to rewrite |
|
597 | # fix_nodeline_tail says whether to rewrite | |
597 | # |
|
598 | # | |
598 | # | | o | | | | o | | |
|
599 | # | | o | | | | o | | | |
599 | # | | |/ / | | |/ / |
|
600 | # | | |/ / | | |/ / | |
600 | # | o | | into | o / / # <--- fixed nodeline tail |
|
601 | # | o | | into | o / / # <--- fixed nodeline tail | |
601 | # | |/ / | |/ / |
|
602 | # | |/ / | |/ / | |
602 | # o | | o | | |
|
603 | # o | | o | | | |
603 | fix_nodeline_tail = len(text) <= 2 and not add_padding_line |
|
604 | fix_nodeline_tail = len(text) <= 2 and not add_padding_line | |
604 |
|
605 | |||
605 | # nodeline is the line containing the node character (typically o) |
|
606 | # nodeline is the line containing the node character (typically o) | |
606 | nodeline = echars[:idx * 2] |
|
607 | nodeline = echars[:idx * 2] | |
607 | nodeline.extend([char, " "]) |
|
608 | nodeline.extend([char, " "]) | |
608 |
|
609 | |||
609 | nodeline.extend( |
|
610 | nodeline.extend( | |
610 | _getnodelineedgestail( |
|
611 | _getnodelineedgestail( | |
611 | echars, idx, state['lastindex'], ncols, coldiff, |
|
612 | echars, idx, state['lastindex'], ncols, coldiff, | |
612 | state['lastcoldiff'], fix_nodeline_tail)) |
|
613 | state['lastcoldiff'], fix_nodeline_tail)) | |
613 |
|
614 | |||
614 | # shift_interline is the line containing the non-vertical |
|
615 | # shift_interline is the line containing the non-vertical | |
615 | # edges between this entry and the next |
|
616 | # edges between this entry and the next | |
616 | shift_interline = echars[:idx * 2] |
|
617 | shift_interline = echars[:idx * 2] | |
617 | shift_interline.extend(' ' * (2 + coldiff)) |
|
618 | shift_interline.extend(' ' * (2 + coldiff)) | |
618 | count = ncols - idx - 1 |
|
619 | count = ncols - idx - 1 | |
619 | if coldiff == -1: |
|
620 | if coldiff == -1: | |
620 | shift_interline.extend('/ ' * count) |
|
621 | shift_interline.extend('/ ' * count) | |
621 | elif coldiff == 0: |
|
622 | elif coldiff == 0: | |
622 | shift_interline.extend(echars[(idx + 1) * 2:ncols * 2]) |
|
623 | shift_interline.extend(echars[(idx + 1) * 2:ncols * 2]) | |
623 | else: |
|
624 | else: | |
624 | shift_interline.extend(r'\ ' * count) |
|
625 | shift_interline.extend(r'\ ' * count) | |
625 |
|
626 | |||
626 | # draw edges from the current node to its parents |
|
627 | # draw edges from the current node to its parents | |
627 | _drawedges(echars, edges, nodeline, shift_interline) |
|
628 | _drawedges(echars, edges, nodeline, shift_interline) | |
628 |
|
629 | |||
629 | # lines is the list of all graph lines to print |
|
630 | # lines is the list of all graph lines to print | |
630 | lines = [nodeline] |
|
631 | lines = [nodeline] | |
631 | if add_padding_line: |
|
632 | if add_padding_line: | |
632 | lines.append(_getpaddingline(echars, idx, ncols, edges)) |
|
633 | lines.append(_getpaddingline(echars, idx, ncols, edges)) | |
633 | lines.append(shift_interline) |
|
634 | ||
|
635 | # If 'graphshorten' config, only draw shift_interline | |||
|
636 | # when there is any non vertical flow in graph. | |||
|
637 | if state['graphshorten']: | |||
|
638 | if any(c in '\/' for c in shift_interline if c): | |||
|
639 | lines.append(shift_interline) | |||
|
640 | # Else, no 'graphshorten' config so draw shift_interline. | |||
|
641 | else: | |||
|
642 | lines.append(shift_interline) | |||
634 |
|
643 | |||
635 | # make sure that there are as many graph lines as there are |
|
644 | # make sure that there are as many graph lines as there are | |
636 | # log strings |
|
645 | # log strings | |
637 | extra_interline = echars[:(ncols + coldiff) * 2] |
|
646 | extra_interline = echars[:(ncols + coldiff) * 2] | |
638 | if len(lines) < len(text): |
|
647 | if len(lines) < len(text): | |
639 | while len(lines) < len(text): |
|
648 | while len(lines) < len(text): | |
640 | lines.append(extra_interline[:]) |
|
649 | lines.append(extra_interline[:]) | |
641 |
|
650 | |||
642 | _drawendinglines(lines, extra_interline, edgemap, seen) |
|
651 | _drawendinglines(lines, extra_interline, edgemap, seen) | |
643 |
|
652 | |||
644 | while len(text) < len(lines): |
|
653 | while len(text) < len(lines): | |
645 | text.append("") |
|
654 | text.append("") | |
646 |
|
655 | |||
647 | # print lines |
|
656 | # print lines | |
648 | indentation_level = max(ncols, ncols + coldiff) |
|
657 | indentation_level = max(ncols, ncols + coldiff) | |
649 | for (line, logstr) in zip(lines, text): |
|
658 | for (line, logstr) in zip(lines, text): | |
650 | ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) |
|
659 | ln = "%-*s %s" % (2 * indentation_level, "".join(line), logstr) | |
651 | ui.write(ln.rstrip() + '\n') |
|
660 | ui.write(ln.rstrip() + '\n') | |
652 |
|
661 | |||
653 | # ... and start over |
|
662 | # ... and start over | |
654 | state['lastcoldiff'] = coldiff |
|
663 | state['lastcoldiff'] = coldiff | |
655 | state['lastindex'] = idx |
|
664 | state['lastindex'] = idx |
@@ -1,2636 +1,2738 b'' | |||||
1 | @ (34) head |
|
1 | @ (34) head | |
2 | | |
|
2 | | | |
3 | | o (33) head |
|
3 | | o (33) head | |
4 | | | |
|
4 | | | | |
5 | o | (32) expand |
|
5 | o | (32) expand | |
6 | |\ \ |
|
6 | |\ \ | |
7 | | o \ (31) expand |
|
7 | | o \ (31) expand | |
8 | | |\ \ |
|
8 | | |\ \ | |
9 | | | o \ (30) expand |
|
9 | | | o \ (30) expand | |
10 | | | |\ \ |
|
10 | | | |\ \ | |
11 | | | | o | (29) regular commit |
|
11 | | | | o | (29) regular commit | |
12 | | | | | | |
|
12 | | | | | | | |
13 | | | o | | (28) merge zero known |
|
13 | | | o | | (28) merge zero known | |
14 | | | |\ \ \ |
|
14 | | | |\ \ \ | |
15 | o | | | | | (27) collapse |
|
15 | o | | | | | (27) collapse | |
16 | |/ / / / / |
|
16 | |/ / / / / | |
17 | | | o---+ (26) merge one known; far right |
|
17 | | | o---+ (26) merge one known; far right | |
18 | | | | | | |
|
18 | | | | | | | |
19 | +---o | | (25) merge one known; far left |
|
19 | +---o | | (25) merge one known; far left | |
20 | | | | | | |
|
20 | | | | | | | |
21 | | | o | | (24) merge one known; immediate right |
|
21 | | | o | | (24) merge one known; immediate right | |
22 | | | |\| | |
|
22 | | | |\| | | |
23 | | | o | | (23) merge one known; immediate left |
|
23 | | | o | | (23) merge one known; immediate left | |
24 | | |/| | | |
|
24 | | |/| | | | |
25 | +---o---+ (22) merge two known; one far left, one far right |
|
25 | +---o---+ (22) merge two known; one far left, one far right | |
26 | | | / / |
|
26 | | | / / | |
27 | o | | | (21) expand |
|
27 | o | | | (21) expand | |
28 | |\ \ \ \ |
|
28 | |\ \ \ \ | |
29 | | o---+-+ (20) merge two known; two far right |
|
29 | | o---+-+ (20) merge two known; two far right | |
30 | | / / / |
|
30 | | / / / | |
31 | o | | | (19) expand |
|
31 | o | | | (19) expand | |
32 | |\ \ \ \ |
|
32 | |\ \ \ \ | |
33 | +---+---o (18) merge two known; two far left |
|
33 | +---+---o (18) merge two known; two far left | |
34 | | | | | |
|
34 | | | | | | |
35 | | o | | (17) expand |
|
35 | | o | | (17) expand | |
36 | | |\ \ \ |
|
36 | | |\ \ \ | |
37 | | | o---+ (16) merge two known; one immediate right, one near right |
|
37 | | | o---+ (16) merge two known; one immediate right, one near right | |
38 | | | |/ / |
|
38 | | | |/ / | |
39 | o | | | (15) expand |
|
39 | o | | | (15) expand | |
40 | |\ \ \ \ |
|
40 | |\ \ \ \ | |
41 | | o-----+ (14) merge two known; one immediate right, one far right |
|
41 | | o-----+ (14) merge two known; one immediate right, one far right | |
42 | | |/ / / |
|
42 | | |/ / / | |
43 | o | | | (13) expand |
|
43 | o | | | (13) expand | |
44 | |\ \ \ \ |
|
44 | |\ \ \ \ | |
45 | +---o | | (12) merge two known; one immediate right, one far left |
|
45 | +---o | | (12) merge two known; one immediate right, one far left | |
46 | | | |/ / |
|
46 | | | |/ / | |
47 | | o | | (11) expand |
|
47 | | o | | (11) expand | |
48 | | |\ \ \ |
|
48 | | |\ \ \ | |
49 | | | o---+ (10) merge two known; one immediate left, one near right |
|
49 | | | o---+ (10) merge two known; one immediate left, one near right | |
50 | | |/ / / |
|
50 | | |/ / / | |
51 | o | | | (9) expand |
|
51 | o | | | (9) expand | |
52 | |\ \ \ \ |
|
52 | |\ \ \ \ | |
53 | | o-----+ (8) merge two known; one immediate left, one far right |
|
53 | | o-----+ (8) merge two known; one immediate left, one far right | |
54 | |/ / / / |
|
54 | |/ / / / | |
55 | o | | | (7) expand |
|
55 | o | | | (7) expand | |
56 | |\ \ \ \ |
|
56 | |\ \ \ \ | |
57 | +---o | | (6) merge two known; one immediate left, one far left |
|
57 | +---o | | (6) merge two known; one immediate left, one far left | |
58 | | |/ / / |
|
58 | | |/ / / | |
59 | | o | | (5) expand |
|
59 | | o | | (5) expand | |
60 | | |\ \ \ |
|
60 | | |\ \ \ | |
61 | | | o | | (4) merge two known; one immediate left, one immediate right |
|
61 | | | o | | (4) merge two known; one immediate left, one immediate right | |
62 | | |/|/ / |
|
62 | | |/|/ / | |
63 | | o / / (3) collapse |
|
63 | | o / / (3) collapse | |
64 | |/ / / |
|
64 | |/ / / | |
65 | o / / (2) collapse |
|
65 | o / / (2) collapse | |
66 | |/ / |
|
66 | |/ / | |
67 | o / (1) collapse |
|
67 | o / (1) collapse | |
68 | |/ |
|
68 | |/ | |
69 | o (0) root |
|
69 | o (0) root | |
70 |
|
70 | |||
71 |
|
71 | |||
72 | $ commit() |
|
72 | $ commit() | |
73 | > { |
|
73 | > { | |
74 | > rev=$1 |
|
74 | > rev=$1 | |
75 | > msg=$2 |
|
75 | > msg=$2 | |
76 | > shift 2 |
|
76 | > shift 2 | |
77 | > if [ "$#" -gt 0 ]; then |
|
77 | > if [ "$#" -gt 0 ]; then | |
78 | > hg debugsetparents "$@" |
|
78 | > hg debugsetparents "$@" | |
79 | > fi |
|
79 | > fi | |
80 | > echo $rev > a |
|
80 | > echo $rev > a | |
81 | > hg commit -Aqd "$rev 0" -m "($rev) $msg" |
|
81 | > hg commit -Aqd "$rev 0" -m "($rev) $msg" | |
82 | > } |
|
82 | > } | |
83 |
|
83 | |||
84 | $ cat > printrevset.py <<EOF |
|
84 | $ cat > printrevset.py <<EOF | |
85 | > from mercurial import extensions, revset, commands, cmdutil |
|
85 | > from mercurial import extensions, revset, commands, cmdutil | |
86 | > |
|
86 | > | |
87 | > def uisetup(ui): |
|
87 | > def uisetup(ui): | |
88 | > def printrevset(orig, ui, repo, *pats, **opts): |
|
88 | > def printrevset(orig, ui, repo, *pats, **opts): | |
89 | > if opts.get('print_revset'): |
|
89 | > if opts.get('print_revset'): | |
90 | > expr = cmdutil.getgraphlogrevs(repo, pats, opts)[1] |
|
90 | > expr = cmdutil.getgraphlogrevs(repo, pats, opts)[1] | |
91 | > if expr: |
|
91 | > if expr: | |
92 | > tree = revset.parse(expr) |
|
92 | > tree = revset.parse(expr) | |
93 | > else: |
|
93 | > else: | |
94 | > tree = [] |
|
94 | > tree = [] | |
95 | > ui.write('%r\n' % (opts.get('rev', []),)) |
|
95 | > ui.write('%r\n' % (opts.get('rev', []),)) | |
96 | > ui.write(revset.prettyformat(tree) + '\n') |
|
96 | > ui.write(revset.prettyformat(tree) + '\n') | |
97 | > return 0 |
|
97 | > return 0 | |
98 | > return orig(ui, repo, *pats, **opts) |
|
98 | > return orig(ui, repo, *pats, **opts) | |
99 | > entry = extensions.wrapcommand(commands.table, 'log', printrevset) |
|
99 | > entry = extensions.wrapcommand(commands.table, 'log', printrevset) | |
100 | > entry[1].append(('', 'print-revset', False, |
|
100 | > entry[1].append(('', 'print-revset', False, | |
101 | > 'print generated revset and exit (DEPRECATED)')) |
|
101 | > 'print generated revset and exit (DEPRECATED)')) | |
102 | > EOF |
|
102 | > EOF | |
103 |
|
103 | |||
104 | $ echo "[extensions]" >> $HGRCPATH |
|
104 | $ echo "[extensions]" >> $HGRCPATH | |
105 | $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH |
|
105 | $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH | |
106 |
|
106 | |||
107 | $ hg init repo |
|
107 | $ hg init repo | |
108 | $ cd repo |
|
108 | $ cd repo | |
109 |
|
109 | |||
110 | Empty repo: |
|
110 | Empty repo: | |
111 |
|
111 | |||
112 | $ hg log -G |
|
112 | $ hg log -G | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | Building DAG: |
|
115 | Building DAG: | |
116 |
|
116 | |||
117 | $ commit 0 "root" |
|
117 | $ commit 0 "root" | |
118 | $ commit 1 "collapse" 0 |
|
118 | $ commit 1 "collapse" 0 | |
119 | $ commit 2 "collapse" 1 |
|
119 | $ commit 2 "collapse" 1 | |
120 | $ commit 3 "collapse" 2 |
|
120 | $ commit 3 "collapse" 2 | |
121 | $ commit 4 "merge two known; one immediate left, one immediate right" 1 3 |
|
121 | $ commit 4 "merge two known; one immediate left, one immediate right" 1 3 | |
122 | $ commit 5 "expand" 3 4 |
|
122 | $ commit 5 "expand" 3 4 | |
123 | $ commit 6 "merge two known; one immediate left, one far left" 2 5 |
|
123 | $ commit 6 "merge two known; one immediate left, one far left" 2 5 | |
124 | $ commit 7 "expand" 2 5 |
|
124 | $ commit 7 "expand" 2 5 | |
125 | $ commit 8 "merge two known; one immediate left, one far right" 0 7 |
|
125 | $ commit 8 "merge two known; one immediate left, one far right" 0 7 | |
126 | $ commit 9 "expand" 7 8 |
|
126 | $ commit 9 "expand" 7 8 | |
127 | $ commit 10 "merge two known; one immediate left, one near right" 0 6 |
|
127 | $ commit 10 "merge two known; one immediate left, one near right" 0 6 | |
128 | $ commit 11 "expand" 6 10 |
|
128 | $ commit 11 "expand" 6 10 | |
129 | $ commit 12 "merge two known; one immediate right, one far left" 1 9 |
|
129 | $ commit 12 "merge two known; one immediate right, one far left" 1 9 | |
130 | $ commit 13 "expand" 9 11 |
|
130 | $ commit 13 "expand" 9 11 | |
131 | $ commit 14 "merge two known; one immediate right, one far right" 0 12 |
|
131 | $ commit 14 "merge two known; one immediate right, one far right" 0 12 | |
132 | $ commit 15 "expand" 13 14 |
|
132 | $ commit 15 "expand" 13 14 | |
133 | $ commit 16 "merge two known; one immediate right, one near right" 0 1 |
|
133 | $ commit 16 "merge two known; one immediate right, one near right" 0 1 | |
134 | $ commit 17 "expand" 12 16 |
|
134 | $ commit 17 "expand" 12 16 | |
135 | $ commit 18 "merge two known; two far left" 1 15 |
|
135 | $ commit 18 "merge two known; two far left" 1 15 | |
136 | $ commit 19 "expand" 15 17 |
|
136 | $ commit 19 "expand" 15 17 | |
137 | $ commit 20 "merge two known; two far right" 0 18 |
|
137 | $ commit 20 "merge two known; two far right" 0 18 | |
138 | $ commit 21 "expand" 19 20 |
|
138 | $ commit 21 "expand" 19 20 | |
139 | $ commit 22 "merge two known; one far left, one far right" 18 21 |
|
139 | $ commit 22 "merge two known; one far left, one far right" 18 21 | |
140 | $ commit 23 "merge one known; immediate left" 1 22 |
|
140 | $ commit 23 "merge one known; immediate left" 1 22 | |
141 | $ commit 24 "merge one known; immediate right" 0 23 |
|
141 | $ commit 24 "merge one known; immediate right" 0 23 | |
142 | $ commit 25 "merge one known; far left" 21 24 |
|
142 | $ commit 25 "merge one known; far left" 21 24 | |
143 | $ commit 26 "merge one known; far right" 18 25 |
|
143 | $ commit 26 "merge one known; far right" 18 25 | |
144 | $ commit 27 "collapse" 21 |
|
144 | $ commit 27 "collapse" 21 | |
145 | $ commit 28 "merge zero known" 1 26 |
|
145 | $ commit 28 "merge zero known" 1 26 | |
146 | $ commit 29 "regular commit" 0 |
|
146 | $ commit 29 "regular commit" 0 | |
147 | $ commit 30 "expand" 28 29 |
|
147 | $ commit 30 "expand" 28 29 | |
148 | $ commit 31 "expand" 21 30 |
|
148 | $ commit 31 "expand" 21 30 | |
149 | $ commit 32 "expand" 27 31 |
|
149 | $ commit 32 "expand" 27 31 | |
150 | $ commit 33 "head" 18 |
|
150 | $ commit 33 "head" 18 | |
151 | $ commit 34 "head" 32 |
|
151 | $ commit 34 "head" 32 | |
152 |
|
152 | |||
153 |
|
153 | |||
154 | $ hg log -G -q |
|
154 | $ hg log -G -q | |
155 | @ 34:fea3ac5810e0 |
|
155 | @ 34:fea3ac5810e0 | |
156 | | |
|
156 | | | |
157 | | o 33:68608f5145f9 |
|
157 | | o 33:68608f5145f9 | |
158 | | | |
|
158 | | | | |
159 | o | 32:d06dffa21a31 |
|
159 | o | 32:d06dffa21a31 | |
160 | |\ \ |
|
160 | |\ \ | |
161 | | o \ 31:621d83e11f67 |
|
161 | | o \ 31:621d83e11f67 | |
162 | | |\ \ |
|
162 | | |\ \ | |
163 | | | o \ 30:6e11cd4b648f |
|
163 | | | o \ 30:6e11cd4b648f | |
164 | | | |\ \ |
|
164 | | | |\ \ | |
165 | | | | o | 29:cd9bb2be7593 |
|
165 | | | | o | 29:cd9bb2be7593 | |
166 | | | | | | |
|
166 | | | | | | | |
167 | | | o | | 28:44ecd0b9ae99 |
|
167 | | | o | | 28:44ecd0b9ae99 | |
168 | | | |\ \ \ |
|
168 | | | |\ \ \ | |
169 | o | | | | | 27:886ed638191b |
|
169 | o | | | | | 27:886ed638191b | |
170 | |/ / / / / |
|
170 | |/ / / / / | |
171 | | | o---+ 26:7f25b6c2f0b9 |
|
171 | | | o---+ 26:7f25b6c2f0b9 | |
172 | | | | | | |
|
172 | | | | | | | |
173 | +---o | | 25:91da8ed57247 |
|
173 | +---o | | 25:91da8ed57247 | |
174 | | | | | | |
|
174 | | | | | | | |
175 | | | o | | 24:a9c19a3d96b7 |
|
175 | | | o | | 24:a9c19a3d96b7 | |
176 | | | |\| | |
|
176 | | | |\| | | |
177 | | | o | | 23:a01cddf0766d |
|
177 | | | o | | 23:a01cddf0766d | |
178 | | |/| | | |
|
178 | | |/| | | | |
179 | +---o---+ 22:e0d9cccacb5d |
|
179 | +---o---+ 22:e0d9cccacb5d | |
180 | | | / / |
|
180 | | | / / | |
181 | o | | | 21:d42a756af44d |
|
181 | o | | | 21:d42a756af44d | |
182 | |\ \ \ \ |
|
182 | |\ \ \ \ | |
183 | | o---+-+ 20:d30ed6450e32 |
|
183 | | o---+-+ 20:d30ed6450e32 | |
184 | | / / / |
|
184 | | / / / | |
185 | o | | | 19:31ddc2c1573b |
|
185 | o | | | 19:31ddc2c1573b | |
186 | |\ \ \ \ |
|
186 | |\ \ \ \ | |
187 | +---+---o 18:1aa84d96232a |
|
187 | +---+---o 18:1aa84d96232a | |
188 | | | | | |
|
188 | | | | | | |
189 | | o | | 17:44765d7c06e0 |
|
189 | | o | | 17:44765d7c06e0 | |
190 | | |\ \ \ |
|
190 | | |\ \ \ | |
191 | | | o---+ 16:3677d192927d |
|
191 | | | o---+ 16:3677d192927d | |
192 | | | |/ / |
|
192 | | | |/ / | |
193 | o | | | 15:1dda3f72782d |
|
193 | o | | | 15:1dda3f72782d | |
194 | |\ \ \ \ |
|
194 | |\ \ \ \ | |
195 | | o-----+ 14:8eac370358ef |
|
195 | | o-----+ 14:8eac370358ef | |
196 | | |/ / / |
|
196 | | |/ / / | |
197 | o | | | 13:22d8966a97e3 |
|
197 | o | | | 13:22d8966a97e3 | |
198 | |\ \ \ \ |
|
198 | |\ \ \ \ | |
199 | +---o | | 12:86b91144a6e9 |
|
199 | +---o | | 12:86b91144a6e9 | |
200 | | | |/ / |
|
200 | | | |/ / | |
201 | | o | | 11:832d76e6bdf2 |
|
201 | | o | | 11:832d76e6bdf2 | |
202 | | |\ \ \ |
|
202 | | |\ \ \ | |
203 | | | o---+ 10:74c64d036d72 |
|
203 | | | o---+ 10:74c64d036d72 | |
204 | | |/ / / |
|
204 | | |/ / / | |
205 | o | | | 9:7010c0af0a35 |
|
205 | o | | | 9:7010c0af0a35 | |
206 | |\ \ \ \ |
|
206 | |\ \ \ \ | |
207 | | o-----+ 8:7a0b11f71937 |
|
207 | | o-----+ 8:7a0b11f71937 | |
208 | |/ / / / |
|
208 | |/ / / / | |
209 | o | | | 7:b632bb1b1224 |
|
209 | o | | | 7:b632bb1b1224 | |
210 | |\ \ \ \ |
|
210 | |\ \ \ \ | |
211 | +---o | | 6:b105a072e251 |
|
211 | +---o | | 6:b105a072e251 | |
212 | | |/ / / |
|
212 | | |/ / / | |
213 | | o | | 5:4409d547b708 |
|
213 | | o | | 5:4409d547b708 | |
214 | | |\ \ \ |
|
214 | | |\ \ \ | |
215 | | | o | | 4:26a8bac39d9f |
|
215 | | | o | | 4:26a8bac39d9f | |
216 | | |/|/ / |
|
216 | | |/|/ / | |
217 | | o / / 3:27eef8ed80b4 |
|
217 | | o / / 3:27eef8ed80b4 | |
218 | |/ / / |
|
218 | |/ / / | |
219 | o / / 2:3d9a33b8d1e1 |
|
219 | o / / 2:3d9a33b8d1e1 | |
220 | |/ / |
|
220 | |/ / | |
221 | o / 1:6db2ef61d156 |
|
221 | o / 1:6db2ef61d156 | |
222 | |/ |
|
222 | |/ | |
223 | o 0:e6eb3150255d |
|
223 | o 0:e6eb3150255d | |
224 |
|
224 | |||
225 |
|
225 | |||
226 | $ hg log -G |
|
226 | $ hg log -G | |
227 | @ changeset: 34:fea3ac5810e0 |
|
227 | @ changeset: 34:fea3ac5810e0 | |
228 | | tag: tip |
|
228 | | tag: tip | |
229 | | parent: 32:d06dffa21a31 |
|
229 | | parent: 32:d06dffa21a31 | |
230 | | user: test |
|
230 | | user: test | |
231 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
231 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
232 | | summary: (34) head |
|
232 | | summary: (34) head | |
233 | | |
|
233 | | | |
234 | | o changeset: 33:68608f5145f9 |
|
234 | | o changeset: 33:68608f5145f9 | |
235 | | | parent: 18:1aa84d96232a |
|
235 | | | parent: 18:1aa84d96232a | |
236 | | | user: test |
|
236 | | | user: test | |
237 | | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
237 | | | date: Thu Jan 01 00:00:33 1970 +0000 | |
238 | | | summary: (33) head |
|
238 | | | summary: (33) head | |
239 | | | |
|
239 | | | | |
240 | o | changeset: 32:d06dffa21a31 |
|
240 | o | changeset: 32:d06dffa21a31 | |
241 | |\ \ parent: 27:886ed638191b |
|
241 | |\ \ parent: 27:886ed638191b | |
242 | | | | parent: 31:621d83e11f67 |
|
242 | | | | parent: 31:621d83e11f67 | |
243 | | | | user: test |
|
243 | | | | user: test | |
244 | | | | date: Thu Jan 01 00:00:32 1970 +0000 |
|
244 | | | | date: Thu Jan 01 00:00:32 1970 +0000 | |
245 | | | | summary: (32) expand |
|
245 | | | | summary: (32) expand | |
246 | | | | |
|
246 | | | | | |
247 | | o | changeset: 31:621d83e11f67 |
|
247 | | o | changeset: 31:621d83e11f67 | |
248 | | |\ \ parent: 21:d42a756af44d |
|
248 | | |\ \ parent: 21:d42a756af44d | |
249 | | | | | parent: 30:6e11cd4b648f |
|
249 | | | | | parent: 30:6e11cd4b648f | |
250 | | | | | user: test |
|
250 | | | | | user: test | |
251 | | | | | date: Thu Jan 01 00:00:31 1970 +0000 |
|
251 | | | | | date: Thu Jan 01 00:00:31 1970 +0000 | |
252 | | | | | summary: (31) expand |
|
252 | | | | | summary: (31) expand | |
253 | | | | | |
|
253 | | | | | | |
254 | | | o | changeset: 30:6e11cd4b648f |
|
254 | | | o | changeset: 30:6e11cd4b648f | |
255 | | | |\ \ parent: 28:44ecd0b9ae99 |
|
255 | | | |\ \ parent: 28:44ecd0b9ae99 | |
256 | | | | | | parent: 29:cd9bb2be7593 |
|
256 | | | | | | parent: 29:cd9bb2be7593 | |
257 | | | | | | user: test |
|
257 | | | | | | user: test | |
258 | | | | | | date: Thu Jan 01 00:00:30 1970 +0000 |
|
258 | | | | | | date: Thu Jan 01 00:00:30 1970 +0000 | |
259 | | | | | | summary: (30) expand |
|
259 | | | | | | summary: (30) expand | |
260 | | | | | | |
|
260 | | | | | | | |
261 | | | | o | changeset: 29:cd9bb2be7593 |
|
261 | | | | o | changeset: 29:cd9bb2be7593 | |
262 | | | | | | parent: 0:e6eb3150255d |
|
262 | | | | | | parent: 0:e6eb3150255d | |
263 | | | | | | user: test |
|
263 | | | | | | user: test | |
264 | | | | | | date: Thu Jan 01 00:00:29 1970 +0000 |
|
264 | | | | | | date: Thu Jan 01 00:00:29 1970 +0000 | |
265 | | | | | | summary: (29) regular commit |
|
265 | | | | | | summary: (29) regular commit | |
266 | | | | | | |
|
266 | | | | | | | |
267 | | | o | | changeset: 28:44ecd0b9ae99 |
|
267 | | | o | | changeset: 28:44ecd0b9ae99 | |
268 | | | |\ \ \ parent: 1:6db2ef61d156 |
|
268 | | | |\ \ \ parent: 1:6db2ef61d156 | |
269 | | | | | | | parent: 26:7f25b6c2f0b9 |
|
269 | | | | | | | parent: 26:7f25b6c2f0b9 | |
270 | | | | | | | user: test |
|
270 | | | | | | | user: test | |
271 | | | | | | | date: Thu Jan 01 00:00:28 1970 +0000 |
|
271 | | | | | | | date: Thu Jan 01 00:00:28 1970 +0000 | |
272 | | | | | | | summary: (28) merge zero known |
|
272 | | | | | | | summary: (28) merge zero known | |
273 | | | | | | | |
|
273 | | | | | | | | |
274 | o | | | | | changeset: 27:886ed638191b |
|
274 | o | | | | | changeset: 27:886ed638191b | |
275 | |/ / / / / parent: 21:d42a756af44d |
|
275 | |/ / / / / parent: 21:d42a756af44d | |
276 | | | | | | user: test |
|
276 | | | | | | user: test | |
277 | | | | | | date: Thu Jan 01 00:00:27 1970 +0000 |
|
277 | | | | | | date: Thu Jan 01 00:00:27 1970 +0000 | |
278 | | | | | | summary: (27) collapse |
|
278 | | | | | | summary: (27) collapse | |
279 | | | | | | |
|
279 | | | | | | | |
280 | | | o---+ changeset: 26:7f25b6c2f0b9 |
|
280 | | | o---+ changeset: 26:7f25b6c2f0b9 | |
281 | | | | | | parent: 18:1aa84d96232a |
|
281 | | | | | | parent: 18:1aa84d96232a | |
282 | | | | | | parent: 25:91da8ed57247 |
|
282 | | | | | | parent: 25:91da8ed57247 | |
283 | | | | | | user: test |
|
283 | | | | | | user: test | |
284 | | | | | | date: Thu Jan 01 00:00:26 1970 +0000 |
|
284 | | | | | | date: Thu Jan 01 00:00:26 1970 +0000 | |
285 | | | | | | summary: (26) merge one known; far right |
|
285 | | | | | | summary: (26) merge one known; far right | |
286 | | | | | | |
|
286 | | | | | | | |
287 | +---o | | changeset: 25:91da8ed57247 |
|
287 | +---o | | changeset: 25:91da8ed57247 | |
288 | | | | | | parent: 21:d42a756af44d |
|
288 | | | | | | parent: 21:d42a756af44d | |
289 | | | | | | parent: 24:a9c19a3d96b7 |
|
289 | | | | | | parent: 24:a9c19a3d96b7 | |
290 | | | | | | user: test |
|
290 | | | | | | user: test | |
291 | | | | | | date: Thu Jan 01 00:00:25 1970 +0000 |
|
291 | | | | | | date: Thu Jan 01 00:00:25 1970 +0000 | |
292 | | | | | | summary: (25) merge one known; far left |
|
292 | | | | | | summary: (25) merge one known; far left | |
293 | | | | | | |
|
293 | | | | | | | |
294 | | | o | | changeset: 24:a9c19a3d96b7 |
|
294 | | | o | | changeset: 24:a9c19a3d96b7 | |
295 | | | |\| | parent: 0:e6eb3150255d |
|
295 | | | |\| | parent: 0:e6eb3150255d | |
296 | | | | | | parent: 23:a01cddf0766d |
|
296 | | | | | | parent: 23:a01cddf0766d | |
297 | | | | | | user: test |
|
297 | | | | | | user: test | |
298 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000 |
|
298 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000 | |
299 | | | | | | summary: (24) merge one known; immediate right |
|
299 | | | | | | summary: (24) merge one known; immediate right | |
300 | | | | | | |
|
300 | | | | | | | |
301 | | | o | | changeset: 23:a01cddf0766d |
|
301 | | | o | | changeset: 23:a01cddf0766d | |
302 | | |/| | | parent: 1:6db2ef61d156 |
|
302 | | |/| | | parent: 1:6db2ef61d156 | |
303 | | | | | | parent: 22:e0d9cccacb5d |
|
303 | | | | | | parent: 22:e0d9cccacb5d | |
304 | | | | | | user: test |
|
304 | | | | | | user: test | |
305 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000 |
|
305 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000 | |
306 | | | | | | summary: (23) merge one known; immediate left |
|
306 | | | | | | summary: (23) merge one known; immediate left | |
307 | | | | | | |
|
307 | | | | | | | |
308 | +---o---+ changeset: 22:e0d9cccacb5d |
|
308 | +---o---+ changeset: 22:e0d9cccacb5d | |
309 | | | | | parent: 18:1aa84d96232a |
|
309 | | | | | parent: 18:1aa84d96232a | |
310 | | | / / parent: 21:d42a756af44d |
|
310 | | | / / parent: 21:d42a756af44d | |
311 | | | | | user: test |
|
311 | | | | | user: test | |
312 | | | | | date: Thu Jan 01 00:00:22 1970 +0000 |
|
312 | | | | | date: Thu Jan 01 00:00:22 1970 +0000 | |
313 | | | | | summary: (22) merge two known; one far left, one far right |
|
313 | | | | | summary: (22) merge two known; one far left, one far right | |
314 | | | | | |
|
314 | | | | | | |
315 | o | | | changeset: 21:d42a756af44d |
|
315 | o | | | changeset: 21:d42a756af44d | |
316 | |\ \ \ \ parent: 19:31ddc2c1573b |
|
316 | |\ \ \ \ parent: 19:31ddc2c1573b | |
317 | | | | | | parent: 20:d30ed6450e32 |
|
317 | | | | | | parent: 20:d30ed6450e32 | |
318 | | | | | | user: test |
|
318 | | | | | | user: test | |
319 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000 |
|
319 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000 | |
320 | | | | | | summary: (21) expand |
|
320 | | | | | | summary: (21) expand | |
321 | | | | | | |
|
321 | | | | | | | |
322 | | o---+-+ changeset: 20:d30ed6450e32 |
|
322 | | o---+-+ changeset: 20:d30ed6450e32 | |
323 | | | | | parent: 0:e6eb3150255d |
|
323 | | | | | parent: 0:e6eb3150255d | |
324 | | / / / parent: 18:1aa84d96232a |
|
324 | | / / / parent: 18:1aa84d96232a | |
325 | | | | | user: test |
|
325 | | | | | user: test | |
326 | | | | | date: Thu Jan 01 00:00:20 1970 +0000 |
|
326 | | | | | date: Thu Jan 01 00:00:20 1970 +0000 | |
327 | | | | | summary: (20) merge two known; two far right |
|
327 | | | | | summary: (20) merge two known; two far right | |
328 | | | | | |
|
328 | | | | | | |
329 | o | | | changeset: 19:31ddc2c1573b |
|
329 | o | | | changeset: 19:31ddc2c1573b | |
330 | |\ \ \ \ parent: 15:1dda3f72782d |
|
330 | |\ \ \ \ parent: 15:1dda3f72782d | |
331 | | | | | | parent: 17:44765d7c06e0 |
|
331 | | | | | | parent: 17:44765d7c06e0 | |
332 | | | | | | user: test |
|
332 | | | | | | user: test | |
333 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000 |
|
333 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000 | |
334 | | | | | | summary: (19) expand |
|
334 | | | | | | summary: (19) expand | |
335 | | | | | | |
|
335 | | | | | | | |
336 | +---+---o changeset: 18:1aa84d96232a |
|
336 | +---+---o changeset: 18:1aa84d96232a | |
337 | | | | | parent: 1:6db2ef61d156 |
|
337 | | | | | parent: 1:6db2ef61d156 | |
338 | | | | | parent: 15:1dda3f72782d |
|
338 | | | | | parent: 15:1dda3f72782d | |
339 | | | | | user: test |
|
339 | | | | | user: test | |
340 | | | | | date: Thu Jan 01 00:00:18 1970 +0000 |
|
340 | | | | | date: Thu Jan 01 00:00:18 1970 +0000 | |
341 | | | | | summary: (18) merge two known; two far left |
|
341 | | | | | summary: (18) merge two known; two far left | |
342 | | | | | |
|
342 | | | | | | |
343 | | o | | changeset: 17:44765d7c06e0 |
|
343 | | o | | changeset: 17:44765d7c06e0 | |
344 | | |\ \ \ parent: 12:86b91144a6e9 |
|
344 | | |\ \ \ parent: 12:86b91144a6e9 | |
345 | | | | | | parent: 16:3677d192927d |
|
345 | | | | | | parent: 16:3677d192927d | |
346 | | | | | | user: test |
|
346 | | | | | | user: test | |
347 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000 |
|
347 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000 | |
348 | | | | | | summary: (17) expand |
|
348 | | | | | | summary: (17) expand | |
349 | | | | | | |
|
349 | | | | | | | |
350 | | | o---+ changeset: 16:3677d192927d |
|
350 | | | o---+ changeset: 16:3677d192927d | |
351 | | | | | | parent: 0:e6eb3150255d |
|
351 | | | | | | parent: 0:e6eb3150255d | |
352 | | | |/ / parent: 1:6db2ef61d156 |
|
352 | | | |/ / parent: 1:6db2ef61d156 | |
353 | | | | | user: test |
|
353 | | | | | user: test | |
354 | | | | | date: Thu Jan 01 00:00:16 1970 +0000 |
|
354 | | | | | date: Thu Jan 01 00:00:16 1970 +0000 | |
355 | | | | | summary: (16) merge two known; one immediate right, one near right |
|
355 | | | | | summary: (16) merge two known; one immediate right, one near right | |
356 | | | | | |
|
356 | | | | | | |
357 | o | | | changeset: 15:1dda3f72782d |
|
357 | o | | | changeset: 15:1dda3f72782d | |
358 | |\ \ \ \ parent: 13:22d8966a97e3 |
|
358 | |\ \ \ \ parent: 13:22d8966a97e3 | |
359 | | | | | | parent: 14:8eac370358ef |
|
359 | | | | | | parent: 14:8eac370358ef | |
360 | | | | | | user: test |
|
360 | | | | | | user: test | |
361 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000 |
|
361 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000 | |
362 | | | | | | summary: (15) expand |
|
362 | | | | | | summary: (15) expand | |
363 | | | | | | |
|
363 | | | | | | | |
364 | | o-----+ changeset: 14:8eac370358ef |
|
364 | | o-----+ changeset: 14:8eac370358ef | |
365 | | | | | | parent: 0:e6eb3150255d |
|
365 | | | | | | parent: 0:e6eb3150255d | |
366 | | |/ / / parent: 12:86b91144a6e9 |
|
366 | | |/ / / parent: 12:86b91144a6e9 | |
367 | | | | | user: test |
|
367 | | | | | user: test | |
368 | | | | | date: Thu Jan 01 00:00:14 1970 +0000 |
|
368 | | | | | date: Thu Jan 01 00:00:14 1970 +0000 | |
369 | | | | | summary: (14) merge two known; one immediate right, one far right |
|
369 | | | | | summary: (14) merge two known; one immediate right, one far right | |
370 | | | | | |
|
370 | | | | | | |
371 | o | | | changeset: 13:22d8966a97e3 |
|
371 | o | | | changeset: 13:22d8966a97e3 | |
372 | |\ \ \ \ parent: 9:7010c0af0a35 |
|
372 | |\ \ \ \ parent: 9:7010c0af0a35 | |
373 | | | | | | parent: 11:832d76e6bdf2 |
|
373 | | | | | | parent: 11:832d76e6bdf2 | |
374 | | | | | | user: test |
|
374 | | | | | | user: test | |
375 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000 |
|
375 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000 | |
376 | | | | | | summary: (13) expand |
|
376 | | | | | | summary: (13) expand | |
377 | | | | | | |
|
377 | | | | | | | |
378 | +---o | | changeset: 12:86b91144a6e9 |
|
378 | +---o | | changeset: 12:86b91144a6e9 | |
379 | | | |/ / parent: 1:6db2ef61d156 |
|
379 | | | |/ / parent: 1:6db2ef61d156 | |
380 | | | | | parent: 9:7010c0af0a35 |
|
380 | | | | | parent: 9:7010c0af0a35 | |
381 | | | | | user: test |
|
381 | | | | | user: test | |
382 | | | | | date: Thu Jan 01 00:00:12 1970 +0000 |
|
382 | | | | | date: Thu Jan 01 00:00:12 1970 +0000 | |
383 | | | | | summary: (12) merge two known; one immediate right, one far left |
|
383 | | | | | summary: (12) merge two known; one immediate right, one far left | |
384 | | | | | |
|
384 | | | | | | |
385 | | o | | changeset: 11:832d76e6bdf2 |
|
385 | | o | | changeset: 11:832d76e6bdf2 | |
386 | | |\ \ \ parent: 6:b105a072e251 |
|
386 | | |\ \ \ parent: 6:b105a072e251 | |
387 | | | | | | parent: 10:74c64d036d72 |
|
387 | | | | | | parent: 10:74c64d036d72 | |
388 | | | | | | user: test |
|
388 | | | | | | user: test | |
389 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000 |
|
389 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000 | |
390 | | | | | | summary: (11) expand |
|
390 | | | | | | summary: (11) expand | |
391 | | | | | | |
|
391 | | | | | | | |
392 | | | o---+ changeset: 10:74c64d036d72 |
|
392 | | | o---+ changeset: 10:74c64d036d72 | |
393 | | | | | | parent: 0:e6eb3150255d |
|
393 | | | | | | parent: 0:e6eb3150255d | |
394 | | |/ / / parent: 6:b105a072e251 |
|
394 | | |/ / / parent: 6:b105a072e251 | |
395 | | | | | user: test |
|
395 | | | | | user: test | |
396 | | | | | date: Thu Jan 01 00:00:10 1970 +0000 |
|
396 | | | | | date: Thu Jan 01 00:00:10 1970 +0000 | |
397 | | | | | summary: (10) merge two known; one immediate left, one near right |
|
397 | | | | | summary: (10) merge two known; one immediate left, one near right | |
398 | | | | | |
|
398 | | | | | | |
399 | o | | | changeset: 9:7010c0af0a35 |
|
399 | o | | | changeset: 9:7010c0af0a35 | |
400 | |\ \ \ \ parent: 7:b632bb1b1224 |
|
400 | |\ \ \ \ parent: 7:b632bb1b1224 | |
401 | | | | | | parent: 8:7a0b11f71937 |
|
401 | | | | | | parent: 8:7a0b11f71937 | |
402 | | | | | | user: test |
|
402 | | | | | | user: test | |
403 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000 |
|
403 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000 | |
404 | | | | | | summary: (9) expand |
|
404 | | | | | | summary: (9) expand | |
405 | | | | | | |
|
405 | | | | | | | |
406 | | o-----+ changeset: 8:7a0b11f71937 |
|
406 | | o-----+ changeset: 8:7a0b11f71937 | |
407 | | | | | | parent: 0:e6eb3150255d |
|
407 | | | | | | parent: 0:e6eb3150255d | |
408 | |/ / / / parent: 7:b632bb1b1224 |
|
408 | |/ / / / parent: 7:b632bb1b1224 | |
409 | | | | | user: test |
|
409 | | | | | user: test | |
410 | | | | | date: Thu Jan 01 00:00:08 1970 +0000 |
|
410 | | | | | date: Thu Jan 01 00:00:08 1970 +0000 | |
411 | | | | | summary: (8) merge two known; one immediate left, one far right |
|
411 | | | | | summary: (8) merge two known; one immediate left, one far right | |
412 | | | | | |
|
412 | | | | | | |
413 | o | | | changeset: 7:b632bb1b1224 |
|
413 | o | | | changeset: 7:b632bb1b1224 | |
414 | |\ \ \ \ parent: 2:3d9a33b8d1e1 |
|
414 | |\ \ \ \ parent: 2:3d9a33b8d1e1 | |
415 | | | | | | parent: 5:4409d547b708 |
|
415 | | | | | | parent: 5:4409d547b708 | |
416 | | | | | | user: test |
|
416 | | | | | | user: test | |
417 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000 |
|
417 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000 | |
418 | | | | | | summary: (7) expand |
|
418 | | | | | | summary: (7) expand | |
419 | | | | | | |
|
419 | | | | | | | |
420 | +---o | | changeset: 6:b105a072e251 |
|
420 | +---o | | changeset: 6:b105a072e251 | |
421 | | |/ / / parent: 2:3d9a33b8d1e1 |
|
421 | | |/ / / parent: 2:3d9a33b8d1e1 | |
422 | | | | | parent: 5:4409d547b708 |
|
422 | | | | | parent: 5:4409d547b708 | |
423 | | | | | user: test |
|
423 | | | | | user: test | |
424 | | | | | date: Thu Jan 01 00:00:06 1970 +0000 |
|
424 | | | | | date: Thu Jan 01 00:00:06 1970 +0000 | |
425 | | | | | summary: (6) merge two known; one immediate left, one far left |
|
425 | | | | | summary: (6) merge two known; one immediate left, one far left | |
426 | | | | | |
|
426 | | | | | | |
427 | | o | | changeset: 5:4409d547b708 |
|
427 | | o | | changeset: 5:4409d547b708 | |
428 | | |\ \ \ parent: 3:27eef8ed80b4 |
|
428 | | |\ \ \ parent: 3:27eef8ed80b4 | |
429 | | | | | | parent: 4:26a8bac39d9f |
|
429 | | | | | | parent: 4:26a8bac39d9f | |
430 | | | | | | user: test |
|
430 | | | | | | user: test | |
431 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000 |
|
431 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000 | |
432 | | | | | | summary: (5) expand |
|
432 | | | | | | summary: (5) expand | |
433 | | | | | | |
|
433 | | | | | | | |
434 | | | o | | changeset: 4:26a8bac39d9f |
|
434 | | | o | | changeset: 4:26a8bac39d9f | |
435 | | |/|/ / parent: 1:6db2ef61d156 |
|
435 | | |/|/ / parent: 1:6db2ef61d156 | |
436 | | | | | parent: 3:27eef8ed80b4 |
|
436 | | | | | parent: 3:27eef8ed80b4 | |
437 | | | | | user: test |
|
437 | | | | | user: test | |
438 | | | | | date: Thu Jan 01 00:00:04 1970 +0000 |
|
438 | | | | | date: Thu Jan 01 00:00:04 1970 +0000 | |
439 | | | | | summary: (4) merge two known; one immediate left, one immediate right |
|
439 | | | | | summary: (4) merge two known; one immediate left, one immediate right | |
440 | | | | | |
|
440 | | | | | | |
441 | | o | | changeset: 3:27eef8ed80b4 |
|
441 | | o | | changeset: 3:27eef8ed80b4 | |
442 | |/ / / user: test |
|
442 | |/ / / user: test | |
443 | | | | date: Thu Jan 01 00:00:03 1970 +0000 |
|
443 | | | | date: Thu Jan 01 00:00:03 1970 +0000 | |
444 | | | | summary: (3) collapse |
|
444 | | | | summary: (3) collapse | |
445 | | | | |
|
445 | | | | | |
446 | o | | changeset: 2:3d9a33b8d1e1 |
|
446 | o | | changeset: 2:3d9a33b8d1e1 | |
447 | |/ / user: test |
|
447 | |/ / user: test | |
448 | | | date: Thu Jan 01 00:00:02 1970 +0000 |
|
448 | | | date: Thu Jan 01 00:00:02 1970 +0000 | |
449 | | | summary: (2) collapse |
|
449 | | | summary: (2) collapse | |
450 | | | |
|
450 | | | | |
451 | o | changeset: 1:6db2ef61d156 |
|
451 | o | changeset: 1:6db2ef61d156 | |
452 | |/ user: test |
|
452 | |/ user: test | |
453 | | date: Thu Jan 01 00:00:01 1970 +0000 |
|
453 | | date: Thu Jan 01 00:00:01 1970 +0000 | |
454 | | summary: (1) collapse |
|
454 | | summary: (1) collapse | |
455 | | |
|
455 | | | |
456 | o changeset: 0:e6eb3150255d |
|
456 | o changeset: 0:e6eb3150255d | |
457 | user: test |
|
457 | user: test | |
458 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
458 | date: Thu Jan 01 00:00:00 1970 +0000 | |
459 | summary: (0) root |
|
459 | summary: (0) root | |
460 |
|
460 | |||
461 |
|
461 | |||
462 | File glog: |
|
462 | File glog: | |
463 | $ hg log -G a |
|
463 | $ hg log -G a | |
464 | @ changeset: 34:fea3ac5810e0 |
|
464 | @ changeset: 34:fea3ac5810e0 | |
465 | | tag: tip |
|
465 | | tag: tip | |
466 | | parent: 32:d06dffa21a31 |
|
466 | | parent: 32:d06dffa21a31 | |
467 | | user: test |
|
467 | | user: test | |
468 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
468 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
469 | | summary: (34) head |
|
469 | | summary: (34) head | |
470 | | |
|
470 | | | |
471 | | o changeset: 33:68608f5145f9 |
|
471 | | o changeset: 33:68608f5145f9 | |
472 | | | parent: 18:1aa84d96232a |
|
472 | | | parent: 18:1aa84d96232a | |
473 | | | user: test |
|
473 | | | user: test | |
474 | | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
474 | | | date: Thu Jan 01 00:00:33 1970 +0000 | |
475 | | | summary: (33) head |
|
475 | | | summary: (33) head | |
476 | | | |
|
476 | | | | |
477 | o | changeset: 32:d06dffa21a31 |
|
477 | o | changeset: 32:d06dffa21a31 | |
478 | |\ \ parent: 27:886ed638191b |
|
478 | |\ \ parent: 27:886ed638191b | |
479 | | | | parent: 31:621d83e11f67 |
|
479 | | | | parent: 31:621d83e11f67 | |
480 | | | | user: test |
|
480 | | | | user: test | |
481 | | | | date: Thu Jan 01 00:00:32 1970 +0000 |
|
481 | | | | date: Thu Jan 01 00:00:32 1970 +0000 | |
482 | | | | summary: (32) expand |
|
482 | | | | summary: (32) expand | |
483 | | | | |
|
483 | | | | | |
484 | | o | changeset: 31:621d83e11f67 |
|
484 | | o | changeset: 31:621d83e11f67 | |
485 | | |\ \ parent: 21:d42a756af44d |
|
485 | | |\ \ parent: 21:d42a756af44d | |
486 | | | | | parent: 30:6e11cd4b648f |
|
486 | | | | | parent: 30:6e11cd4b648f | |
487 | | | | | user: test |
|
487 | | | | | user: test | |
488 | | | | | date: Thu Jan 01 00:00:31 1970 +0000 |
|
488 | | | | | date: Thu Jan 01 00:00:31 1970 +0000 | |
489 | | | | | summary: (31) expand |
|
489 | | | | | summary: (31) expand | |
490 | | | | | |
|
490 | | | | | | |
491 | | | o | changeset: 30:6e11cd4b648f |
|
491 | | | o | changeset: 30:6e11cd4b648f | |
492 | | | |\ \ parent: 28:44ecd0b9ae99 |
|
492 | | | |\ \ parent: 28:44ecd0b9ae99 | |
493 | | | | | | parent: 29:cd9bb2be7593 |
|
493 | | | | | | parent: 29:cd9bb2be7593 | |
494 | | | | | | user: test |
|
494 | | | | | | user: test | |
495 | | | | | | date: Thu Jan 01 00:00:30 1970 +0000 |
|
495 | | | | | | date: Thu Jan 01 00:00:30 1970 +0000 | |
496 | | | | | | summary: (30) expand |
|
496 | | | | | | summary: (30) expand | |
497 | | | | | | |
|
497 | | | | | | | |
498 | | | | o | changeset: 29:cd9bb2be7593 |
|
498 | | | | o | changeset: 29:cd9bb2be7593 | |
499 | | | | | | parent: 0:e6eb3150255d |
|
499 | | | | | | parent: 0:e6eb3150255d | |
500 | | | | | | user: test |
|
500 | | | | | | user: test | |
501 | | | | | | date: Thu Jan 01 00:00:29 1970 +0000 |
|
501 | | | | | | date: Thu Jan 01 00:00:29 1970 +0000 | |
502 | | | | | | summary: (29) regular commit |
|
502 | | | | | | summary: (29) regular commit | |
503 | | | | | | |
|
503 | | | | | | | |
504 | | | o | | changeset: 28:44ecd0b9ae99 |
|
504 | | | o | | changeset: 28:44ecd0b9ae99 | |
505 | | | |\ \ \ parent: 1:6db2ef61d156 |
|
505 | | | |\ \ \ parent: 1:6db2ef61d156 | |
506 | | | | | | | parent: 26:7f25b6c2f0b9 |
|
506 | | | | | | | parent: 26:7f25b6c2f0b9 | |
507 | | | | | | | user: test |
|
507 | | | | | | | user: test | |
508 | | | | | | | date: Thu Jan 01 00:00:28 1970 +0000 |
|
508 | | | | | | | date: Thu Jan 01 00:00:28 1970 +0000 | |
509 | | | | | | | summary: (28) merge zero known |
|
509 | | | | | | | summary: (28) merge zero known | |
510 | | | | | | | |
|
510 | | | | | | | | |
511 | o | | | | | changeset: 27:886ed638191b |
|
511 | o | | | | | changeset: 27:886ed638191b | |
512 | |/ / / / / parent: 21:d42a756af44d |
|
512 | |/ / / / / parent: 21:d42a756af44d | |
513 | | | | | | user: test |
|
513 | | | | | | user: test | |
514 | | | | | | date: Thu Jan 01 00:00:27 1970 +0000 |
|
514 | | | | | | date: Thu Jan 01 00:00:27 1970 +0000 | |
515 | | | | | | summary: (27) collapse |
|
515 | | | | | | summary: (27) collapse | |
516 | | | | | | |
|
516 | | | | | | | |
517 | | | o---+ changeset: 26:7f25b6c2f0b9 |
|
517 | | | o---+ changeset: 26:7f25b6c2f0b9 | |
518 | | | | | | parent: 18:1aa84d96232a |
|
518 | | | | | | parent: 18:1aa84d96232a | |
519 | | | | | | parent: 25:91da8ed57247 |
|
519 | | | | | | parent: 25:91da8ed57247 | |
520 | | | | | | user: test |
|
520 | | | | | | user: test | |
521 | | | | | | date: Thu Jan 01 00:00:26 1970 +0000 |
|
521 | | | | | | date: Thu Jan 01 00:00:26 1970 +0000 | |
522 | | | | | | summary: (26) merge one known; far right |
|
522 | | | | | | summary: (26) merge one known; far right | |
523 | | | | | | |
|
523 | | | | | | | |
524 | +---o | | changeset: 25:91da8ed57247 |
|
524 | +---o | | changeset: 25:91da8ed57247 | |
525 | | | | | | parent: 21:d42a756af44d |
|
525 | | | | | | parent: 21:d42a756af44d | |
526 | | | | | | parent: 24:a9c19a3d96b7 |
|
526 | | | | | | parent: 24:a9c19a3d96b7 | |
527 | | | | | | user: test |
|
527 | | | | | | user: test | |
528 | | | | | | date: Thu Jan 01 00:00:25 1970 +0000 |
|
528 | | | | | | date: Thu Jan 01 00:00:25 1970 +0000 | |
529 | | | | | | summary: (25) merge one known; far left |
|
529 | | | | | | summary: (25) merge one known; far left | |
530 | | | | | | |
|
530 | | | | | | | |
531 | | | o | | changeset: 24:a9c19a3d96b7 |
|
531 | | | o | | changeset: 24:a9c19a3d96b7 | |
532 | | | |\| | parent: 0:e6eb3150255d |
|
532 | | | |\| | parent: 0:e6eb3150255d | |
533 | | | | | | parent: 23:a01cddf0766d |
|
533 | | | | | | parent: 23:a01cddf0766d | |
534 | | | | | | user: test |
|
534 | | | | | | user: test | |
535 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000 |
|
535 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000 | |
536 | | | | | | summary: (24) merge one known; immediate right |
|
536 | | | | | | summary: (24) merge one known; immediate right | |
537 | | | | | | |
|
537 | | | | | | | |
538 | | | o | | changeset: 23:a01cddf0766d |
|
538 | | | o | | changeset: 23:a01cddf0766d | |
539 | | |/| | | parent: 1:6db2ef61d156 |
|
539 | | |/| | | parent: 1:6db2ef61d156 | |
540 | | | | | | parent: 22:e0d9cccacb5d |
|
540 | | | | | | parent: 22:e0d9cccacb5d | |
541 | | | | | | user: test |
|
541 | | | | | | user: test | |
542 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000 |
|
542 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000 | |
543 | | | | | | summary: (23) merge one known; immediate left |
|
543 | | | | | | summary: (23) merge one known; immediate left | |
544 | | | | | | |
|
544 | | | | | | | |
545 | +---o---+ changeset: 22:e0d9cccacb5d |
|
545 | +---o---+ changeset: 22:e0d9cccacb5d | |
546 | | | | | parent: 18:1aa84d96232a |
|
546 | | | | | parent: 18:1aa84d96232a | |
547 | | | / / parent: 21:d42a756af44d |
|
547 | | | / / parent: 21:d42a756af44d | |
548 | | | | | user: test |
|
548 | | | | | user: test | |
549 | | | | | date: Thu Jan 01 00:00:22 1970 +0000 |
|
549 | | | | | date: Thu Jan 01 00:00:22 1970 +0000 | |
550 | | | | | summary: (22) merge two known; one far left, one far right |
|
550 | | | | | summary: (22) merge two known; one far left, one far right | |
551 | | | | | |
|
551 | | | | | | |
552 | o | | | changeset: 21:d42a756af44d |
|
552 | o | | | changeset: 21:d42a756af44d | |
553 | |\ \ \ \ parent: 19:31ddc2c1573b |
|
553 | |\ \ \ \ parent: 19:31ddc2c1573b | |
554 | | | | | | parent: 20:d30ed6450e32 |
|
554 | | | | | | parent: 20:d30ed6450e32 | |
555 | | | | | | user: test |
|
555 | | | | | | user: test | |
556 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000 |
|
556 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000 | |
557 | | | | | | summary: (21) expand |
|
557 | | | | | | summary: (21) expand | |
558 | | | | | | |
|
558 | | | | | | | |
559 | | o---+-+ changeset: 20:d30ed6450e32 |
|
559 | | o---+-+ changeset: 20:d30ed6450e32 | |
560 | | | | | parent: 0:e6eb3150255d |
|
560 | | | | | parent: 0:e6eb3150255d | |
561 | | / / / parent: 18:1aa84d96232a |
|
561 | | / / / parent: 18:1aa84d96232a | |
562 | | | | | user: test |
|
562 | | | | | user: test | |
563 | | | | | date: Thu Jan 01 00:00:20 1970 +0000 |
|
563 | | | | | date: Thu Jan 01 00:00:20 1970 +0000 | |
564 | | | | | summary: (20) merge two known; two far right |
|
564 | | | | | summary: (20) merge two known; two far right | |
565 | | | | | |
|
565 | | | | | | |
566 | o | | | changeset: 19:31ddc2c1573b |
|
566 | o | | | changeset: 19:31ddc2c1573b | |
567 | |\ \ \ \ parent: 15:1dda3f72782d |
|
567 | |\ \ \ \ parent: 15:1dda3f72782d | |
568 | | | | | | parent: 17:44765d7c06e0 |
|
568 | | | | | | parent: 17:44765d7c06e0 | |
569 | | | | | | user: test |
|
569 | | | | | | user: test | |
570 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000 |
|
570 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000 | |
571 | | | | | | summary: (19) expand |
|
571 | | | | | | summary: (19) expand | |
572 | | | | | | |
|
572 | | | | | | | |
573 | +---+---o changeset: 18:1aa84d96232a |
|
573 | +---+---o changeset: 18:1aa84d96232a | |
574 | | | | | parent: 1:6db2ef61d156 |
|
574 | | | | | parent: 1:6db2ef61d156 | |
575 | | | | | parent: 15:1dda3f72782d |
|
575 | | | | | parent: 15:1dda3f72782d | |
576 | | | | | user: test |
|
576 | | | | | user: test | |
577 | | | | | date: Thu Jan 01 00:00:18 1970 +0000 |
|
577 | | | | | date: Thu Jan 01 00:00:18 1970 +0000 | |
578 | | | | | summary: (18) merge two known; two far left |
|
578 | | | | | summary: (18) merge two known; two far left | |
579 | | | | | |
|
579 | | | | | | |
580 | | o | | changeset: 17:44765d7c06e0 |
|
580 | | o | | changeset: 17:44765d7c06e0 | |
581 | | |\ \ \ parent: 12:86b91144a6e9 |
|
581 | | |\ \ \ parent: 12:86b91144a6e9 | |
582 | | | | | | parent: 16:3677d192927d |
|
582 | | | | | | parent: 16:3677d192927d | |
583 | | | | | | user: test |
|
583 | | | | | | user: test | |
584 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000 |
|
584 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000 | |
585 | | | | | | summary: (17) expand |
|
585 | | | | | | summary: (17) expand | |
586 | | | | | | |
|
586 | | | | | | | |
587 | | | o---+ changeset: 16:3677d192927d |
|
587 | | | o---+ changeset: 16:3677d192927d | |
588 | | | | | | parent: 0:e6eb3150255d |
|
588 | | | | | | parent: 0:e6eb3150255d | |
589 | | | |/ / parent: 1:6db2ef61d156 |
|
589 | | | |/ / parent: 1:6db2ef61d156 | |
590 | | | | | user: test |
|
590 | | | | | user: test | |
591 | | | | | date: Thu Jan 01 00:00:16 1970 +0000 |
|
591 | | | | | date: Thu Jan 01 00:00:16 1970 +0000 | |
592 | | | | | summary: (16) merge two known; one immediate right, one near right |
|
592 | | | | | summary: (16) merge two known; one immediate right, one near right | |
593 | | | | | |
|
593 | | | | | | |
594 | o | | | changeset: 15:1dda3f72782d |
|
594 | o | | | changeset: 15:1dda3f72782d | |
595 | |\ \ \ \ parent: 13:22d8966a97e3 |
|
595 | |\ \ \ \ parent: 13:22d8966a97e3 | |
596 | | | | | | parent: 14:8eac370358ef |
|
596 | | | | | | parent: 14:8eac370358ef | |
597 | | | | | | user: test |
|
597 | | | | | | user: test | |
598 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000 |
|
598 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000 | |
599 | | | | | | summary: (15) expand |
|
599 | | | | | | summary: (15) expand | |
600 | | | | | | |
|
600 | | | | | | | |
601 | | o-----+ changeset: 14:8eac370358ef |
|
601 | | o-----+ changeset: 14:8eac370358ef | |
602 | | | | | | parent: 0:e6eb3150255d |
|
602 | | | | | | parent: 0:e6eb3150255d | |
603 | | |/ / / parent: 12:86b91144a6e9 |
|
603 | | |/ / / parent: 12:86b91144a6e9 | |
604 | | | | | user: test |
|
604 | | | | | user: test | |
605 | | | | | date: Thu Jan 01 00:00:14 1970 +0000 |
|
605 | | | | | date: Thu Jan 01 00:00:14 1970 +0000 | |
606 | | | | | summary: (14) merge two known; one immediate right, one far right |
|
606 | | | | | summary: (14) merge two known; one immediate right, one far right | |
607 | | | | | |
|
607 | | | | | | |
608 | o | | | changeset: 13:22d8966a97e3 |
|
608 | o | | | changeset: 13:22d8966a97e3 | |
609 | |\ \ \ \ parent: 9:7010c0af0a35 |
|
609 | |\ \ \ \ parent: 9:7010c0af0a35 | |
610 | | | | | | parent: 11:832d76e6bdf2 |
|
610 | | | | | | parent: 11:832d76e6bdf2 | |
611 | | | | | | user: test |
|
611 | | | | | | user: test | |
612 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000 |
|
612 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000 | |
613 | | | | | | summary: (13) expand |
|
613 | | | | | | summary: (13) expand | |
614 | | | | | | |
|
614 | | | | | | | |
615 | +---o | | changeset: 12:86b91144a6e9 |
|
615 | +---o | | changeset: 12:86b91144a6e9 | |
616 | | | |/ / parent: 1:6db2ef61d156 |
|
616 | | | |/ / parent: 1:6db2ef61d156 | |
617 | | | | | parent: 9:7010c0af0a35 |
|
617 | | | | | parent: 9:7010c0af0a35 | |
618 | | | | | user: test |
|
618 | | | | | user: test | |
619 | | | | | date: Thu Jan 01 00:00:12 1970 +0000 |
|
619 | | | | | date: Thu Jan 01 00:00:12 1970 +0000 | |
620 | | | | | summary: (12) merge two known; one immediate right, one far left |
|
620 | | | | | summary: (12) merge two known; one immediate right, one far left | |
621 | | | | | |
|
621 | | | | | | |
622 | | o | | changeset: 11:832d76e6bdf2 |
|
622 | | o | | changeset: 11:832d76e6bdf2 | |
623 | | |\ \ \ parent: 6:b105a072e251 |
|
623 | | |\ \ \ parent: 6:b105a072e251 | |
624 | | | | | | parent: 10:74c64d036d72 |
|
624 | | | | | | parent: 10:74c64d036d72 | |
625 | | | | | | user: test |
|
625 | | | | | | user: test | |
626 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000 |
|
626 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000 | |
627 | | | | | | summary: (11) expand |
|
627 | | | | | | summary: (11) expand | |
628 | | | | | | |
|
628 | | | | | | | |
629 | | | o---+ changeset: 10:74c64d036d72 |
|
629 | | | o---+ changeset: 10:74c64d036d72 | |
630 | | | | | | parent: 0:e6eb3150255d |
|
630 | | | | | | parent: 0:e6eb3150255d | |
631 | | |/ / / parent: 6:b105a072e251 |
|
631 | | |/ / / parent: 6:b105a072e251 | |
632 | | | | | user: test |
|
632 | | | | | user: test | |
633 | | | | | date: Thu Jan 01 00:00:10 1970 +0000 |
|
633 | | | | | date: Thu Jan 01 00:00:10 1970 +0000 | |
634 | | | | | summary: (10) merge two known; one immediate left, one near right |
|
634 | | | | | summary: (10) merge two known; one immediate left, one near right | |
635 | | | | | |
|
635 | | | | | | |
636 | o | | | changeset: 9:7010c0af0a35 |
|
636 | o | | | changeset: 9:7010c0af0a35 | |
637 | |\ \ \ \ parent: 7:b632bb1b1224 |
|
637 | |\ \ \ \ parent: 7:b632bb1b1224 | |
638 | | | | | | parent: 8:7a0b11f71937 |
|
638 | | | | | | parent: 8:7a0b11f71937 | |
639 | | | | | | user: test |
|
639 | | | | | | user: test | |
640 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000 |
|
640 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000 | |
641 | | | | | | summary: (9) expand |
|
641 | | | | | | summary: (9) expand | |
642 | | | | | | |
|
642 | | | | | | | |
643 | | o-----+ changeset: 8:7a0b11f71937 |
|
643 | | o-----+ changeset: 8:7a0b11f71937 | |
644 | | | | | | parent: 0:e6eb3150255d |
|
644 | | | | | | parent: 0:e6eb3150255d | |
645 | |/ / / / parent: 7:b632bb1b1224 |
|
645 | |/ / / / parent: 7:b632bb1b1224 | |
646 | | | | | user: test |
|
646 | | | | | user: test | |
647 | | | | | date: Thu Jan 01 00:00:08 1970 +0000 |
|
647 | | | | | date: Thu Jan 01 00:00:08 1970 +0000 | |
648 | | | | | summary: (8) merge two known; one immediate left, one far right |
|
648 | | | | | summary: (8) merge two known; one immediate left, one far right | |
649 | | | | | |
|
649 | | | | | | |
650 | o | | | changeset: 7:b632bb1b1224 |
|
650 | o | | | changeset: 7:b632bb1b1224 | |
651 | |\ \ \ \ parent: 2:3d9a33b8d1e1 |
|
651 | |\ \ \ \ parent: 2:3d9a33b8d1e1 | |
652 | | | | | | parent: 5:4409d547b708 |
|
652 | | | | | | parent: 5:4409d547b708 | |
653 | | | | | | user: test |
|
653 | | | | | | user: test | |
654 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000 |
|
654 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000 | |
655 | | | | | | summary: (7) expand |
|
655 | | | | | | summary: (7) expand | |
656 | | | | | | |
|
656 | | | | | | | |
657 | +---o | | changeset: 6:b105a072e251 |
|
657 | +---o | | changeset: 6:b105a072e251 | |
658 | | |/ / / parent: 2:3d9a33b8d1e1 |
|
658 | | |/ / / parent: 2:3d9a33b8d1e1 | |
659 | | | | | parent: 5:4409d547b708 |
|
659 | | | | | parent: 5:4409d547b708 | |
660 | | | | | user: test |
|
660 | | | | | user: test | |
661 | | | | | date: Thu Jan 01 00:00:06 1970 +0000 |
|
661 | | | | | date: Thu Jan 01 00:00:06 1970 +0000 | |
662 | | | | | summary: (6) merge two known; one immediate left, one far left |
|
662 | | | | | summary: (6) merge two known; one immediate left, one far left | |
663 | | | | | |
|
663 | | | | | | |
664 | | o | | changeset: 5:4409d547b708 |
|
664 | | o | | changeset: 5:4409d547b708 | |
665 | | |\ \ \ parent: 3:27eef8ed80b4 |
|
665 | | |\ \ \ parent: 3:27eef8ed80b4 | |
666 | | | | | | parent: 4:26a8bac39d9f |
|
666 | | | | | | parent: 4:26a8bac39d9f | |
667 | | | | | | user: test |
|
667 | | | | | | user: test | |
668 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000 |
|
668 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000 | |
669 | | | | | | summary: (5) expand |
|
669 | | | | | | summary: (5) expand | |
670 | | | | | | |
|
670 | | | | | | | |
671 | | | o | | changeset: 4:26a8bac39d9f |
|
671 | | | o | | changeset: 4:26a8bac39d9f | |
672 | | |/|/ / parent: 1:6db2ef61d156 |
|
672 | | |/|/ / parent: 1:6db2ef61d156 | |
673 | | | | | parent: 3:27eef8ed80b4 |
|
673 | | | | | parent: 3:27eef8ed80b4 | |
674 | | | | | user: test |
|
674 | | | | | user: test | |
675 | | | | | date: Thu Jan 01 00:00:04 1970 +0000 |
|
675 | | | | | date: Thu Jan 01 00:00:04 1970 +0000 | |
676 | | | | | summary: (4) merge two known; one immediate left, one immediate right |
|
676 | | | | | summary: (4) merge two known; one immediate left, one immediate right | |
677 | | | | | |
|
677 | | | | | | |
678 | | o | | changeset: 3:27eef8ed80b4 |
|
678 | | o | | changeset: 3:27eef8ed80b4 | |
679 | |/ / / user: test |
|
679 | |/ / / user: test | |
680 | | | | date: Thu Jan 01 00:00:03 1970 +0000 |
|
680 | | | | date: Thu Jan 01 00:00:03 1970 +0000 | |
681 | | | | summary: (3) collapse |
|
681 | | | | summary: (3) collapse | |
682 | | | | |
|
682 | | | | | |
683 | o | | changeset: 2:3d9a33b8d1e1 |
|
683 | o | | changeset: 2:3d9a33b8d1e1 | |
684 | |/ / user: test |
|
684 | |/ / user: test | |
685 | | | date: Thu Jan 01 00:00:02 1970 +0000 |
|
685 | | | date: Thu Jan 01 00:00:02 1970 +0000 | |
686 | | | summary: (2) collapse |
|
686 | | | summary: (2) collapse | |
687 | | | |
|
687 | | | | |
688 | o | changeset: 1:6db2ef61d156 |
|
688 | o | changeset: 1:6db2ef61d156 | |
689 | |/ user: test |
|
689 | |/ user: test | |
690 | | date: Thu Jan 01 00:00:01 1970 +0000 |
|
690 | | date: Thu Jan 01 00:00:01 1970 +0000 | |
691 | | summary: (1) collapse |
|
691 | | summary: (1) collapse | |
692 | | |
|
692 | | | |
693 | o changeset: 0:e6eb3150255d |
|
693 | o changeset: 0:e6eb3150255d | |
694 | user: test |
|
694 | user: test | |
695 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
695 | date: Thu Jan 01 00:00:00 1970 +0000 | |
696 | summary: (0) root |
|
696 | summary: (0) root | |
697 |
|
697 | |||
698 |
|
698 | |||
699 | File glog per revset: |
|
699 | File glog per revset: | |
700 |
|
700 | |||
701 | $ hg log -G -r 'file("a")' |
|
701 | $ hg log -G -r 'file("a")' | |
702 | @ changeset: 34:fea3ac5810e0 |
|
702 | @ changeset: 34:fea3ac5810e0 | |
703 | | tag: tip |
|
703 | | tag: tip | |
704 | | parent: 32:d06dffa21a31 |
|
704 | | parent: 32:d06dffa21a31 | |
705 | | user: test |
|
705 | | user: test | |
706 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
706 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
707 | | summary: (34) head |
|
707 | | summary: (34) head | |
708 | | |
|
708 | | | |
709 | | o changeset: 33:68608f5145f9 |
|
709 | | o changeset: 33:68608f5145f9 | |
710 | | | parent: 18:1aa84d96232a |
|
710 | | | parent: 18:1aa84d96232a | |
711 | | | user: test |
|
711 | | | user: test | |
712 | | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
712 | | | date: Thu Jan 01 00:00:33 1970 +0000 | |
713 | | | summary: (33) head |
|
713 | | | summary: (33) head | |
714 | | | |
|
714 | | | | |
715 | o | changeset: 32:d06dffa21a31 |
|
715 | o | changeset: 32:d06dffa21a31 | |
716 | |\ \ parent: 27:886ed638191b |
|
716 | |\ \ parent: 27:886ed638191b | |
717 | | | | parent: 31:621d83e11f67 |
|
717 | | | | parent: 31:621d83e11f67 | |
718 | | | | user: test |
|
718 | | | | user: test | |
719 | | | | date: Thu Jan 01 00:00:32 1970 +0000 |
|
719 | | | | date: Thu Jan 01 00:00:32 1970 +0000 | |
720 | | | | summary: (32) expand |
|
720 | | | | summary: (32) expand | |
721 | | | | |
|
721 | | | | | |
722 | | o | changeset: 31:621d83e11f67 |
|
722 | | o | changeset: 31:621d83e11f67 | |
723 | | |\ \ parent: 21:d42a756af44d |
|
723 | | |\ \ parent: 21:d42a756af44d | |
724 | | | | | parent: 30:6e11cd4b648f |
|
724 | | | | | parent: 30:6e11cd4b648f | |
725 | | | | | user: test |
|
725 | | | | | user: test | |
726 | | | | | date: Thu Jan 01 00:00:31 1970 +0000 |
|
726 | | | | | date: Thu Jan 01 00:00:31 1970 +0000 | |
727 | | | | | summary: (31) expand |
|
727 | | | | | summary: (31) expand | |
728 | | | | | |
|
728 | | | | | | |
729 | | | o | changeset: 30:6e11cd4b648f |
|
729 | | | o | changeset: 30:6e11cd4b648f | |
730 | | | |\ \ parent: 28:44ecd0b9ae99 |
|
730 | | | |\ \ parent: 28:44ecd0b9ae99 | |
731 | | | | | | parent: 29:cd9bb2be7593 |
|
731 | | | | | | parent: 29:cd9bb2be7593 | |
732 | | | | | | user: test |
|
732 | | | | | | user: test | |
733 | | | | | | date: Thu Jan 01 00:00:30 1970 +0000 |
|
733 | | | | | | date: Thu Jan 01 00:00:30 1970 +0000 | |
734 | | | | | | summary: (30) expand |
|
734 | | | | | | summary: (30) expand | |
735 | | | | | | |
|
735 | | | | | | | |
736 | | | | o | changeset: 29:cd9bb2be7593 |
|
736 | | | | o | changeset: 29:cd9bb2be7593 | |
737 | | | | | | parent: 0:e6eb3150255d |
|
737 | | | | | | parent: 0:e6eb3150255d | |
738 | | | | | | user: test |
|
738 | | | | | | user: test | |
739 | | | | | | date: Thu Jan 01 00:00:29 1970 +0000 |
|
739 | | | | | | date: Thu Jan 01 00:00:29 1970 +0000 | |
740 | | | | | | summary: (29) regular commit |
|
740 | | | | | | summary: (29) regular commit | |
741 | | | | | | |
|
741 | | | | | | | |
742 | | | o | | changeset: 28:44ecd0b9ae99 |
|
742 | | | o | | changeset: 28:44ecd0b9ae99 | |
743 | | | |\ \ \ parent: 1:6db2ef61d156 |
|
743 | | | |\ \ \ parent: 1:6db2ef61d156 | |
744 | | | | | | | parent: 26:7f25b6c2f0b9 |
|
744 | | | | | | | parent: 26:7f25b6c2f0b9 | |
745 | | | | | | | user: test |
|
745 | | | | | | | user: test | |
746 | | | | | | | date: Thu Jan 01 00:00:28 1970 +0000 |
|
746 | | | | | | | date: Thu Jan 01 00:00:28 1970 +0000 | |
747 | | | | | | | summary: (28) merge zero known |
|
747 | | | | | | | summary: (28) merge zero known | |
748 | | | | | | | |
|
748 | | | | | | | | |
749 | o | | | | | changeset: 27:886ed638191b |
|
749 | o | | | | | changeset: 27:886ed638191b | |
750 | |/ / / / / parent: 21:d42a756af44d |
|
750 | |/ / / / / parent: 21:d42a756af44d | |
751 | | | | | | user: test |
|
751 | | | | | | user: test | |
752 | | | | | | date: Thu Jan 01 00:00:27 1970 +0000 |
|
752 | | | | | | date: Thu Jan 01 00:00:27 1970 +0000 | |
753 | | | | | | summary: (27) collapse |
|
753 | | | | | | summary: (27) collapse | |
754 | | | | | | |
|
754 | | | | | | | |
755 | | | o---+ changeset: 26:7f25b6c2f0b9 |
|
755 | | | o---+ changeset: 26:7f25b6c2f0b9 | |
756 | | | | | | parent: 18:1aa84d96232a |
|
756 | | | | | | parent: 18:1aa84d96232a | |
757 | | | | | | parent: 25:91da8ed57247 |
|
757 | | | | | | parent: 25:91da8ed57247 | |
758 | | | | | | user: test |
|
758 | | | | | | user: test | |
759 | | | | | | date: Thu Jan 01 00:00:26 1970 +0000 |
|
759 | | | | | | date: Thu Jan 01 00:00:26 1970 +0000 | |
760 | | | | | | summary: (26) merge one known; far right |
|
760 | | | | | | summary: (26) merge one known; far right | |
761 | | | | | | |
|
761 | | | | | | | |
762 | +---o | | changeset: 25:91da8ed57247 |
|
762 | +---o | | changeset: 25:91da8ed57247 | |
763 | | | | | | parent: 21:d42a756af44d |
|
763 | | | | | | parent: 21:d42a756af44d | |
764 | | | | | | parent: 24:a9c19a3d96b7 |
|
764 | | | | | | parent: 24:a9c19a3d96b7 | |
765 | | | | | | user: test |
|
765 | | | | | | user: test | |
766 | | | | | | date: Thu Jan 01 00:00:25 1970 +0000 |
|
766 | | | | | | date: Thu Jan 01 00:00:25 1970 +0000 | |
767 | | | | | | summary: (25) merge one known; far left |
|
767 | | | | | | summary: (25) merge one known; far left | |
768 | | | | | | |
|
768 | | | | | | | |
769 | | | o | | changeset: 24:a9c19a3d96b7 |
|
769 | | | o | | changeset: 24:a9c19a3d96b7 | |
770 | | | |\| | parent: 0:e6eb3150255d |
|
770 | | | |\| | parent: 0:e6eb3150255d | |
771 | | | | | | parent: 23:a01cddf0766d |
|
771 | | | | | | parent: 23:a01cddf0766d | |
772 | | | | | | user: test |
|
772 | | | | | | user: test | |
773 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000 |
|
773 | | | | | | date: Thu Jan 01 00:00:24 1970 +0000 | |
774 | | | | | | summary: (24) merge one known; immediate right |
|
774 | | | | | | summary: (24) merge one known; immediate right | |
775 | | | | | | |
|
775 | | | | | | | |
776 | | | o | | changeset: 23:a01cddf0766d |
|
776 | | | o | | changeset: 23:a01cddf0766d | |
777 | | |/| | | parent: 1:6db2ef61d156 |
|
777 | | |/| | | parent: 1:6db2ef61d156 | |
778 | | | | | | parent: 22:e0d9cccacb5d |
|
778 | | | | | | parent: 22:e0d9cccacb5d | |
779 | | | | | | user: test |
|
779 | | | | | | user: test | |
780 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000 |
|
780 | | | | | | date: Thu Jan 01 00:00:23 1970 +0000 | |
781 | | | | | | summary: (23) merge one known; immediate left |
|
781 | | | | | | summary: (23) merge one known; immediate left | |
782 | | | | | | |
|
782 | | | | | | | |
783 | +---o---+ changeset: 22:e0d9cccacb5d |
|
783 | +---o---+ changeset: 22:e0d9cccacb5d | |
784 | | | | | parent: 18:1aa84d96232a |
|
784 | | | | | parent: 18:1aa84d96232a | |
785 | | | / / parent: 21:d42a756af44d |
|
785 | | | / / parent: 21:d42a756af44d | |
786 | | | | | user: test |
|
786 | | | | | user: test | |
787 | | | | | date: Thu Jan 01 00:00:22 1970 +0000 |
|
787 | | | | | date: Thu Jan 01 00:00:22 1970 +0000 | |
788 | | | | | summary: (22) merge two known; one far left, one far right |
|
788 | | | | | summary: (22) merge two known; one far left, one far right | |
789 | | | | | |
|
789 | | | | | | |
790 | o | | | changeset: 21:d42a756af44d |
|
790 | o | | | changeset: 21:d42a756af44d | |
791 | |\ \ \ \ parent: 19:31ddc2c1573b |
|
791 | |\ \ \ \ parent: 19:31ddc2c1573b | |
792 | | | | | | parent: 20:d30ed6450e32 |
|
792 | | | | | | parent: 20:d30ed6450e32 | |
793 | | | | | | user: test |
|
793 | | | | | | user: test | |
794 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000 |
|
794 | | | | | | date: Thu Jan 01 00:00:21 1970 +0000 | |
795 | | | | | | summary: (21) expand |
|
795 | | | | | | summary: (21) expand | |
796 | | | | | | |
|
796 | | | | | | | |
797 | | o---+-+ changeset: 20:d30ed6450e32 |
|
797 | | o---+-+ changeset: 20:d30ed6450e32 | |
798 | | | | | parent: 0:e6eb3150255d |
|
798 | | | | | parent: 0:e6eb3150255d | |
799 | | / / / parent: 18:1aa84d96232a |
|
799 | | / / / parent: 18:1aa84d96232a | |
800 | | | | | user: test |
|
800 | | | | | user: test | |
801 | | | | | date: Thu Jan 01 00:00:20 1970 +0000 |
|
801 | | | | | date: Thu Jan 01 00:00:20 1970 +0000 | |
802 | | | | | summary: (20) merge two known; two far right |
|
802 | | | | | summary: (20) merge two known; two far right | |
803 | | | | | |
|
803 | | | | | | |
804 | o | | | changeset: 19:31ddc2c1573b |
|
804 | o | | | changeset: 19:31ddc2c1573b | |
805 | |\ \ \ \ parent: 15:1dda3f72782d |
|
805 | |\ \ \ \ parent: 15:1dda3f72782d | |
806 | | | | | | parent: 17:44765d7c06e0 |
|
806 | | | | | | parent: 17:44765d7c06e0 | |
807 | | | | | | user: test |
|
807 | | | | | | user: test | |
808 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000 |
|
808 | | | | | | date: Thu Jan 01 00:00:19 1970 +0000 | |
809 | | | | | | summary: (19) expand |
|
809 | | | | | | summary: (19) expand | |
810 | | | | | | |
|
810 | | | | | | | |
811 | +---+---o changeset: 18:1aa84d96232a |
|
811 | +---+---o changeset: 18:1aa84d96232a | |
812 | | | | | parent: 1:6db2ef61d156 |
|
812 | | | | | parent: 1:6db2ef61d156 | |
813 | | | | | parent: 15:1dda3f72782d |
|
813 | | | | | parent: 15:1dda3f72782d | |
814 | | | | | user: test |
|
814 | | | | | user: test | |
815 | | | | | date: Thu Jan 01 00:00:18 1970 +0000 |
|
815 | | | | | date: Thu Jan 01 00:00:18 1970 +0000 | |
816 | | | | | summary: (18) merge two known; two far left |
|
816 | | | | | summary: (18) merge two known; two far left | |
817 | | | | | |
|
817 | | | | | | |
818 | | o | | changeset: 17:44765d7c06e0 |
|
818 | | o | | changeset: 17:44765d7c06e0 | |
819 | | |\ \ \ parent: 12:86b91144a6e9 |
|
819 | | |\ \ \ parent: 12:86b91144a6e9 | |
820 | | | | | | parent: 16:3677d192927d |
|
820 | | | | | | parent: 16:3677d192927d | |
821 | | | | | | user: test |
|
821 | | | | | | user: test | |
822 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000 |
|
822 | | | | | | date: Thu Jan 01 00:00:17 1970 +0000 | |
823 | | | | | | summary: (17) expand |
|
823 | | | | | | summary: (17) expand | |
824 | | | | | | |
|
824 | | | | | | | |
825 | | | o---+ changeset: 16:3677d192927d |
|
825 | | | o---+ changeset: 16:3677d192927d | |
826 | | | | | | parent: 0:e6eb3150255d |
|
826 | | | | | | parent: 0:e6eb3150255d | |
827 | | | |/ / parent: 1:6db2ef61d156 |
|
827 | | | |/ / parent: 1:6db2ef61d156 | |
828 | | | | | user: test |
|
828 | | | | | user: test | |
829 | | | | | date: Thu Jan 01 00:00:16 1970 +0000 |
|
829 | | | | | date: Thu Jan 01 00:00:16 1970 +0000 | |
830 | | | | | summary: (16) merge two known; one immediate right, one near right |
|
830 | | | | | summary: (16) merge two known; one immediate right, one near right | |
831 | | | | | |
|
831 | | | | | | |
832 | o | | | changeset: 15:1dda3f72782d |
|
832 | o | | | changeset: 15:1dda3f72782d | |
833 | |\ \ \ \ parent: 13:22d8966a97e3 |
|
833 | |\ \ \ \ parent: 13:22d8966a97e3 | |
834 | | | | | | parent: 14:8eac370358ef |
|
834 | | | | | | parent: 14:8eac370358ef | |
835 | | | | | | user: test |
|
835 | | | | | | user: test | |
836 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000 |
|
836 | | | | | | date: Thu Jan 01 00:00:15 1970 +0000 | |
837 | | | | | | summary: (15) expand |
|
837 | | | | | | summary: (15) expand | |
838 | | | | | | |
|
838 | | | | | | | |
839 | | o-----+ changeset: 14:8eac370358ef |
|
839 | | o-----+ changeset: 14:8eac370358ef | |
840 | | | | | | parent: 0:e6eb3150255d |
|
840 | | | | | | parent: 0:e6eb3150255d | |
841 | | |/ / / parent: 12:86b91144a6e9 |
|
841 | | |/ / / parent: 12:86b91144a6e9 | |
842 | | | | | user: test |
|
842 | | | | | user: test | |
843 | | | | | date: Thu Jan 01 00:00:14 1970 +0000 |
|
843 | | | | | date: Thu Jan 01 00:00:14 1970 +0000 | |
844 | | | | | summary: (14) merge two known; one immediate right, one far right |
|
844 | | | | | summary: (14) merge two known; one immediate right, one far right | |
845 | | | | | |
|
845 | | | | | | |
846 | o | | | changeset: 13:22d8966a97e3 |
|
846 | o | | | changeset: 13:22d8966a97e3 | |
847 | |\ \ \ \ parent: 9:7010c0af0a35 |
|
847 | |\ \ \ \ parent: 9:7010c0af0a35 | |
848 | | | | | | parent: 11:832d76e6bdf2 |
|
848 | | | | | | parent: 11:832d76e6bdf2 | |
849 | | | | | | user: test |
|
849 | | | | | | user: test | |
850 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000 |
|
850 | | | | | | date: Thu Jan 01 00:00:13 1970 +0000 | |
851 | | | | | | summary: (13) expand |
|
851 | | | | | | summary: (13) expand | |
852 | | | | | | |
|
852 | | | | | | | |
853 | +---o | | changeset: 12:86b91144a6e9 |
|
853 | +---o | | changeset: 12:86b91144a6e9 | |
854 | | | |/ / parent: 1:6db2ef61d156 |
|
854 | | | |/ / parent: 1:6db2ef61d156 | |
855 | | | | | parent: 9:7010c0af0a35 |
|
855 | | | | | parent: 9:7010c0af0a35 | |
856 | | | | | user: test |
|
856 | | | | | user: test | |
857 | | | | | date: Thu Jan 01 00:00:12 1970 +0000 |
|
857 | | | | | date: Thu Jan 01 00:00:12 1970 +0000 | |
858 | | | | | summary: (12) merge two known; one immediate right, one far left |
|
858 | | | | | summary: (12) merge two known; one immediate right, one far left | |
859 | | | | | |
|
859 | | | | | | |
860 | | o | | changeset: 11:832d76e6bdf2 |
|
860 | | o | | changeset: 11:832d76e6bdf2 | |
861 | | |\ \ \ parent: 6:b105a072e251 |
|
861 | | |\ \ \ parent: 6:b105a072e251 | |
862 | | | | | | parent: 10:74c64d036d72 |
|
862 | | | | | | parent: 10:74c64d036d72 | |
863 | | | | | | user: test |
|
863 | | | | | | user: test | |
864 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000 |
|
864 | | | | | | date: Thu Jan 01 00:00:11 1970 +0000 | |
865 | | | | | | summary: (11) expand |
|
865 | | | | | | summary: (11) expand | |
866 | | | | | | |
|
866 | | | | | | | |
867 | | | o---+ changeset: 10:74c64d036d72 |
|
867 | | | o---+ changeset: 10:74c64d036d72 | |
868 | | | | | | parent: 0:e6eb3150255d |
|
868 | | | | | | parent: 0:e6eb3150255d | |
869 | | |/ / / parent: 6:b105a072e251 |
|
869 | | |/ / / parent: 6:b105a072e251 | |
870 | | | | | user: test |
|
870 | | | | | user: test | |
871 | | | | | date: Thu Jan 01 00:00:10 1970 +0000 |
|
871 | | | | | date: Thu Jan 01 00:00:10 1970 +0000 | |
872 | | | | | summary: (10) merge two known; one immediate left, one near right |
|
872 | | | | | summary: (10) merge two known; one immediate left, one near right | |
873 | | | | | |
|
873 | | | | | | |
874 | o | | | changeset: 9:7010c0af0a35 |
|
874 | o | | | changeset: 9:7010c0af0a35 | |
875 | |\ \ \ \ parent: 7:b632bb1b1224 |
|
875 | |\ \ \ \ parent: 7:b632bb1b1224 | |
876 | | | | | | parent: 8:7a0b11f71937 |
|
876 | | | | | | parent: 8:7a0b11f71937 | |
877 | | | | | | user: test |
|
877 | | | | | | user: test | |
878 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000 |
|
878 | | | | | | date: Thu Jan 01 00:00:09 1970 +0000 | |
879 | | | | | | summary: (9) expand |
|
879 | | | | | | summary: (9) expand | |
880 | | | | | | |
|
880 | | | | | | | |
881 | | o-----+ changeset: 8:7a0b11f71937 |
|
881 | | o-----+ changeset: 8:7a0b11f71937 | |
882 | | | | | | parent: 0:e6eb3150255d |
|
882 | | | | | | parent: 0:e6eb3150255d | |
883 | |/ / / / parent: 7:b632bb1b1224 |
|
883 | |/ / / / parent: 7:b632bb1b1224 | |
884 | | | | | user: test |
|
884 | | | | | user: test | |
885 | | | | | date: Thu Jan 01 00:00:08 1970 +0000 |
|
885 | | | | | date: Thu Jan 01 00:00:08 1970 +0000 | |
886 | | | | | summary: (8) merge two known; one immediate left, one far right |
|
886 | | | | | summary: (8) merge two known; one immediate left, one far right | |
887 | | | | | |
|
887 | | | | | | |
888 | o | | | changeset: 7:b632bb1b1224 |
|
888 | o | | | changeset: 7:b632bb1b1224 | |
889 | |\ \ \ \ parent: 2:3d9a33b8d1e1 |
|
889 | |\ \ \ \ parent: 2:3d9a33b8d1e1 | |
890 | | | | | | parent: 5:4409d547b708 |
|
890 | | | | | | parent: 5:4409d547b708 | |
891 | | | | | | user: test |
|
891 | | | | | | user: test | |
892 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000 |
|
892 | | | | | | date: Thu Jan 01 00:00:07 1970 +0000 | |
893 | | | | | | summary: (7) expand |
|
893 | | | | | | summary: (7) expand | |
894 | | | | | | |
|
894 | | | | | | | |
895 | +---o | | changeset: 6:b105a072e251 |
|
895 | +---o | | changeset: 6:b105a072e251 | |
896 | | |/ / / parent: 2:3d9a33b8d1e1 |
|
896 | | |/ / / parent: 2:3d9a33b8d1e1 | |
897 | | | | | parent: 5:4409d547b708 |
|
897 | | | | | parent: 5:4409d547b708 | |
898 | | | | | user: test |
|
898 | | | | | user: test | |
899 | | | | | date: Thu Jan 01 00:00:06 1970 +0000 |
|
899 | | | | | date: Thu Jan 01 00:00:06 1970 +0000 | |
900 | | | | | summary: (6) merge two known; one immediate left, one far left |
|
900 | | | | | summary: (6) merge two known; one immediate left, one far left | |
901 | | | | | |
|
901 | | | | | | |
902 | | o | | changeset: 5:4409d547b708 |
|
902 | | o | | changeset: 5:4409d547b708 | |
903 | | |\ \ \ parent: 3:27eef8ed80b4 |
|
903 | | |\ \ \ parent: 3:27eef8ed80b4 | |
904 | | | | | | parent: 4:26a8bac39d9f |
|
904 | | | | | | parent: 4:26a8bac39d9f | |
905 | | | | | | user: test |
|
905 | | | | | | user: test | |
906 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000 |
|
906 | | | | | | date: Thu Jan 01 00:00:05 1970 +0000 | |
907 | | | | | | summary: (5) expand |
|
907 | | | | | | summary: (5) expand | |
908 | | | | | | |
|
908 | | | | | | | |
909 | | | o | | changeset: 4:26a8bac39d9f |
|
909 | | | o | | changeset: 4:26a8bac39d9f | |
910 | | |/|/ / parent: 1:6db2ef61d156 |
|
910 | | |/|/ / parent: 1:6db2ef61d156 | |
911 | | | | | parent: 3:27eef8ed80b4 |
|
911 | | | | | parent: 3:27eef8ed80b4 | |
912 | | | | | user: test |
|
912 | | | | | user: test | |
913 | | | | | date: Thu Jan 01 00:00:04 1970 +0000 |
|
913 | | | | | date: Thu Jan 01 00:00:04 1970 +0000 | |
914 | | | | | summary: (4) merge two known; one immediate left, one immediate right |
|
914 | | | | | summary: (4) merge two known; one immediate left, one immediate right | |
915 | | | | | |
|
915 | | | | | | |
916 | | o | | changeset: 3:27eef8ed80b4 |
|
916 | | o | | changeset: 3:27eef8ed80b4 | |
917 | |/ / / user: test |
|
917 | |/ / / user: test | |
918 | | | | date: Thu Jan 01 00:00:03 1970 +0000 |
|
918 | | | | date: Thu Jan 01 00:00:03 1970 +0000 | |
919 | | | | summary: (3) collapse |
|
919 | | | | summary: (3) collapse | |
920 | | | | |
|
920 | | | | | |
921 | o | | changeset: 2:3d9a33b8d1e1 |
|
921 | o | | changeset: 2:3d9a33b8d1e1 | |
922 | |/ / user: test |
|
922 | |/ / user: test | |
923 | | | date: Thu Jan 01 00:00:02 1970 +0000 |
|
923 | | | date: Thu Jan 01 00:00:02 1970 +0000 | |
924 | | | summary: (2) collapse |
|
924 | | | summary: (2) collapse | |
925 | | | |
|
925 | | | | |
926 | o | changeset: 1:6db2ef61d156 |
|
926 | o | changeset: 1:6db2ef61d156 | |
927 | |/ user: test |
|
927 | |/ user: test | |
928 | | date: Thu Jan 01 00:00:01 1970 +0000 |
|
928 | | date: Thu Jan 01 00:00:01 1970 +0000 | |
929 | | summary: (1) collapse |
|
929 | | summary: (1) collapse | |
930 | | |
|
930 | | | |
931 | o changeset: 0:e6eb3150255d |
|
931 | o changeset: 0:e6eb3150255d | |
932 | user: test |
|
932 | user: test | |
933 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
933 | date: Thu Jan 01 00:00:00 1970 +0000 | |
934 | summary: (0) root |
|
934 | summary: (0) root | |
935 |
|
935 | |||
936 |
|
936 | |||
937 |
|
937 | |||
938 | File glog per revset (only merges): |
|
938 | File glog per revset (only merges): | |
939 |
|
939 | |||
940 | $ hg log -G -r 'file("a")' -m |
|
940 | $ hg log -G -r 'file("a")' -m | |
941 | o changeset: 32:d06dffa21a31 |
|
941 | o changeset: 32:d06dffa21a31 | |
942 | |\ parent: 27:886ed638191b |
|
942 | |\ parent: 27:886ed638191b | |
943 | | : parent: 31:621d83e11f67 |
|
943 | | : parent: 31:621d83e11f67 | |
944 | | : user: test |
|
944 | | : user: test | |
945 | | : date: Thu Jan 01 00:00:32 1970 +0000 |
|
945 | | : date: Thu Jan 01 00:00:32 1970 +0000 | |
946 | | : summary: (32) expand |
|
946 | | : summary: (32) expand | |
947 | | : |
|
947 | | : | |
948 | o : changeset: 31:621d83e11f67 |
|
948 | o : changeset: 31:621d83e11f67 | |
949 | |\: parent: 21:d42a756af44d |
|
949 | |\: parent: 21:d42a756af44d | |
950 | | : parent: 30:6e11cd4b648f |
|
950 | | : parent: 30:6e11cd4b648f | |
951 | | : user: test |
|
951 | | : user: test | |
952 | | : date: Thu Jan 01 00:00:31 1970 +0000 |
|
952 | | : date: Thu Jan 01 00:00:31 1970 +0000 | |
953 | | : summary: (31) expand |
|
953 | | : summary: (31) expand | |
954 | | : |
|
954 | | : | |
955 | o : changeset: 30:6e11cd4b648f |
|
955 | o : changeset: 30:6e11cd4b648f | |
956 | |\ \ parent: 28:44ecd0b9ae99 |
|
956 | |\ \ parent: 28:44ecd0b9ae99 | |
957 | | ~ : parent: 29:cd9bb2be7593 |
|
957 | | ~ : parent: 29:cd9bb2be7593 | |
958 | | : user: test |
|
958 | | : user: test | |
959 | | : date: Thu Jan 01 00:00:30 1970 +0000 |
|
959 | | : date: Thu Jan 01 00:00:30 1970 +0000 | |
960 | | : summary: (30) expand |
|
960 | | : summary: (30) expand | |
961 | | / |
|
961 | | / | |
962 | o : changeset: 28:44ecd0b9ae99 |
|
962 | o : changeset: 28:44ecd0b9ae99 | |
963 | |\ \ parent: 1:6db2ef61d156 |
|
963 | |\ \ parent: 1:6db2ef61d156 | |
964 | | ~ : parent: 26:7f25b6c2f0b9 |
|
964 | | ~ : parent: 26:7f25b6c2f0b9 | |
965 | | : user: test |
|
965 | | : user: test | |
966 | | : date: Thu Jan 01 00:00:28 1970 +0000 |
|
966 | | : date: Thu Jan 01 00:00:28 1970 +0000 | |
967 | | : summary: (28) merge zero known |
|
967 | | : summary: (28) merge zero known | |
968 | | / |
|
968 | | / | |
969 | o : changeset: 26:7f25b6c2f0b9 |
|
969 | o : changeset: 26:7f25b6c2f0b9 | |
970 | |\ \ parent: 18:1aa84d96232a |
|
970 | |\ \ parent: 18:1aa84d96232a | |
971 | | | : parent: 25:91da8ed57247 |
|
971 | | | : parent: 25:91da8ed57247 | |
972 | | | : user: test |
|
972 | | | : user: test | |
973 | | | : date: Thu Jan 01 00:00:26 1970 +0000 |
|
973 | | | : date: Thu Jan 01 00:00:26 1970 +0000 | |
974 | | | : summary: (26) merge one known; far right |
|
974 | | | : summary: (26) merge one known; far right | |
975 | | | : |
|
975 | | | : | |
976 | | o : changeset: 25:91da8ed57247 |
|
976 | | o : changeset: 25:91da8ed57247 | |
977 | | |\: parent: 21:d42a756af44d |
|
977 | | |\: parent: 21:d42a756af44d | |
978 | | | : parent: 24:a9c19a3d96b7 |
|
978 | | | : parent: 24:a9c19a3d96b7 | |
979 | | | : user: test |
|
979 | | | : user: test | |
980 | | | : date: Thu Jan 01 00:00:25 1970 +0000 |
|
980 | | | : date: Thu Jan 01 00:00:25 1970 +0000 | |
981 | | | : summary: (25) merge one known; far left |
|
981 | | | : summary: (25) merge one known; far left | |
982 | | | : |
|
982 | | | : | |
983 | | o : changeset: 24:a9c19a3d96b7 |
|
983 | | o : changeset: 24:a9c19a3d96b7 | |
984 | | |\ \ parent: 0:e6eb3150255d |
|
984 | | |\ \ parent: 0:e6eb3150255d | |
985 | | | ~ : parent: 23:a01cddf0766d |
|
985 | | | ~ : parent: 23:a01cddf0766d | |
986 | | | : user: test |
|
986 | | | : user: test | |
987 | | | : date: Thu Jan 01 00:00:24 1970 +0000 |
|
987 | | | : date: Thu Jan 01 00:00:24 1970 +0000 | |
988 | | | : summary: (24) merge one known; immediate right |
|
988 | | | : summary: (24) merge one known; immediate right | |
989 | | | / |
|
989 | | | / | |
990 | | o : changeset: 23:a01cddf0766d |
|
990 | | o : changeset: 23:a01cddf0766d | |
991 | | |\ \ parent: 1:6db2ef61d156 |
|
991 | | |\ \ parent: 1:6db2ef61d156 | |
992 | | | ~ : parent: 22:e0d9cccacb5d |
|
992 | | | ~ : parent: 22:e0d9cccacb5d | |
993 | | | : user: test |
|
993 | | | : user: test | |
994 | | | : date: Thu Jan 01 00:00:23 1970 +0000 |
|
994 | | | : date: Thu Jan 01 00:00:23 1970 +0000 | |
995 | | | : summary: (23) merge one known; immediate left |
|
995 | | | : summary: (23) merge one known; immediate left | |
996 | | | / |
|
996 | | | / | |
997 | | o : changeset: 22:e0d9cccacb5d |
|
997 | | o : changeset: 22:e0d9cccacb5d | |
998 | |/:/ parent: 18:1aa84d96232a |
|
998 | |/:/ parent: 18:1aa84d96232a | |
999 | | : parent: 21:d42a756af44d |
|
999 | | : parent: 21:d42a756af44d | |
1000 | | : user: test |
|
1000 | | : user: test | |
1001 | | : date: Thu Jan 01 00:00:22 1970 +0000 |
|
1001 | | : date: Thu Jan 01 00:00:22 1970 +0000 | |
1002 | | : summary: (22) merge two known; one far left, one far right |
|
1002 | | : summary: (22) merge two known; one far left, one far right | |
1003 | | : |
|
1003 | | : | |
1004 | | o changeset: 21:d42a756af44d |
|
1004 | | o changeset: 21:d42a756af44d | |
1005 | | |\ parent: 19:31ddc2c1573b |
|
1005 | | |\ parent: 19:31ddc2c1573b | |
1006 | | | | parent: 20:d30ed6450e32 |
|
1006 | | | | parent: 20:d30ed6450e32 | |
1007 | | | | user: test |
|
1007 | | | | user: test | |
1008 | | | | date: Thu Jan 01 00:00:21 1970 +0000 |
|
1008 | | | | date: Thu Jan 01 00:00:21 1970 +0000 | |
1009 | | | | summary: (21) expand |
|
1009 | | | | summary: (21) expand | |
1010 | | | | |
|
1010 | | | | | |
1011 | +---o changeset: 20:d30ed6450e32 |
|
1011 | +---o changeset: 20:d30ed6450e32 | |
1012 | | | | parent: 0:e6eb3150255d |
|
1012 | | | | parent: 0:e6eb3150255d | |
1013 | | | ~ parent: 18:1aa84d96232a |
|
1013 | | | ~ parent: 18:1aa84d96232a | |
1014 | | | user: test |
|
1014 | | | user: test | |
1015 | | | date: Thu Jan 01 00:00:20 1970 +0000 |
|
1015 | | | date: Thu Jan 01 00:00:20 1970 +0000 | |
1016 | | | summary: (20) merge two known; two far right |
|
1016 | | | summary: (20) merge two known; two far right | |
1017 | | | |
|
1017 | | | | |
1018 | | o changeset: 19:31ddc2c1573b |
|
1018 | | o changeset: 19:31ddc2c1573b | |
1019 | | |\ parent: 15:1dda3f72782d |
|
1019 | | |\ parent: 15:1dda3f72782d | |
1020 | | | | parent: 17:44765d7c06e0 |
|
1020 | | | | parent: 17:44765d7c06e0 | |
1021 | | | | user: test |
|
1021 | | | | user: test | |
1022 | | | | date: Thu Jan 01 00:00:19 1970 +0000 |
|
1022 | | | | date: Thu Jan 01 00:00:19 1970 +0000 | |
1023 | | | | summary: (19) expand |
|
1023 | | | | summary: (19) expand | |
1024 | | | | |
|
1024 | | | | | |
1025 | o | | changeset: 18:1aa84d96232a |
|
1025 | o | | changeset: 18:1aa84d96232a | |
1026 | |\| | parent: 1:6db2ef61d156 |
|
1026 | |\| | parent: 1:6db2ef61d156 | |
1027 | ~ | | parent: 15:1dda3f72782d |
|
1027 | ~ | | parent: 15:1dda3f72782d | |
1028 | | | user: test |
|
1028 | | | user: test | |
1029 | | | date: Thu Jan 01 00:00:18 1970 +0000 |
|
1029 | | | date: Thu Jan 01 00:00:18 1970 +0000 | |
1030 | | | summary: (18) merge two known; two far left |
|
1030 | | | summary: (18) merge two known; two far left | |
1031 | / / |
|
1031 | / / | |
1032 | | o changeset: 17:44765d7c06e0 |
|
1032 | | o changeset: 17:44765d7c06e0 | |
1033 | | |\ parent: 12:86b91144a6e9 |
|
1033 | | |\ parent: 12:86b91144a6e9 | |
1034 | | | | parent: 16:3677d192927d |
|
1034 | | | | parent: 16:3677d192927d | |
1035 | | | | user: test |
|
1035 | | | | user: test | |
1036 | | | | date: Thu Jan 01 00:00:17 1970 +0000 |
|
1036 | | | | date: Thu Jan 01 00:00:17 1970 +0000 | |
1037 | | | | summary: (17) expand |
|
1037 | | | | summary: (17) expand | |
1038 | | | | |
|
1038 | | | | | |
1039 | | | o changeset: 16:3677d192927d |
|
1039 | | | o changeset: 16:3677d192927d | |
1040 | | | |\ parent: 0:e6eb3150255d |
|
1040 | | | |\ parent: 0:e6eb3150255d | |
1041 | | | ~ ~ parent: 1:6db2ef61d156 |
|
1041 | | | ~ ~ parent: 1:6db2ef61d156 | |
1042 | | | user: test |
|
1042 | | | user: test | |
1043 | | | date: Thu Jan 01 00:00:16 1970 +0000 |
|
1043 | | | date: Thu Jan 01 00:00:16 1970 +0000 | |
1044 | | | summary: (16) merge two known; one immediate right, one near right |
|
1044 | | | summary: (16) merge two known; one immediate right, one near right | |
1045 | | | |
|
1045 | | | | |
1046 | o | changeset: 15:1dda3f72782d |
|
1046 | o | changeset: 15:1dda3f72782d | |
1047 | |\ \ parent: 13:22d8966a97e3 |
|
1047 | |\ \ parent: 13:22d8966a97e3 | |
1048 | | | | parent: 14:8eac370358ef |
|
1048 | | | | parent: 14:8eac370358ef | |
1049 | | | | user: test |
|
1049 | | | | user: test | |
1050 | | | | date: Thu Jan 01 00:00:15 1970 +0000 |
|
1050 | | | | date: Thu Jan 01 00:00:15 1970 +0000 | |
1051 | | | | summary: (15) expand |
|
1051 | | | | summary: (15) expand | |
1052 | | | | |
|
1052 | | | | | |
1053 | | o | changeset: 14:8eac370358ef |
|
1053 | | o | changeset: 14:8eac370358ef | |
1054 | | |\| parent: 0:e6eb3150255d |
|
1054 | | |\| parent: 0:e6eb3150255d | |
1055 | | ~ | parent: 12:86b91144a6e9 |
|
1055 | | ~ | parent: 12:86b91144a6e9 | |
1056 | | | user: test |
|
1056 | | | user: test | |
1057 | | | date: Thu Jan 01 00:00:14 1970 +0000 |
|
1057 | | | date: Thu Jan 01 00:00:14 1970 +0000 | |
1058 | | | summary: (14) merge two known; one immediate right, one far right |
|
1058 | | | summary: (14) merge two known; one immediate right, one far right | |
1059 | | / |
|
1059 | | / | |
1060 | o | changeset: 13:22d8966a97e3 |
|
1060 | o | changeset: 13:22d8966a97e3 | |
1061 | |\ \ parent: 9:7010c0af0a35 |
|
1061 | |\ \ parent: 9:7010c0af0a35 | |
1062 | | | | parent: 11:832d76e6bdf2 |
|
1062 | | | | parent: 11:832d76e6bdf2 | |
1063 | | | | user: test |
|
1063 | | | | user: test | |
1064 | | | | date: Thu Jan 01 00:00:13 1970 +0000 |
|
1064 | | | | date: Thu Jan 01 00:00:13 1970 +0000 | |
1065 | | | | summary: (13) expand |
|
1065 | | | | summary: (13) expand | |
1066 | | | | |
|
1066 | | | | | |
1067 | +---o changeset: 12:86b91144a6e9 |
|
1067 | +---o changeset: 12:86b91144a6e9 | |
1068 | | | | parent: 1:6db2ef61d156 |
|
1068 | | | | parent: 1:6db2ef61d156 | |
1069 | | | ~ parent: 9:7010c0af0a35 |
|
1069 | | | ~ parent: 9:7010c0af0a35 | |
1070 | | | user: test |
|
1070 | | | user: test | |
1071 | | | date: Thu Jan 01 00:00:12 1970 +0000 |
|
1071 | | | date: Thu Jan 01 00:00:12 1970 +0000 | |
1072 | | | summary: (12) merge two known; one immediate right, one far left |
|
1072 | | | summary: (12) merge two known; one immediate right, one far left | |
1073 | | | |
|
1073 | | | | |
1074 | | o changeset: 11:832d76e6bdf2 |
|
1074 | | o changeset: 11:832d76e6bdf2 | |
1075 | | |\ parent: 6:b105a072e251 |
|
1075 | | |\ parent: 6:b105a072e251 | |
1076 | | | | parent: 10:74c64d036d72 |
|
1076 | | | | parent: 10:74c64d036d72 | |
1077 | | | | user: test |
|
1077 | | | | user: test | |
1078 | | | | date: Thu Jan 01 00:00:11 1970 +0000 |
|
1078 | | | | date: Thu Jan 01 00:00:11 1970 +0000 | |
1079 | | | | summary: (11) expand |
|
1079 | | | | summary: (11) expand | |
1080 | | | | |
|
1080 | | | | | |
1081 | | | o changeset: 10:74c64d036d72 |
|
1081 | | | o changeset: 10:74c64d036d72 | |
1082 | | |/| parent: 0:e6eb3150255d |
|
1082 | | |/| parent: 0:e6eb3150255d | |
1083 | | | ~ parent: 6:b105a072e251 |
|
1083 | | | ~ parent: 6:b105a072e251 | |
1084 | | | user: test |
|
1084 | | | user: test | |
1085 | | | date: Thu Jan 01 00:00:10 1970 +0000 |
|
1085 | | | date: Thu Jan 01 00:00:10 1970 +0000 | |
1086 | | | summary: (10) merge two known; one immediate left, one near right |
|
1086 | | | summary: (10) merge two known; one immediate left, one near right | |
1087 | | | |
|
1087 | | | | |
1088 | o | changeset: 9:7010c0af0a35 |
|
1088 | o | changeset: 9:7010c0af0a35 | |
1089 | |\ \ parent: 7:b632bb1b1224 |
|
1089 | |\ \ parent: 7:b632bb1b1224 | |
1090 | | | | parent: 8:7a0b11f71937 |
|
1090 | | | | parent: 8:7a0b11f71937 | |
1091 | | | | user: test |
|
1091 | | | | user: test | |
1092 | | | | date: Thu Jan 01 00:00:09 1970 +0000 |
|
1092 | | | | date: Thu Jan 01 00:00:09 1970 +0000 | |
1093 | | | | summary: (9) expand |
|
1093 | | | | summary: (9) expand | |
1094 | | | | |
|
1094 | | | | | |
1095 | | o | changeset: 8:7a0b11f71937 |
|
1095 | | o | changeset: 8:7a0b11f71937 | |
1096 | |/| | parent: 0:e6eb3150255d |
|
1096 | |/| | parent: 0:e6eb3150255d | |
1097 | | ~ | parent: 7:b632bb1b1224 |
|
1097 | | ~ | parent: 7:b632bb1b1224 | |
1098 | | | user: test |
|
1098 | | | user: test | |
1099 | | | date: Thu Jan 01 00:00:08 1970 +0000 |
|
1099 | | | date: Thu Jan 01 00:00:08 1970 +0000 | |
1100 | | | summary: (8) merge two known; one immediate left, one far right |
|
1100 | | | summary: (8) merge two known; one immediate left, one far right | |
1101 | | / |
|
1101 | | / | |
1102 | o | changeset: 7:b632bb1b1224 |
|
1102 | o | changeset: 7:b632bb1b1224 | |
1103 | |\ \ parent: 2:3d9a33b8d1e1 |
|
1103 | |\ \ parent: 2:3d9a33b8d1e1 | |
1104 | | ~ | parent: 5:4409d547b708 |
|
1104 | | ~ | parent: 5:4409d547b708 | |
1105 | | | user: test |
|
1105 | | | user: test | |
1106 | | | date: Thu Jan 01 00:00:07 1970 +0000 |
|
1106 | | | date: Thu Jan 01 00:00:07 1970 +0000 | |
1107 | | | summary: (7) expand |
|
1107 | | | summary: (7) expand | |
1108 | | / |
|
1108 | | / | |
1109 | | o changeset: 6:b105a072e251 |
|
1109 | | o changeset: 6:b105a072e251 | |
1110 | |/| parent: 2:3d9a33b8d1e1 |
|
1110 | |/| parent: 2:3d9a33b8d1e1 | |
1111 | | ~ parent: 5:4409d547b708 |
|
1111 | | ~ parent: 5:4409d547b708 | |
1112 | | user: test |
|
1112 | | user: test | |
1113 | | date: Thu Jan 01 00:00:06 1970 +0000 |
|
1113 | | date: Thu Jan 01 00:00:06 1970 +0000 | |
1114 | | summary: (6) merge two known; one immediate left, one far left |
|
1114 | | summary: (6) merge two known; one immediate left, one far left | |
1115 | | |
|
1115 | | | |
1116 | o changeset: 5:4409d547b708 |
|
1116 | o changeset: 5:4409d547b708 | |
1117 | |\ parent: 3:27eef8ed80b4 |
|
1117 | |\ parent: 3:27eef8ed80b4 | |
1118 | | ~ parent: 4:26a8bac39d9f |
|
1118 | | ~ parent: 4:26a8bac39d9f | |
1119 | | user: test |
|
1119 | | user: test | |
1120 | | date: Thu Jan 01 00:00:05 1970 +0000 |
|
1120 | | date: Thu Jan 01 00:00:05 1970 +0000 | |
1121 | | summary: (5) expand |
|
1121 | | summary: (5) expand | |
1122 | | |
|
1122 | | | |
1123 | o changeset: 4:26a8bac39d9f |
|
1123 | o changeset: 4:26a8bac39d9f | |
1124 | |\ parent: 1:6db2ef61d156 |
|
1124 | |\ parent: 1:6db2ef61d156 | |
1125 | ~ ~ parent: 3:27eef8ed80b4 |
|
1125 | ~ ~ parent: 3:27eef8ed80b4 | |
1126 | user: test |
|
1126 | user: test | |
1127 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
1127 | date: Thu Jan 01 00:00:04 1970 +0000 | |
1128 | summary: (4) merge two known; one immediate left, one immediate right |
|
1128 | summary: (4) merge two known; one immediate left, one immediate right | |
1129 |
|
1129 | |||
1130 |
|
1130 | |||
1131 |
|
1131 | |||
1132 | Empty revision range - display nothing: |
|
1132 | Empty revision range - display nothing: | |
1133 | $ hg log -G -r 1..0 |
|
1133 | $ hg log -G -r 1..0 | |
1134 |
|
1134 | |||
1135 | $ cd .. |
|
1135 | $ cd .. | |
1136 |
|
1136 | |||
1137 | #if no-outer-repo |
|
1137 | #if no-outer-repo | |
1138 |
|
1138 | |||
1139 | From outer space: |
|
1139 | From outer space: | |
1140 | $ hg log -G -l1 repo |
|
1140 | $ hg log -G -l1 repo | |
1141 | @ changeset: 34:fea3ac5810e0 |
|
1141 | @ changeset: 34:fea3ac5810e0 | |
1142 | | tag: tip |
|
1142 | | tag: tip | |
1143 | ~ parent: 32:d06dffa21a31 |
|
1143 | ~ parent: 32:d06dffa21a31 | |
1144 | user: test |
|
1144 | user: test | |
1145 | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1145 | date: Thu Jan 01 00:00:34 1970 +0000 | |
1146 | summary: (34) head |
|
1146 | summary: (34) head | |
1147 |
|
1147 | |||
1148 | $ hg log -G -l1 repo/a |
|
1148 | $ hg log -G -l1 repo/a | |
1149 | @ changeset: 34:fea3ac5810e0 |
|
1149 | @ changeset: 34:fea3ac5810e0 | |
1150 | | tag: tip |
|
1150 | | tag: tip | |
1151 | ~ parent: 32:d06dffa21a31 |
|
1151 | ~ parent: 32:d06dffa21a31 | |
1152 | user: test |
|
1152 | user: test | |
1153 | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1153 | date: Thu Jan 01 00:00:34 1970 +0000 | |
1154 | summary: (34) head |
|
1154 | summary: (34) head | |
1155 |
|
1155 | |||
1156 | $ hg log -G -l1 repo/missing |
|
1156 | $ hg log -G -l1 repo/missing | |
1157 |
|
1157 | |||
1158 | #endif |
|
1158 | #endif | |
1159 |
|
1159 | |||
1160 | File log with revs != cset revs: |
|
1160 | File log with revs != cset revs: | |
1161 | $ hg init flog |
|
1161 | $ hg init flog | |
1162 | $ cd flog |
|
1162 | $ cd flog | |
1163 | $ echo one >one |
|
1163 | $ echo one >one | |
1164 | $ hg add one |
|
1164 | $ hg add one | |
1165 | $ hg commit -mone |
|
1165 | $ hg commit -mone | |
1166 | $ echo two >two |
|
1166 | $ echo two >two | |
1167 | $ hg add two |
|
1167 | $ hg add two | |
1168 | $ hg commit -mtwo |
|
1168 | $ hg commit -mtwo | |
1169 | $ echo more >two |
|
1169 | $ echo more >two | |
1170 | $ hg commit -mmore |
|
1170 | $ hg commit -mmore | |
1171 | $ hg log -G two |
|
1171 | $ hg log -G two | |
1172 | @ changeset: 2:12c28321755b |
|
1172 | @ changeset: 2:12c28321755b | |
1173 | | tag: tip |
|
1173 | | tag: tip | |
1174 | | user: test |
|
1174 | | user: test | |
1175 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1175 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1176 | | summary: more |
|
1176 | | summary: more | |
1177 | | |
|
1177 | | | |
1178 | o changeset: 1:5ac72c0599bf |
|
1178 | o changeset: 1:5ac72c0599bf | |
1179 | | user: test |
|
1179 | | user: test | |
1180 | ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
1180 | ~ date: Thu Jan 01 00:00:00 1970 +0000 | |
1181 | summary: two |
|
1181 | summary: two | |
1182 |
|
1182 | |||
1183 |
|
1183 | |||
1184 | Issue1896: File log with explicit style |
|
1184 | Issue1896: File log with explicit style | |
1185 | $ hg log -G --style=default one |
|
1185 | $ hg log -G --style=default one | |
1186 | o changeset: 0:3d578b4a1f53 |
|
1186 | o changeset: 0:3d578b4a1f53 | |
1187 | user: test |
|
1187 | user: test | |
1188 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1188 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1189 | summary: one |
|
1189 | summary: one | |
1190 |
|
1190 | |||
1191 | Issue2395: glog --style header and footer |
|
1191 | Issue2395: glog --style header and footer | |
1192 | $ hg log -G --style=xml one |
|
1192 | $ hg log -G --style=xml one | |
1193 | <?xml version="1.0"?> |
|
1193 | <?xml version="1.0"?> | |
1194 | <log> |
|
1194 | <log> | |
1195 | o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1"> |
|
1195 | o <logentry revision="0" node="3d578b4a1f537d5fcf7301bfa9c0b97adfaa6fb1"> | |
1196 | <author email="test">test</author> |
|
1196 | <author email="test">test</author> | |
1197 | <date>1970-01-01T00:00:00+00:00</date> |
|
1197 | <date>1970-01-01T00:00:00+00:00</date> | |
1198 | <msg xml:space="preserve">one</msg> |
|
1198 | <msg xml:space="preserve">one</msg> | |
1199 | </logentry> |
|
1199 | </logentry> | |
1200 | </log> |
|
1200 | </log> | |
1201 |
|
1201 | |||
1202 | $ cd .. |
|
1202 | $ cd .. | |
1203 |
|
1203 | |||
1204 | Incoming and outgoing: |
|
1204 | Incoming and outgoing: | |
1205 |
|
1205 | |||
1206 | $ hg clone -U -r31 repo repo2 |
|
1206 | $ hg clone -U -r31 repo repo2 | |
1207 | adding changesets |
|
1207 | adding changesets | |
1208 | adding manifests |
|
1208 | adding manifests | |
1209 | adding file changes |
|
1209 | adding file changes | |
1210 | added 31 changesets with 31 changes to 1 files |
|
1210 | added 31 changesets with 31 changes to 1 files | |
1211 | $ cd repo2 |
|
1211 | $ cd repo2 | |
1212 |
|
1212 | |||
1213 | $ hg incoming --graph ../repo |
|
1213 | $ hg incoming --graph ../repo | |
1214 | comparing with ../repo |
|
1214 | comparing with ../repo | |
1215 | searching for changes |
|
1215 | searching for changes | |
1216 | o changeset: 34:fea3ac5810e0 |
|
1216 | o changeset: 34:fea3ac5810e0 | |
1217 | | tag: tip |
|
1217 | | tag: tip | |
1218 | | parent: 32:d06dffa21a31 |
|
1218 | | parent: 32:d06dffa21a31 | |
1219 | | user: test |
|
1219 | | user: test | |
1220 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1220 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
1221 | | summary: (34) head |
|
1221 | | summary: (34) head | |
1222 | | |
|
1222 | | | |
1223 | | o changeset: 33:68608f5145f9 |
|
1223 | | o changeset: 33:68608f5145f9 | |
1224 | | parent: 18:1aa84d96232a |
|
1224 | | parent: 18:1aa84d96232a | |
1225 | | user: test |
|
1225 | | user: test | |
1226 | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
1226 | | date: Thu Jan 01 00:00:33 1970 +0000 | |
1227 | | summary: (33) head |
|
1227 | | summary: (33) head | |
1228 | | |
|
1228 | | | |
1229 | o changeset: 32:d06dffa21a31 |
|
1229 | o changeset: 32:d06dffa21a31 | |
1230 | | parent: 27:886ed638191b |
|
1230 | | parent: 27:886ed638191b | |
1231 | | parent: 31:621d83e11f67 |
|
1231 | | parent: 31:621d83e11f67 | |
1232 | | user: test |
|
1232 | | user: test | |
1233 | | date: Thu Jan 01 00:00:32 1970 +0000 |
|
1233 | | date: Thu Jan 01 00:00:32 1970 +0000 | |
1234 | | summary: (32) expand |
|
1234 | | summary: (32) expand | |
1235 | | |
|
1235 | | | |
1236 | o changeset: 27:886ed638191b |
|
1236 | o changeset: 27:886ed638191b | |
1237 | parent: 21:d42a756af44d |
|
1237 | parent: 21:d42a756af44d | |
1238 | user: test |
|
1238 | user: test | |
1239 | date: Thu Jan 01 00:00:27 1970 +0000 |
|
1239 | date: Thu Jan 01 00:00:27 1970 +0000 | |
1240 | summary: (27) collapse |
|
1240 | summary: (27) collapse | |
1241 |
|
1241 | |||
1242 | $ cd .. |
|
1242 | $ cd .. | |
1243 |
|
1243 | |||
1244 | $ hg -R repo outgoing --graph repo2 |
|
1244 | $ hg -R repo outgoing --graph repo2 | |
1245 | comparing with repo2 |
|
1245 | comparing with repo2 | |
1246 | searching for changes |
|
1246 | searching for changes | |
1247 | @ changeset: 34:fea3ac5810e0 |
|
1247 | @ changeset: 34:fea3ac5810e0 | |
1248 | | tag: tip |
|
1248 | | tag: tip | |
1249 | | parent: 32:d06dffa21a31 |
|
1249 | | parent: 32:d06dffa21a31 | |
1250 | | user: test |
|
1250 | | user: test | |
1251 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1251 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
1252 | | summary: (34) head |
|
1252 | | summary: (34) head | |
1253 | | |
|
1253 | | | |
1254 | | o changeset: 33:68608f5145f9 |
|
1254 | | o changeset: 33:68608f5145f9 | |
1255 | | parent: 18:1aa84d96232a |
|
1255 | | parent: 18:1aa84d96232a | |
1256 | | user: test |
|
1256 | | user: test | |
1257 | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
1257 | | date: Thu Jan 01 00:00:33 1970 +0000 | |
1258 | | summary: (33) head |
|
1258 | | summary: (33) head | |
1259 | | |
|
1259 | | | |
1260 | o changeset: 32:d06dffa21a31 |
|
1260 | o changeset: 32:d06dffa21a31 | |
1261 | | parent: 27:886ed638191b |
|
1261 | | parent: 27:886ed638191b | |
1262 | | parent: 31:621d83e11f67 |
|
1262 | | parent: 31:621d83e11f67 | |
1263 | | user: test |
|
1263 | | user: test | |
1264 | | date: Thu Jan 01 00:00:32 1970 +0000 |
|
1264 | | date: Thu Jan 01 00:00:32 1970 +0000 | |
1265 | | summary: (32) expand |
|
1265 | | summary: (32) expand | |
1266 | | |
|
1266 | | | |
1267 | o changeset: 27:886ed638191b |
|
1267 | o changeset: 27:886ed638191b | |
1268 | parent: 21:d42a756af44d |
|
1268 | parent: 21:d42a756af44d | |
1269 | user: test |
|
1269 | user: test | |
1270 | date: Thu Jan 01 00:00:27 1970 +0000 |
|
1270 | date: Thu Jan 01 00:00:27 1970 +0000 | |
1271 | summary: (27) collapse |
|
1271 | summary: (27) collapse | |
1272 |
|
1272 | |||
1273 |
|
1273 | |||
1274 | File + limit with revs != cset revs: |
|
1274 | File + limit with revs != cset revs: | |
1275 | $ cd repo |
|
1275 | $ cd repo | |
1276 | $ touch b |
|
1276 | $ touch b | |
1277 | $ hg ci -Aqm0 |
|
1277 | $ hg ci -Aqm0 | |
1278 | $ hg log -G -l2 a |
|
1278 | $ hg log -G -l2 a | |
1279 | o changeset: 34:fea3ac5810e0 |
|
1279 | o changeset: 34:fea3ac5810e0 | |
1280 | | parent: 32:d06dffa21a31 |
|
1280 | | parent: 32:d06dffa21a31 | |
1281 | ~ user: test |
|
1281 | ~ user: test | |
1282 | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1282 | date: Thu Jan 01 00:00:34 1970 +0000 | |
1283 | summary: (34) head |
|
1283 | summary: (34) head | |
1284 |
|
1284 | |||
1285 | o changeset: 33:68608f5145f9 |
|
1285 | o changeset: 33:68608f5145f9 | |
1286 | | parent: 18:1aa84d96232a |
|
1286 | | parent: 18:1aa84d96232a | |
1287 | ~ user: test |
|
1287 | ~ user: test | |
1288 | date: Thu Jan 01 00:00:33 1970 +0000 |
|
1288 | date: Thu Jan 01 00:00:33 1970 +0000 | |
1289 | summary: (33) head |
|
1289 | summary: (33) head | |
1290 |
|
1290 | |||
1291 |
|
1291 | |||
1292 | File + limit + -ra:b, (b - a) < limit: |
|
1292 | File + limit + -ra:b, (b - a) < limit: | |
1293 | $ hg log -G -l3000 -r32:tip a |
|
1293 | $ hg log -G -l3000 -r32:tip a | |
1294 | o changeset: 34:fea3ac5810e0 |
|
1294 | o changeset: 34:fea3ac5810e0 | |
1295 | | parent: 32:d06dffa21a31 |
|
1295 | | parent: 32:d06dffa21a31 | |
1296 | | user: test |
|
1296 | | user: test | |
1297 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1297 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
1298 | | summary: (34) head |
|
1298 | | summary: (34) head | |
1299 | | |
|
1299 | | | |
1300 | | o changeset: 33:68608f5145f9 |
|
1300 | | o changeset: 33:68608f5145f9 | |
1301 | | | parent: 18:1aa84d96232a |
|
1301 | | | parent: 18:1aa84d96232a | |
1302 | | ~ user: test |
|
1302 | | ~ user: test | |
1303 | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
1303 | | date: Thu Jan 01 00:00:33 1970 +0000 | |
1304 | | summary: (33) head |
|
1304 | | summary: (33) head | |
1305 | | |
|
1305 | | | |
1306 | o changeset: 32:d06dffa21a31 |
|
1306 | o changeset: 32:d06dffa21a31 | |
1307 | |\ parent: 27:886ed638191b |
|
1307 | |\ parent: 27:886ed638191b | |
1308 | ~ ~ parent: 31:621d83e11f67 |
|
1308 | ~ ~ parent: 31:621d83e11f67 | |
1309 | user: test |
|
1309 | user: test | |
1310 | date: Thu Jan 01 00:00:32 1970 +0000 |
|
1310 | date: Thu Jan 01 00:00:32 1970 +0000 | |
1311 | summary: (32) expand |
|
1311 | summary: (32) expand | |
1312 |
|
1312 | |||
1313 |
|
1313 | |||
1314 | Point out a common and an uncommon unshown parent |
|
1314 | Point out a common and an uncommon unshown parent | |
1315 |
|
1315 | |||
1316 | $ hg log -G -r 'rev(8) or rev(9)' |
|
1316 | $ hg log -G -r 'rev(8) or rev(9)' | |
1317 | o changeset: 9:7010c0af0a35 |
|
1317 | o changeset: 9:7010c0af0a35 | |
1318 | |\ parent: 7:b632bb1b1224 |
|
1318 | |\ parent: 7:b632bb1b1224 | |
1319 | | ~ parent: 8:7a0b11f71937 |
|
1319 | | ~ parent: 8:7a0b11f71937 | |
1320 | | user: test |
|
1320 | | user: test | |
1321 | | date: Thu Jan 01 00:00:09 1970 +0000 |
|
1321 | | date: Thu Jan 01 00:00:09 1970 +0000 | |
1322 | | summary: (9) expand |
|
1322 | | summary: (9) expand | |
1323 | | |
|
1323 | | | |
1324 | o changeset: 8:7a0b11f71937 |
|
1324 | o changeset: 8:7a0b11f71937 | |
1325 | |\ parent: 0:e6eb3150255d |
|
1325 | |\ parent: 0:e6eb3150255d | |
1326 | ~ ~ parent: 7:b632bb1b1224 |
|
1326 | ~ ~ parent: 7:b632bb1b1224 | |
1327 | user: test |
|
1327 | user: test | |
1328 | date: Thu Jan 01 00:00:08 1970 +0000 |
|
1328 | date: Thu Jan 01 00:00:08 1970 +0000 | |
1329 | summary: (8) merge two known; one immediate left, one far right |
|
1329 | summary: (8) merge two known; one immediate left, one far right | |
1330 |
|
1330 | |||
1331 |
|
1331 | |||
1332 | File + limit + -ra:b, b < tip: |
|
1332 | File + limit + -ra:b, b < tip: | |
1333 |
|
1333 | |||
1334 | $ hg log -G -l1 -r32:34 a |
|
1334 | $ hg log -G -l1 -r32:34 a | |
1335 | o changeset: 34:fea3ac5810e0 |
|
1335 | o changeset: 34:fea3ac5810e0 | |
1336 | | parent: 32:d06dffa21a31 |
|
1336 | | parent: 32:d06dffa21a31 | |
1337 | ~ user: test |
|
1337 | ~ user: test | |
1338 | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1338 | date: Thu Jan 01 00:00:34 1970 +0000 | |
1339 | summary: (34) head |
|
1339 | summary: (34) head | |
1340 |
|
1340 | |||
1341 |
|
1341 | |||
1342 | file(File) + limit + -ra:b, b < tip: |
|
1342 | file(File) + limit + -ra:b, b < tip: | |
1343 |
|
1343 | |||
1344 | $ hg log -G -l1 -r32:34 -r 'file("a")' |
|
1344 | $ hg log -G -l1 -r32:34 -r 'file("a")' | |
1345 | o changeset: 34:fea3ac5810e0 |
|
1345 | o changeset: 34:fea3ac5810e0 | |
1346 | | parent: 32:d06dffa21a31 |
|
1346 | | parent: 32:d06dffa21a31 | |
1347 | ~ user: test |
|
1347 | ~ user: test | |
1348 | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1348 | date: Thu Jan 01 00:00:34 1970 +0000 | |
1349 | summary: (34) head |
|
1349 | summary: (34) head | |
1350 |
|
1350 | |||
1351 |
|
1351 | |||
1352 | limit(file(File) and a::b), b < tip: |
|
1352 | limit(file(File) and a::b), b < tip: | |
1353 |
|
1353 | |||
1354 | $ hg log -G -r 'limit(file("a") and 32::34, 1)' |
|
1354 | $ hg log -G -r 'limit(file("a") and 32::34, 1)' | |
1355 | o changeset: 32:d06dffa21a31 |
|
1355 | o changeset: 32:d06dffa21a31 | |
1356 | |\ parent: 27:886ed638191b |
|
1356 | |\ parent: 27:886ed638191b | |
1357 | ~ ~ parent: 31:621d83e11f67 |
|
1357 | ~ ~ parent: 31:621d83e11f67 | |
1358 | user: test |
|
1358 | user: test | |
1359 | date: Thu Jan 01 00:00:32 1970 +0000 |
|
1359 | date: Thu Jan 01 00:00:32 1970 +0000 | |
1360 | summary: (32) expand |
|
1360 | summary: (32) expand | |
1361 |
|
1361 | |||
1362 |
|
1362 | |||
1363 | File + limit + -ra:b, b < tip: |
|
1363 | File + limit + -ra:b, b < tip: | |
1364 |
|
1364 | |||
1365 | $ hg log -G -r 'limit(file("a") and 34::32, 1)' |
|
1365 | $ hg log -G -r 'limit(file("a") and 34::32, 1)' | |
1366 |
|
1366 | |||
1367 | File + limit + -ra:b, b < tip, (b - a) < limit: |
|
1367 | File + limit + -ra:b, b < tip, (b - a) < limit: | |
1368 |
|
1368 | |||
1369 | $ hg log -G -l10 -r33:34 a |
|
1369 | $ hg log -G -l10 -r33:34 a | |
1370 | o changeset: 34:fea3ac5810e0 |
|
1370 | o changeset: 34:fea3ac5810e0 | |
1371 | | parent: 32:d06dffa21a31 |
|
1371 | | parent: 32:d06dffa21a31 | |
1372 | ~ user: test |
|
1372 | ~ user: test | |
1373 | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1373 | date: Thu Jan 01 00:00:34 1970 +0000 | |
1374 | summary: (34) head |
|
1374 | summary: (34) head | |
1375 |
|
1375 | |||
1376 | o changeset: 33:68608f5145f9 |
|
1376 | o changeset: 33:68608f5145f9 | |
1377 | | parent: 18:1aa84d96232a |
|
1377 | | parent: 18:1aa84d96232a | |
1378 | ~ user: test |
|
1378 | ~ user: test | |
1379 | date: Thu Jan 01 00:00:33 1970 +0000 |
|
1379 | date: Thu Jan 01 00:00:33 1970 +0000 | |
1380 | summary: (33) head |
|
1380 | summary: (33) head | |
1381 |
|
1381 | |||
1382 |
|
1382 | |||
1383 | Do not crash or produce strange graphs if history is buggy |
|
1383 | Do not crash or produce strange graphs if history is buggy | |
1384 |
|
1384 | |||
1385 | $ hg branch branch |
|
1385 | $ hg branch branch | |
1386 | marked working directory as branch branch |
|
1386 | marked working directory as branch branch | |
1387 | (branches are permanent and global, did you want a bookmark?) |
|
1387 | (branches are permanent and global, did you want a bookmark?) | |
1388 | $ commit 36 "buggy merge: identical parents" 35 35 |
|
1388 | $ commit 36 "buggy merge: identical parents" 35 35 | |
1389 | $ hg log -G -l5 |
|
1389 | $ hg log -G -l5 | |
1390 | @ changeset: 36:08a19a744424 |
|
1390 | @ changeset: 36:08a19a744424 | |
1391 | | branch: branch |
|
1391 | | branch: branch | |
1392 | | tag: tip |
|
1392 | | tag: tip | |
1393 | | parent: 35:9159c3644c5e |
|
1393 | | parent: 35:9159c3644c5e | |
1394 | | parent: 35:9159c3644c5e |
|
1394 | | parent: 35:9159c3644c5e | |
1395 | | user: test |
|
1395 | | user: test | |
1396 | | date: Thu Jan 01 00:00:36 1970 +0000 |
|
1396 | | date: Thu Jan 01 00:00:36 1970 +0000 | |
1397 | | summary: (36) buggy merge: identical parents |
|
1397 | | summary: (36) buggy merge: identical parents | |
1398 | | |
|
1398 | | | |
1399 | o changeset: 35:9159c3644c5e |
|
1399 | o changeset: 35:9159c3644c5e | |
1400 | | user: test |
|
1400 | | user: test | |
1401 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1401 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1402 | | summary: 0 |
|
1402 | | summary: 0 | |
1403 | | |
|
1403 | | | |
1404 | o changeset: 34:fea3ac5810e0 |
|
1404 | o changeset: 34:fea3ac5810e0 | |
1405 | | parent: 32:d06dffa21a31 |
|
1405 | | parent: 32:d06dffa21a31 | |
1406 | | user: test |
|
1406 | | user: test | |
1407 | | date: Thu Jan 01 00:00:34 1970 +0000 |
|
1407 | | date: Thu Jan 01 00:00:34 1970 +0000 | |
1408 | | summary: (34) head |
|
1408 | | summary: (34) head | |
1409 | | |
|
1409 | | | |
1410 | | o changeset: 33:68608f5145f9 |
|
1410 | | o changeset: 33:68608f5145f9 | |
1411 | | | parent: 18:1aa84d96232a |
|
1411 | | | parent: 18:1aa84d96232a | |
1412 | | ~ user: test |
|
1412 | | ~ user: test | |
1413 | | date: Thu Jan 01 00:00:33 1970 +0000 |
|
1413 | | date: Thu Jan 01 00:00:33 1970 +0000 | |
1414 | | summary: (33) head |
|
1414 | | summary: (33) head | |
1415 | | |
|
1415 | | | |
1416 | o changeset: 32:d06dffa21a31 |
|
1416 | o changeset: 32:d06dffa21a31 | |
1417 | |\ parent: 27:886ed638191b |
|
1417 | |\ parent: 27:886ed638191b | |
1418 | ~ ~ parent: 31:621d83e11f67 |
|
1418 | ~ ~ parent: 31:621d83e11f67 | |
1419 | user: test |
|
1419 | user: test | |
1420 | date: Thu Jan 01 00:00:32 1970 +0000 |
|
1420 | date: Thu Jan 01 00:00:32 1970 +0000 | |
1421 | summary: (32) expand |
|
1421 | summary: (32) expand | |
1422 |
|
1422 | |||
1423 |
|
1423 | |||
1424 | Test log -G options |
|
1424 | Test log -G options | |
1425 |
|
1425 | |||
1426 | $ testlog() { |
|
1426 | $ testlog() { | |
1427 | > hg log -G --print-revset "$@" |
|
1427 | > hg log -G --print-revset "$@" | |
1428 | > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \ |
|
1428 | > hg log --template 'nodetag {rev}\n' "$@" | grep nodetag \ | |
1429 | > | sed 's/.*nodetag/nodetag/' > log.nodes |
|
1429 | > | sed 's/.*nodetag/nodetag/' > log.nodes | |
1430 | > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \ |
|
1430 | > hg log -G --template 'nodetag {rev}\n' "$@" | grep nodetag \ | |
1431 | > | sed 's/.*nodetag/nodetag/' > glog.nodes |
|
1431 | > | sed 's/.*nodetag/nodetag/' > glog.nodes | |
1432 | > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \ |
|
1432 | > (cmp log.nodes glog.nodes || diff -u log.nodes glog.nodes) \ | |
1433 | > | grep '^[-+@ ]' || : |
|
1433 | > | grep '^[-+@ ]' || : | |
1434 | > } |
|
1434 | > } | |
1435 |
|
1435 | |||
1436 | glog always reorders nodes which explains the difference with log |
|
1436 | glog always reorders nodes which explains the difference with log | |
1437 |
|
1437 | |||
1438 | $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31 |
|
1438 | $ testlog -r 27 -r 25 -r 21 -r 34 -r 32 -r 31 | |
1439 | ['27', '25', '21', '34', '32', '31'] |
|
1439 | ['27', '25', '21', '34', '32', '31'] | |
1440 | [] |
|
1440 | [] | |
1441 | --- log.nodes * (glob) |
|
1441 | --- log.nodes * (glob) | |
1442 | +++ glog.nodes * (glob) |
|
1442 | +++ glog.nodes * (glob) | |
1443 | @@ -1,6 +1,6 @@ |
|
1443 | @@ -1,6 +1,6 @@ | |
1444 | -nodetag 27 |
|
1444 | -nodetag 27 | |
1445 | -nodetag 25 |
|
1445 | -nodetag 25 | |
1446 | -nodetag 21 |
|
1446 | -nodetag 21 | |
1447 | nodetag 34 |
|
1447 | nodetag 34 | |
1448 | nodetag 32 |
|
1448 | nodetag 32 | |
1449 | nodetag 31 |
|
1449 | nodetag 31 | |
1450 | +nodetag 27 |
|
1450 | +nodetag 27 | |
1451 | +nodetag 25 |
|
1451 | +nodetag 25 | |
1452 | +nodetag 21 |
|
1452 | +nodetag 21 | |
1453 | $ testlog -u test -u not-a-user |
|
1453 | $ testlog -u test -u not-a-user | |
1454 | [] |
|
1454 | [] | |
1455 | (group |
|
1455 | (group | |
1456 | (group |
|
1456 | (group | |
1457 | (or |
|
1457 | (or | |
1458 | (func |
|
1458 | (func | |
1459 | ('symbol', 'user') |
|
1459 | ('symbol', 'user') | |
1460 | ('string', 'test')) |
|
1460 | ('string', 'test')) | |
1461 | (func |
|
1461 | (func | |
1462 | ('symbol', 'user') |
|
1462 | ('symbol', 'user') | |
1463 | ('string', 'not-a-user'))))) |
|
1463 | ('string', 'not-a-user'))))) | |
1464 | $ testlog -b not-a-branch |
|
1464 | $ testlog -b not-a-branch | |
1465 | abort: unknown revision 'not-a-branch'! |
|
1465 | abort: unknown revision 'not-a-branch'! | |
1466 | abort: unknown revision 'not-a-branch'! |
|
1466 | abort: unknown revision 'not-a-branch'! | |
1467 | abort: unknown revision 'not-a-branch'! |
|
1467 | abort: unknown revision 'not-a-branch'! | |
1468 | $ testlog -b 35 -b 36 --only-branch branch |
|
1468 | $ testlog -b 35 -b 36 --only-branch branch | |
1469 | [] |
|
1469 | [] | |
1470 | (group |
|
1470 | (group | |
1471 | (group |
|
1471 | (group | |
1472 | (or |
|
1472 | (or | |
1473 | (func |
|
1473 | (func | |
1474 | ('symbol', 'branch') |
|
1474 | ('symbol', 'branch') | |
1475 | ('string', 'default')) |
|
1475 | ('string', 'default')) | |
1476 | (func |
|
1476 | (func | |
1477 | ('symbol', 'branch') |
|
1477 | ('symbol', 'branch') | |
1478 | ('string', 'branch')) |
|
1478 | ('string', 'branch')) | |
1479 | (func |
|
1479 | (func | |
1480 | ('symbol', 'branch') |
|
1480 | ('symbol', 'branch') | |
1481 | ('string', 'branch'))))) |
|
1481 | ('string', 'branch'))))) | |
1482 | $ testlog -k expand -k merge |
|
1482 | $ testlog -k expand -k merge | |
1483 | [] |
|
1483 | [] | |
1484 | (group |
|
1484 | (group | |
1485 | (group |
|
1485 | (group | |
1486 | (or |
|
1486 | (or | |
1487 | (func |
|
1487 | (func | |
1488 | ('symbol', 'keyword') |
|
1488 | ('symbol', 'keyword') | |
1489 | ('string', 'expand')) |
|
1489 | ('string', 'expand')) | |
1490 | (func |
|
1490 | (func | |
1491 | ('symbol', 'keyword') |
|
1491 | ('symbol', 'keyword') | |
1492 | ('string', 'merge'))))) |
|
1492 | ('string', 'merge'))))) | |
1493 | $ testlog --only-merges |
|
1493 | $ testlog --only-merges | |
1494 | [] |
|
1494 | [] | |
1495 | (group |
|
1495 | (group | |
1496 | (func |
|
1496 | (func | |
1497 | ('symbol', 'merge') |
|
1497 | ('symbol', 'merge') | |
1498 | None)) |
|
1498 | None)) | |
1499 | $ testlog --no-merges |
|
1499 | $ testlog --no-merges | |
1500 | [] |
|
1500 | [] | |
1501 | (group |
|
1501 | (group | |
1502 | (not |
|
1502 | (not | |
1503 | (func |
|
1503 | (func | |
1504 | ('symbol', 'merge') |
|
1504 | ('symbol', 'merge') | |
1505 | None))) |
|
1505 | None))) | |
1506 | $ testlog --date '2 0 to 4 0' |
|
1506 | $ testlog --date '2 0 to 4 0' | |
1507 | [] |
|
1507 | [] | |
1508 | (group |
|
1508 | (group | |
1509 | (func |
|
1509 | (func | |
1510 | ('symbol', 'date') |
|
1510 | ('symbol', 'date') | |
1511 | ('string', '2 0 to 4 0'))) |
|
1511 | ('string', '2 0 to 4 0'))) | |
1512 | $ hg log -G -d 'brace ) in a date' |
|
1512 | $ hg log -G -d 'brace ) in a date' | |
1513 | abort: invalid date: 'brace ) in a date' |
|
1513 | abort: invalid date: 'brace ) in a date' | |
1514 | [255] |
|
1514 | [255] | |
1515 | $ testlog --prune 31 --prune 32 |
|
1515 | $ testlog --prune 31 --prune 32 | |
1516 | [] |
|
1516 | [] | |
1517 | (group |
|
1517 | (group | |
1518 | (group |
|
1518 | (group | |
1519 | (and |
|
1519 | (and | |
1520 | (not |
|
1520 | (not | |
1521 | (group |
|
1521 | (group | |
1522 | (or |
|
1522 | (or | |
1523 | ('string', '31') |
|
1523 | ('string', '31') | |
1524 | (func |
|
1524 | (func | |
1525 | ('symbol', 'ancestors') |
|
1525 | ('symbol', 'ancestors') | |
1526 | ('string', '31'))))) |
|
1526 | ('string', '31'))))) | |
1527 | (not |
|
1527 | (not | |
1528 | (group |
|
1528 | (group | |
1529 | (or |
|
1529 | (or | |
1530 | ('string', '32') |
|
1530 | ('string', '32') | |
1531 | (func |
|
1531 | (func | |
1532 | ('symbol', 'ancestors') |
|
1532 | ('symbol', 'ancestors') | |
1533 | ('string', '32')))))))) |
|
1533 | ('string', '32')))))))) | |
1534 |
|
1534 | |||
1535 | Dedicated repo for --follow and paths filtering. The g is crafted to |
|
1535 | Dedicated repo for --follow and paths filtering. The g is crafted to | |
1536 | have 2 filelog topological heads in a linear changeset graph. |
|
1536 | have 2 filelog topological heads in a linear changeset graph. | |
1537 |
|
1537 | |||
1538 | $ cd .. |
|
1538 | $ cd .. | |
1539 | $ hg init follow |
|
1539 | $ hg init follow | |
1540 | $ cd follow |
|
1540 | $ cd follow | |
1541 | $ testlog --follow |
|
1541 | $ testlog --follow | |
1542 | [] |
|
1542 | [] | |
1543 | [] |
|
1543 | [] | |
1544 | $ testlog -rnull |
|
1544 | $ testlog -rnull | |
1545 | ['null'] |
|
1545 | ['null'] | |
1546 | [] |
|
1546 | [] | |
1547 | $ echo a > a |
|
1547 | $ echo a > a | |
1548 | $ echo aa > aa |
|
1548 | $ echo aa > aa | |
1549 | $ echo f > f |
|
1549 | $ echo f > f | |
1550 | $ hg ci -Am "add a" a aa f |
|
1550 | $ hg ci -Am "add a" a aa f | |
1551 | $ hg cp a b |
|
1551 | $ hg cp a b | |
1552 | $ hg cp f g |
|
1552 | $ hg cp f g | |
1553 | $ hg ci -m "copy a b" |
|
1553 | $ hg ci -m "copy a b" | |
1554 | $ mkdir dir |
|
1554 | $ mkdir dir | |
1555 | $ hg mv b dir |
|
1555 | $ hg mv b dir | |
1556 | $ echo g >> g |
|
1556 | $ echo g >> g | |
1557 | $ echo f >> f |
|
1557 | $ echo f >> f | |
1558 | $ hg ci -m "mv b dir/b" |
|
1558 | $ hg ci -m "mv b dir/b" | |
1559 | $ hg mv a b |
|
1559 | $ hg mv a b | |
1560 | $ hg cp -f f g |
|
1560 | $ hg cp -f f g | |
1561 | $ echo a > d |
|
1561 | $ echo a > d | |
1562 | $ hg add d |
|
1562 | $ hg add d | |
1563 | $ hg ci -m "mv a b; add d" |
|
1563 | $ hg ci -m "mv a b; add d" | |
1564 | $ hg mv dir/b e |
|
1564 | $ hg mv dir/b e | |
1565 | $ hg ci -m "mv dir/b e" |
|
1565 | $ hg ci -m "mv dir/b e" | |
1566 | $ hg log -G --template '({rev}) {desc|firstline}\n' |
|
1566 | $ hg log -G --template '({rev}) {desc|firstline}\n' | |
1567 | @ (4) mv dir/b e |
|
1567 | @ (4) mv dir/b e | |
1568 | | |
|
1568 | | | |
1569 | o (3) mv a b; add d |
|
1569 | o (3) mv a b; add d | |
1570 | | |
|
1570 | | | |
1571 | o (2) mv b dir/b |
|
1571 | o (2) mv b dir/b | |
1572 | | |
|
1572 | | | |
1573 | o (1) copy a b |
|
1573 | o (1) copy a b | |
1574 | | |
|
1574 | | | |
1575 | o (0) add a |
|
1575 | o (0) add a | |
1576 |
|
1576 | |||
1577 |
|
1577 | |||
1578 | $ testlog a |
|
1578 | $ testlog a | |
1579 | [] |
|
1579 | [] | |
1580 | (group |
|
1580 | (group | |
1581 | (group |
|
1581 | (group | |
1582 | (func |
|
1582 | (func | |
1583 | ('symbol', 'filelog') |
|
1583 | ('symbol', 'filelog') | |
1584 | ('string', 'a')))) |
|
1584 | ('string', 'a')))) | |
1585 | $ testlog a b |
|
1585 | $ testlog a b | |
1586 | [] |
|
1586 | [] | |
1587 | (group |
|
1587 | (group | |
1588 | (group |
|
1588 | (group | |
1589 | (or |
|
1589 | (or | |
1590 | (func |
|
1590 | (func | |
1591 | ('symbol', 'filelog') |
|
1591 | ('symbol', 'filelog') | |
1592 | ('string', 'a')) |
|
1592 | ('string', 'a')) | |
1593 | (func |
|
1593 | (func | |
1594 | ('symbol', 'filelog') |
|
1594 | ('symbol', 'filelog') | |
1595 | ('string', 'b'))))) |
|
1595 | ('string', 'b'))))) | |
1596 |
|
1596 | |||
1597 | Test falling back to slow path for non-existing files |
|
1597 | Test falling back to slow path for non-existing files | |
1598 |
|
1598 | |||
1599 | $ testlog a c |
|
1599 | $ testlog a c | |
1600 | [] |
|
1600 | [] | |
1601 | (group |
|
1601 | (group | |
1602 | (func |
|
1602 | (func | |
1603 | ('symbol', '_matchfiles') |
|
1603 | ('symbol', '_matchfiles') | |
1604 | (list |
|
1604 | (list | |
1605 | ('string', 'r:') |
|
1605 | ('string', 'r:') | |
1606 | ('string', 'd:relpath') |
|
1606 | ('string', 'd:relpath') | |
1607 | ('string', 'p:a') |
|
1607 | ('string', 'p:a') | |
1608 | ('string', 'p:c')))) |
|
1608 | ('string', 'p:c')))) | |
1609 |
|
1609 | |||
1610 | Test multiple --include/--exclude/paths |
|
1610 | Test multiple --include/--exclude/paths | |
1611 |
|
1611 | |||
1612 | $ testlog --include a --include e --exclude b --exclude e a e |
|
1612 | $ testlog --include a --include e --exclude b --exclude e a e | |
1613 | [] |
|
1613 | [] | |
1614 | (group |
|
1614 | (group | |
1615 | (func |
|
1615 | (func | |
1616 | ('symbol', '_matchfiles') |
|
1616 | ('symbol', '_matchfiles') | |
1617 | (list |
|
1617 | (list | |
1618 | ('string', 'r:') |
|
1618 | ('string', 'r:') | |
1619 | ('string', 'd:relpath') |
|
1619 | ('string', 'd:relpath') | |
1620 | ('string', 'p:a') |
|
1620 | ('string', 'p:a') | |
1621 | ('string', 'p:e') |
|
1621 | ('string', 'p:e') | |
1622 | ('string', 'i:a') |
|
1622 | ('string', 'i:a') | |
1623 | ('string', 'i:e') |
|
1623 | ('string', 'i:e') | |
1624 | ('string', 'x:b') |
|
1624 | ('string', 'x:b') | |
1625 | ('string', 'x:e')))) |
|
1625 | ('string', 'x:e')))) | |
1626 |
|
1626 | |||
1627 | Test glob expansion of pats |
|
1627 | Test glob expansion of pats | |
1628 |
|
1628 | |||
1629 | $ expandglobs=`$PYTHON -c "import mercurial.util; \ |
|
1629 | $ expandglobs=`$PYTHON -c "import mercurial.util; \ | |
1630 | > print mercurial.util.expandglobs and 'true' or 'false'"` |
|
1630 | > print mercurial.util.expandglobs and 'true' or 'false'"` | |
1631 | $ if [ $expandglobs = "true" ]; then |
|
1631 | $ if [ $expandglobs = "true" ]; then | |
1632 | > testlog 'a*'; |
|
1632 | > testlog 'a*'; | |
1633 | > else |
|
1633 | > else | |
1634 | > testlog a*; |
|
1634 | > testlog a*; | |
1635 | > fi; |
|
1635 | > fi; | |
1636 | [] |
|
1636 | [] | |
1637 | (group |
|
1637 | (group | |
1638 | (group |
|
1638 | (group | |
1639 | (func |
|
1639 | (func | |
1640 | ('symbol', 'filelog') |
|
1640 | ('symbol', 'filelog') | |
1641 | ('string', 'aa')))) |
|
1641 | ('string', 'aa')))) | |
1642 |
|
1642 | |||
1643 | Test --follow on a non-existent directory |
|
1643 | Test --follow on a non-existent directory | |
1644 |
|
1644 | |||
1645 | $ testlog -f dir |
|
1645 | $ testlog -f dir | |
1646 | abort: cannot follow file not in parent revision: "dir" |
|
1646 | abort: cannot follow file not in parent revision: "dir" | |
1647 | abort: cannot follow file not in parent revision: "dir" |
|
1647 | abort: cannot follow file not in parent revision: "dir" | |
1648 | abort: cannot follow file not in parent revision: "dir" |
|
1648 | abort: cannot follow file not in parent revision: "dir" | |
1649 |
|
1649 | |||
1650 | Test --follow on a directory |
|
1650 | Test --follow on a directory | |
1651 |
|
1651 | |||
1652 | $ hg up -q '.^' |
|
1652 | $ hg up -q '.^' | |
1653 | $ testlog -f dir |
|
1653 | $ testlog -f dir | |
1654 | [] |
|
1654 | [] | |
1655 | (group |
|
1655 | (group | |
1656 | (and |
|
1656 | (and | |
1657 | (func |
|
1657 | (func | |
1658 | ('symbol', 'ancestors') |
|
1658 | ('symbol', 'ancestors') | |
1659 | ('symbol', '.')) |
|
1659 | ('symbol', '.')) | |
1660 | (func |
|
1660 | (func | |
1661 | ('symbol', '_matchfiles') |
|
1661 | ('symbol', '_matchfiles') | |
1662 | (list |
|
1662 | (list | |
1663 | ('string', 'r:') |
|
1663 | ('string', 'r:') | |
1664 | ('string', 'd:relpath') |
|
1664 | ('string', 'd:relpath') | |
1665 | ('string', 'p:dir'))))) |
|
1665 | ('string', 'p:dir'))))) | |
1666 | $ hg up -q tip |
|
1666 | $ hg up -q tip | |
1667 |
|
1667 | |||
1668 | Test --follow on file not in parent revision |
|
1668 | Test --follow on file not in parent revision | |
1669 |
|
1669 | |||
1670 | $ testlog -f a |
|
1670 | $ testlog -f a | |
1671 | abort: cannot follow file not in parent revision: "a" |
|
1671 | abort: cannot follow file not in parent revision: "a" | |
1672 | abort: cannot follow file not in parent revision: "a" |
|
1672 | abort: cannot follow file not in parent revision: "a" | |
1673 | abort: cannot follow file not in parent revision: "a" |
|
1673 | abort: cannot follow file not in parent revision: "a" | |
1674 |
|
1674 | |||
1675 | Test --follow and patterns |
|
1675 | Test --follow and patterns | |
1676 |
|
1676 | |||
1677 | $ testlog -f 'glob:*' |
|
1677 | $ testlog -f 'glob:*' | |
1678 | [] |
|
1678 | [] | |
1679 | (group |
|
1679 | (group | |
1680 | (and |
|
1680 | (and | |
1681 | (func |
|
1681 | (func | |
1682 | ('symbol', 'ancestors') |
|
1682 | ('symbol', 'ancestors') | |
1683 | ('symbol', '.')) |
|
1683 | ('symbol', '.')) | |
1684 | (func |
|
1684 | (func | |
1685 | ('symbol', '_matchfiles') |
|
1685 | ('symbol', '_matchfiles') | |
1686 | (list |
|
1686 | (list | |
1687 | ('string', 'r:') |
|
1687 | ('string', 'r:') | |
1688 | ('string', 'd:relpath') |
|
1688 | ('string', 'd:relpath') | |
1689 | ('string', 'p:glob:*'))))) |
|
1689 | ('string', 'p:glob:*'))))) | |
1690 |
|
1690 | |||
1691 | Test --follow on a single rename |
|
1691 | Test --follow on a single rename | |
1692 |
|
1692 | |||
1693 | $ hg up -q 2 |
|
1693 | $ hg up -q 2 | |
1694 | $ testlog -f a |
|
1694 | $ testlog -f a | |
1695 | [] |
|
1695 | [] | |
1696 | (group |
|
1696 | (group | |
1697 | (group |
|
1697 | (group | |
1698 | (func |
|
1698 | (func | |
1699 | ('symbol', 'follow') |
|
1699 | ('symbol', 'follow') | |
1700 | ('string', 'a')))) |
|
1700 | ('string', 'a')))) | |
1701 |
|
1701 | |||
1702 | Test --follow and multiple renames |
|
1702 | Test --follow and multiple renames | |
1703 |
|
1703 | |||
1704 | $ hg up -q tip |
|
1704 | $ hg up -q tip | |
1705 | $ testlog -f e |
|
1705 | $ testlog -f e | |
1706 | [] |
|
1706 | [] | |
1707 | (group |
|
1707 | (group | |
1708 | (group |
|
1708 | (group | |
1709 | (func |
|
1709 | (func | |
1710 | ('symbol', 'follow') |
|
1710 | ('symbol', 'follow') | |
1711 | ('string', 'e')))) |
|
1711 | ('string', 'e')))) | |
1712 |
|
1712 | |||
1713 | Test --follow and multiple filelog heads |
|
1713 | Test --follow and multiple filelog heads | |
1714 |
|
1714 | |||
1715 | $ hg up -q 2 |
|
1715 | $ hg up -q 2 | |
1716 | $ testlog -f g |
|
1716 | $ testlog -f g | |
1717 | [] |
|
1717 | [] | |
1718 | (group |
|
1718 | (group | |
1719 | (group |
|
1719 | (group | |
1720 | (func |
|
1720 | (func | |
1721 | ('symbol', 'follow') |
|
1721 | ('symbol', 'follow') | |
1722 | ('string', 'g')))) |
|
1722 | ('string', 'g')))) | |
1723 | $ cat log.nodes |
|
1723 | $ cat log.nodes | |
1724 | nodetag 2 |
|
1724 | nodetag 2 | |
1725 | nodetag 1 |
|
1725 | nodetag 1 | |
1726 | nodetag 0 |
|
1726 | nodetag 0 | |
1727 | $ hg up -q tip |
|
1727 | $ hg up -q tip | |
1728 | $ testlog -f g |
|
1728 | $ testlog -f g | |
1729 | [] |
|
1729 | [] | |
1730 | (group |
|
1730 | (group | |
1731 | (group |
|
1731 | (group | |
1732 | (func |
|
1732 | (func | |
1733 | ('symbol', 'follow') |
|
1733 | ('symbol', 'follow') | |
1734 | ('string', 'g')))) |
|
1734 | ('string', 'g')))) | |
1735 | $ cat log.nodes |
|
1735 | $ cat log.nodes | |
1736 | nodetag 3 |
|
1736 | nodetag 3 | |
1737 | nodetag 2 |
|
1737 | nodetag 2 | |
1738 | nodetag 0 |
|
1738 | nodetag 0 | |
1739 |
|
1739 | |||
1740 | Test --follow and multiple files |
|
1740 | Test --follow and multiple files | |
1741 |
|
1741 | |||
1742 | $ testlog -f g e |
|
1742 | $ testlog -f g e | |
1743 | [] |
|
1743 | [] | |
1744 | (group |
|
1744 | (group | |
1745 | (group |
|
1745 | (group | |
1746 | (or |
|
1746 | (or | |
1747 | (func |
|
1747 | (func | |
1748 | ('symbol', 'follow') |
|
1748 | ('symbol', 'follow') | |
1749 | ('string', 'g')) |
|
1749 | ('string', 'g')) | |
1750 | (func |
|
1750 | (func | |
1751 | ('symbol', 'follow') |
|
1751 | ('symbol', 'follow') | |
1752 | ('string', 'e'))))) |
|
1752 | ('string', 'e'))))) | |
1753 | $ cat log.nodes |
|
1753 | $ cat log.nodes | |
1754 | nodetag 4 |
|
1754 | nodetag 4 | |
1755 | nodetag 3 |
|
1755 | nodetag 3 | |
1756 | nodetag 2 |
|
1756 | nodetag 2 | |
1757 | nodetag 1 |
|
1757 | nodetag 1 | |
1758 | nodetag 0 |
|
1758 | nodetag 0 | |
1759 |
|
1759 | |||
1760 | Test --follow null parent |
|
1760 | Test --follow null parent | |
1761 |
|
1761 | |||
1762 | $ hg up -q null |
|
1762 | $ hg up -q null | |
1763 | $ testlog -f |
|
1763 | $ testlog -f | |
1764 | [] |
|
1764 | [] | |
1765 | [] |
|
1765 | [] | |
1766 |
|
1766 | |||
1767 | Test --follow-first |
|
1767 | Test --follow-first | |
1768 |
|
1768 | |||
1769 | $ hg up -q 3 |
|
1769 | $ hg up -q 3 | |
1770 | $ echo ee > e |
|
1770 | $ echo ee > e | |
1771 | $ hg ci -Am "add another e" e |
|
1771 | $ hg ci -Am "add another e" e | |
1772 | created new head |
|
1772 | created new head | |
1773 | $ hg merge --tool internal:other 4 |
|
1773 | $ hg merge --tool internal:other 4 | |
1774 | 0 files updated, 1 files merged, 1 files removed, 0 files unresolved |
|
1774 | 0 files updated, 1 files merged, 1 files removed, 0 files unresolved | |
1775 | (branch merge, don't forget to commit) |
|
1775 | (branch merge, don't forget to commit) | |
1776 | $ echo merge > e |
|
1776 | $ echo merge > e | |
1777 | $ hg ci -m "merge 5 and 4" |
|
1777 | $ hg ci -m "merge 5 and 4" | |
1778 | $ testlog --follow-first |
|
1778 | $ testlog --follow-first | |
1779 | [] |
|
1779 | [] | |
1780 | (group |
|
1780 | (group | |
1781 | (func |
|
1781 | (func | |
1782 | ('symbol', '_firstancestors') |
|
1782 | ('symbol', '_firstancestors') | |
1783 | (func |
|
1783 | (func | |
1784 | ('symbol', 'rev') |
|
1784 | ('symbol', 'rev') | |
1785 | ('symbol', '6')))) |
|
1785 | ('symbol', '6')))) | |
1786 |
|
1786 | |||
1787 | Cannot compare with log --follow-first FILE as it never worked |
|
1787 | Cannot compare with log --follow-first FILE as it never worked | |
1788 |
|
1788 | |||
1789 | $ hg log -G --print-revset --follow-first e |
|
1789 | $ hg log -G --print-revset --follow-first e | |
1790 | [] |
|
1790 | [] | |
1791 | (group |
|
1791 | (group | |
1792 | (group |
|
1792 | (group | |
1793 | (func |
|
1793 | (func | |
1794 | ('symbol', '_followfirst') |
|
1794 | ('symbol', '_followfirst') | |
1795 | ('string', 'e')))) |
|
1795 | ('string', 'e')))) | |
1796 | $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n' |
|
1796 | $ hg log -G --follow-first e --template '{rev} {desc|firstline}\n' | |
1797 | @ 6 merge 5 and 4 |
|
1797 | @ 6 merge 5 and 4 | |
1798 | |\ |
|
1798 | |\ | |
1799 | | ~ |
|
1799 | | ~ | |
1800 | o 5 add another e |
|
1800 | o 5 add another e | |
1801 | | |
|
1801 | | | |
1802 | ~ |
|
1802 | ~ | |
1803 |
|
1803 | |||
1804 | Test --copies |
|
1804 | Test --copies | |
1805 |
|
1805 | |||
1806 | $ hg log -G --copies --template "{rev} {desc|firstline} \ |
|
1806 | $ hg log -G --copies --template "{rev} {desc|firstline} \ | |
1807 | > copies: {file_copies_switch}\n" |
|
1807 | > copies: {file_copies_switch}\n" | |
1808 | @ 6 merge 5 and 4 copies: |
|
1808 | @ 6 merge 5 and 4 copies: | |
1809 | |\ |
|
1809 | |\ | |
1810 | | o 5 add another e copies: |
|
1810 | | o 5 add another e copies: | |
1811 | | | |
|
1811 | | | | |
1812 | o | 4 mv dir/b e copies: e (dir/b) |
|
1812 | o | 4 mv dir/b e copies: e (dir/b) | |
1813 | |/ |
|
1813 | |/ | |
1814 | o 3 mv a b; add d copies: b (a)g (f) |
|
1814 | o 3 mv a b; add d copies: b (a)g (f) | |
1815 | | |
|
1815 | | | |
1816 | o 2 mv b dir/b copies: dir/b (b) |
|
1816 | o 2 mv b dir/b copies: dir/b (b) | |
1817 | | |
|
1817 | | | |
1818 | o 1 copy a b copies: b (a)g (f) |
|
1818 | o 1 copy a b copies: b (a)g (f) | |
1819 | | |
|
1819 | | | |
1820 | o 0 add a copies: |
|
1820 | o 0 add a copies: | |
1821 |
|
1821 | |||
1822 | Test "set:..." and parent revision |
|
1822 | Test "set:..." and parent revision | |
1823 |
|
1823 | |||
1824 | $ hg up -q 4 |
|
1824 | $ hg up -q 4 | |
1825 | $ testlog "set:copied()" |
|
1825 | $ testlog "set:copied()" | |
1826 | [] |
|
1826 | [] | |
1827 | (group |
|
1827 | (group | |
1828 | (func |
|
1828 | (func | |
1829 | ('symbol', '_matchfiles') |
|
1829 | ('symbol', '_matchfiles') | |
1830 | (list |
|
1830 | (list | |
1831 | ('string', 'r:') |
|
1831 | ('string', 'r:') | |
1832 | ('string', 'd:relpath') |
|
1832 | ('string', 'd:relpath') | |
1833 | ('string', 'p:set:copied()')))) |
|
1833 | ('string', 'p:set:copied()')))) | |
1834 | $ testlog --include "set:copied()" |
|
1834 | $ testlog --include "set:copied()" | |
1835 | [] |
|
1835 | [] | |
1836 | (group |
|
1836 | (group | |
1837 | (func |
|
1837 | (func | |
1838 | ('symbol', '_matchfiles') |
|
1838 | ('symbol', '_matchfiles') | |
1839 | (list |
|
1839 | (list | |
1840 | ('string', 'r:') |
|
1840 | ('string', 'r:') | |
1841 | ('string', 'd:relpath') |
|
1841 | ('string', 'd:relpath') | |
1842 | ('string', 'i:set:copied()')))) |
|
1842 | ('string', 'i:set:copied()')))) | |
1843 | $ testlog -r "sort(file('set:copied()'), -rev)" |
|
1843 | $ testlog -r "sort(file('set:copied()'), -rev)" | |
1844 | ["sort(file('set:copied()'), -rev)"] |
|
1844 | ["sort(file('set:copied()'), -rev)"] | |
1845 | [] |
|
1845 | [] | |
1846 |
|
1846 | |||
1847 | Test --removed |
|
1847 | Test --removed | |
1848 |
|
1848 | |||
1849 | $ testlog --removed |
|
1849 | $ testlog --removed | |
1850 | [] |
|
1850 | [] | |
1851 | [] |
|
1851 | [] | |
1852 | $ testlog --removed a |
|
1852 | $ testlog --removed a | |
1853 | [] |
|
1853 | [] | |
1854 | (group |
|
1854 | (group | |
1855 | (func |
|
1855 | (func | |
1856 | ('symbol', '_matchfiles') |
|
1856 | ('symbol', '_matchfiles') | |
1857 | (list |
|
1857 | (list | |
1858 | ('string', 'r:') |
|
1858 | ('string', 'r:') | |
1859 | ('string', 'd:relpath') |
|
1859 | ('string', 'd:relpath') | |
1860 | ('string', 'p:a')))) |
|
1860 | ('string', 'p:a')))) | |
1861 | $ testlog --removed --follow a |
|
1861 | $ testlog --removed --follow a | |
1862 | [] |
|
1862 | [] | |
1863 | (group |
|
1863 | (group | |
1864 | (and |
|
1864 | (and | |
1865 | (func |
|
1865 | (func | |
1866 | ('symbol', 'ancestors') |
|
1866 | ('symbol', 'ancestors') | |
1867 | ('symbol', '.')) |
|
1867 | ('symbol', '.')) | |
1868 | (func |
|
1868 | (func | |
1869 | ('symbol', '_matchfiles') |
|
1869 | ('symbol', '_matchfiles') | |
1870 | (list |
|
1870 | (list | |
1871 | ('string', 'r:') |
|
1871 | ('string', 'r:') | |
1872 | ('string', 'd:relpath') |
|
1872 | ('string', 'd:relpath') | |
1873 | ('string', 'p:a'))))) |
|
1873 | ('string', 'p:a'))))) | |
1874 |
|
1874 | |||
1875 | Test --patch and --stat with --follow and --follow-first |
|
1875 | Test --patch and --stat with --follow and --follow-first | |
1876 |
|
1876 | |||
1877 | $ hg up -q 3 |
|
1877 | $ hg up -q 3 | |
1878 | $ hg log -G --git --patch b |
|
1878 | $ hg log -G --git --patch b | |
1879 | o changeset: 1:216d4c92cf98 |
|
1879 | o changeset: 1:216d4c92cf98 | |
1880 | | user: test |
|
1880 | | user: test | |
1881 | ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
1881 | ~ date: Thu Jan 01 00:00:00 1970 +0000 | |
1882 | summary: copy a b |
|
1882 | summary: copy a b | |
1883 |
|
1883 | |||
1884 | diff --git a/a b/b |
|
1884 | diff --git a/a b/b | |
1885 | copy from a |
|
1885 | copy from a | |
1886 | copy to b |
|
1886 | copy to b | |
1887 |
|
1887 | |||
1888 |
|
1888 | |||
1889 | $ hg log -G --git --stat b |
|
1889 | $ hg log -G --git --stat b | |
1890 | o changeset: 1:216d4c92cf98 |
|
1890 | o changeset: 1:216d4c92cf98 | |
1891 | | user: test |
|
1891 | | user: test | |
1892 | ~ date: Thu Jan 01 00:00:00 1970 +0000 |
|
1892 | ~ date: Thu Jan 01 00:00:00 1970 +0000 | |
1893 | summary: copy a b |
|
1893 | summary: copy a b | |
1894 |
|
1894 | |||
1895 | b | 0 |
|
1895 | b | 0 | |
1896 | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
1896 | 1 files changed, 0 insertions(+), 0 deletions(-) | |
1897 |
|
1897 | |||
1898 |
|
1898 | |||
1899 | $ hg log -G --git --patch --follow b |
|
1899 | $ hg log -G --git --patch --follow b | |
1900 | o changeset: 1:216d4c92cf98 |
|
1900 | o changeset: 1:216d4c92cf98 | |
1901 | | user: test |
|
1901 | | user: test | |
1902 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1902 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1903 | | summary: copy a b |
|
1903 | | summary: copy a b | |
1904 | | |
|
1904 | | | |
1905 | | diff --git a/a b/b |
|
1905 | | diff --git a/a b/b | |
1906 | | copy from a |
|
1906 | | copy from a | |
1907 | | copy to b |
|
1907 | | copy to b | |
1908 | | |
|
1908 | | | |
1909 | o changeset: 0:f8035bb17114 |
|
1909 | o changeset: 0:f8035bb17114 | |
1910 | user: test |
|
1910 | user: test | |
1911 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1911 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1912 | summary: add a |
|
1912 | summary: add a | |
1913 |
|
1913 | |||
1914 | diff --git a/a b/a |
|
1914 | diff --git a/a b/a | |
1915 | new file mode 100644 |
|
1915 | new file mode 100644 | |
1916 | --- /dev/null |
|
1916 | --- /dev/null | |
1917 | +++ b/a |
|
1917 | +++ b/a | |
1918 | @@ -0,0 +1,1 @@ |
|
1918 | @@ -0,0 +1,1 @@ | |
1919 | +a |
|
1919 | +a | |
1920 |
|
1920 | |||
1921 |
|
1921 | |||
1922 | $ hg log -G --git --stat --follow b |
|
1922 | $ hg log -G --git --stat --follow b | |
1923 | o changeset: 1:216d4c92cf98 |
|
1923 | o changeset: 1:216d4c92cf98 | |
1924 | | user: test |
|
1924 | | user: test | |
1925 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1925 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1926 | | summary: copy a b |
|
1926 | | summary: copy a b | |
1927 | | |
|
1927 | | | |
1928 | | b | 0 |
|
1928 | | b | 0 | |
1929 | | 1 files changed, 0 insertions(+), 0 deletions(-) |
|
1929 | | 1 files changed, 0 insertions(+), 0 deletions(-) | |
1930 | | |
|
1930 | | | |
1931 | o changeset: 0:f8035bb17114 |
|
1931 | o changeset: 0:f8035bb17114 | |
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: add a |
|
1934 | summary: add a | |
1935 |
|
1935 | |||
1936 | a | 1 + |
|
1936 | a | 1 + | |
1937 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
1937 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
1938 |
|
1938 | |||
1939 |
|
1939 | |||
1940 | $ hg up -q 6 |
|
1940 | $ hg up -q 6 | |
1941 | $ hg log -G --git --patch --follow-first e |
|
1941 | $ hg log -G --git --patch --follow-first e | |
1942 | @ changeset: 6:fc281d8ff18d |
|
1942 | @ changeset: 6:fc281d8ff18d | |
1943 | |\ tag: tip |
|
1943 | |\ tag: tip | |
1944 | | ~ parent: 5:99b31f1c2782 |
|
1944 | | ~ parent: 5:99b31f1c2782 | |
1945 | | parent: 4:17d952250a9d |
|
1945 | | parent: 4:17d952250a9d | |
1946 | | user: test |
|
1946 | | user: test | |
1947 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1947 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
1948 | | summary: merge 5 and 4 |
|
1948 | | summary: merge 5 and 4 | |
1949 | | |
|
1949 | | | |
1950 | | diff --git a/e b/e |
|
1950 | | diff --git a/e b/e | |
1951 | | --- a/e |
|
1951 | | --- a/e | |
1952 | | +++ b/e |
|
1952 | | +++ b/e | |
1953 | | @@ -1,1 +1,1 @@ |
|
1953 | | @@ -1,1 +1,1 @@ | |
1954 | | -ee |
|
1954 | | -ee | |
1955 | | +merge |
|
1955 | | +merge | |
1956 | | |
|
1956 | | | |
1957 | o changeset: 5:99b31f1c2782 |
|
1957 | o changeset: 5:99b31f1c2782 | |
1958 | | parent: 3:5918b8d165d1 |
|
1958 | | parent: 3:5918b8d165d1 | |
1959 | ~ user: test |
|
1959 | ~ user: test | |
1960 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1960 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1961 | summary: add another e |
|
1961 | summary: add another e | |
1962 |
|
1962 | |||
1963 | diff --git a/e b/e |
|
1963 | diff --git a/e b/e | |
1964 | new file mode 100644 |
|
1964 | new file mode 100644 | |
1965 | --- /dev/null |
|
1965 | --- /dev/null | |
1966 | +++ b/e |
|
1966 | +++ b/e | |
1967 | @@ -0,0 +1,1 @@ |
|
1967 | @@ -0,0 +1,1 @@ | |
1968 | +ee |
|
1968 | +ee | |
1969 |
|
1969 | |||
1970 |
|
1970 | |||
1971 | Test old-style --rev |
|
1971 | Test old-style --rev | |
1972 |
|
1972 | |||
1973 | $ hg tag 'foo-bar' |
|
1973 | $ hg tag 'foo-bar' | |
1974 | $ testlog -r 'foo-bar' |
|
1974 | $ testlog -r 'foo-bar' | |
1975 | ['foo-bar'] |
|
1975 | ['foo-bar'] | |
1976 | [] |
|
1976 | [] | |
1977 |
|
1977 | |||
1978 | Test --follow and forward --rev |
|
1978 | Test --follow and forward --rev | |
1979 |
|
1979 | |||
1980 | $ hg up -q 6 |
|
1980 | $ hg up -q 6 | |
1981 | $ echo g > g |
|
1981 | $ echo g > g | |
1982 | $ hg ci -Am 'add g' g |
|
1982 | $ hg ci -Am 'add g' g | |
1983 | created new head |
|
1983 | created new head | |
1984 | $ hg up -q 2 |
|
1984 | $ hg up -q 2 | |
1985 | $ hg log -G --template "{rev} {desc|firstline}\n" |
|
1985 | $ hg log -G --template "{rev} {desc|firstline}\n" | |
1986 | o 8 add g |
|
1986 | o 8 add g | |
1987 | | |
|
1987 | | | |
1988 | | o 7 Added tag foo-bar for changeset fc281d8ff18d |
|
1988 | | o 7 Added tag foo-bar for changeset fc281d8ff18d | |
1989 | |/ |
|
1989 | |/ | |
1990 | o 6 merge 5 and 4 |
|
1990 | o 6 merge 5 and 4 | |
1991 | |\ |
|
1991 | |\ | |
1992 | | o 5 add another e |
|
1992 | | o 5 add another e | |
1993 | | | |
|
1993 | | | | |
1994 | o | 4 mv dir/b e |
|
1994 | o | 4 mv dir/b e | |
1995 | |/ |
|
1995 | |/ | |
1996 | o 3 mv a b; add d |
|
1996 | o 3 mv a b; add d | |
1997 | | |
|
1997 | | | |
1998 | @ 2 mv b dir/b |
|
1998 | @ 2 mv b dir/b | |
1999 | | |
|
1999 | | | |
2000 | o 1 copy a b |
|
2000 | o 1 copy a b | |
2001 | | |
|
2001 | | | |
2002 | o 0 add a |
|
2002 | o 0 add a | |
2003 |
|
2003 | |||
2004 | $ hg archive -r 7 archive |
|
2004 | $ hg archive -r 7 archive | |
2005 | $ grep changessincelatesttag archive/.hg_archival.txt |
|
2005 | $ grep changessincelatesttag archive/.hg_archival.txt | |
2006 | changessincelatesttag: 1 |
|
2006 | changessincelatesttag: 1 | |
2007 | $ rm -r archive |
|
2007 | $ rm -r archive | |
2008 |
|
2008 | |||
2009 | changessincelatesttag with no prior tag |
|
2009 | changessincelatesttag with no prior tag | |
2010 | $ hg archive -r 4 archive |
|
2010 | $ hg archive -r 4 archive | |
2011 | $ grep changessincelatesttag archive/.hg_archival.txt |
|
2011 | $ grep changessincelatesttag archive/.hg_archival.txt | |
2012 | changessincelatesttag: 5 |
|
2012 | changessincelatesttag: 5 | |
2013 |
|
2013 | |||
2014 | $ hg export 'all()' |
|
2014 | $ hg export 'all()' | |
2015 | # HG changeset patch |
|
2015 | # HG changeset patch | |
2016 | # User test |
|
2016 | # User test | |
2017 | # Date 0 0 |
|
2017 | # Date 0 0 | |
2018 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2018 | # Thu Jan 01 00:00:00 1970 +0000 | |
2019 | # Node ID f8035bb17114da16215af3436ec5222428ace8ee |
|
2019 | # Node ID f8035bb17114da16215af3436ec5222428ace8ee | |
2020 | # Parent 0000000000000000000000000000000000000000 |
|
2020 | # Parent 0000000000000000000000000000000000000000 | |
2021 | add a |
|
2021 | add a | |
2022 |
|
2022 | |||
2023 | diff -r 000000000000 -r f8035bb17114 a |
|
2023 | diff -r 000000000000 -r f8035bb17114 a | |
2024 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2024 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2025 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
2025 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
2026 | @@ -0,0 +1,1 @@ |
|
2026 | @@ -0,0 +1,1 @@ | |
2027 | +a |
|
2027 | +a | |
2028 | diff -r 000000000000 -r f8035bb17114 aa |
|
2028 | diff -r 000000000000 -r f8035bb17114 aa | |
2029 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2029 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2030 | +++ b/aa Thu Jan 01 00:00:00 1970 +0000 |
|
2030 | +++ b/aa Thu Jan 01 00:00:00 1970 +0000 | |
2031 | @@ -0,0 +1,1 @@ |
|
2031 | @@ -0,0 +1,1 @@ | |
2032 | +aa |
|
2032 | +aa | |
2033 | diff -r 000000000000 -r f8035bb17114 f |
|
2033 | diff -r 000000000000 -r f8035bb17114 f | |
2034 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2034 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2035 | +++ b/f Thu Jan 01 00:00:00 1970 +0000 |
|
2035 | +++ b/f Thu Jan 01 00:00:00 1970 +0000 | |
2036 | @@ -0,0 +1,1 @@ |
|
2036 | @@ -0,0 +1,1 @@ | |
2037 | +f |
|
2037 | +f | |
2038 | # HG changeset patch |
|
2038 | # HG changeset patch | |
2039 | # User test |
|
2039 | # User test | |
2040 | # Date 0 0 |
|
2040 | # Date 0 0 | |
2041 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2041 | # Thu Jan 01 00:00:00 1970 +0000 | |
2042 | # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92 |
|
2042 | # Node ID 216d4c92cf98ff2b4641d508b76b529f3d424c92 | |
2043 | # Parent f8035bb17114da16215af3436ec5222428ace8ee |
|
2043 | # Parent f8035bb17114da16215af3436ec5222428ace8ee | |
2044 | copy a b |
|
2044 | copy a b | |
2045 |
|
2045 | |||
2046 | diff -r f8035bb17114 -r 216d4c92cf98 b |
|
2046 | diff -r f8035bb17114 -r 216d4c92cf98 b | |
2047 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2047 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2048 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
2048 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
2049 | @@ -0,0 +1,1 @@ |
|
2049 | @@ -0,0 +1,1 @@ | |
2050 | +a |
|
2050 | +a | |
2051 | diff -r f8035bb17114 -r 216d4c92cf98 g |
|
2051 | diff -r f8035bb17114 -r 216d4c92cf98 g | |
2052 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2052 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2053 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 |
|
2053 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 | |
2054 | @@ -0,0 +1,1 @@ |
|
2054 | @@ -0,0 +1,1 @@ | |
2055 | +f |
|
2055 | +f | |
2056 | # HG changeset patch |
|
2056 | # HG changeset patch | |
2057 | # User test |
|
2057 | # User test | |
2058 | # Date 0 0 |
|
2058 | # Date 0 0 | |
2059 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2059 | # Thu Jan 01 00:00:00 1970 +0000 | |
2060 | # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3 |
|
2060 | # Node ID bb573313a9e8349099b6ea2b2fb1fc7f424446f3 | |
2061 | # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92 |
|
2061 | # Parent 216d4c92cf98ff2b4641d508b76b529f3d424c92 | |
2062 | mv b dir/b |
|
2062 | mv b dir/b | |
2063 |
|
2063 | |||
2064 | diff -r 216d4c92cf98 -r bb573313a9e8 b |
|
2064 | diff -r 216d4c92cf98 -r bb573313a9e8 b | |
2065 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
2065 | --- a/b Thu Jan 01 00:00:00 1970 +0000 | |
2066 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2066 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2067 | @@ -1,1 +0,0 @@ |
|
2067 | @@ -1,1 +0,0 @@ | |
2068 | -a |
|
2068 | -a | |
2069 | diff -r 216d4c92cf98 -r bb573313a9e8 dir/b |
|
2069 | diff -r 216d4c92cf98 -r bb573313a9e8 dir/b | |
2070 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2070 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2071 | +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000 |
|
2071 | +++ b/dir/b Thu Jan 01 00:00:00 1970 +0000 | |
2072 | @@ -0,0 +1,1 @@ |
|
2072 | @@ -0,0 +1,1 @@ | |
2073 | +a |
|
2073 | +a | |
2074 | diff -r 216d4c92cf98 -r bb573313a9e8 f |
|
2074 | diff -r 216d4c92cf98 -r bb573313a9e8 f | |
2075 | --- a/f Thu Jan 01 00:00:00 1970 +0000 |
|
2075 | --- a/f Thu Jan 01 00:00:00 1970 +0000 | |
2076 | +++ b/f Thu Jan 01 00:00:00 1970 +0000 |
|
2076 | +++ b/f Thu Jan 01 00:00:00 1970 +0000 | |
2077 | @@ -1,1 +1,2 @@ |
|
2077 | @@ -1,1 +1,2 @@ | |
2078 | f |
|
2078 | f | |
2079 | +f |
|
2079 | +f | |
2080 | diff -r 216d4c92cf98 -r bb573313a9e8 g |
|
2080 | diff -r 216d4c92cf98 -r bb573313a9e8 g | |
2081 | --- a/g Thu Jan 01 00:00:00 1970 +0000 |
|
2081 | --- a/g Thu Jan 01 00:00:00 1970 +0000 | |
2082 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 |
|
2082 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 | |
2083 | @@ -1,1 +1,2 @@ |
|
2083 | @@ -1,1 +1,2 @@ | |
2084 | f |
|
2084 | f | |
2085 | +g |
|
2085 | +g | |
2086 | # HG changeset patch |
|
2086 | # HG changeset patch | |
2087 | # User test |
|
2087 | # User test | |
2088 | # Date 0 0 |
|
2088 | # Date 0 0 | |
2089 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2089 | # Thu Jan 01 00:00:00 1970 +0000 | |
2090 | # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed |
|
2090 | # Node ID 5918b8d165d1364e78a66d02e66caa0133c5d1ed | |
2091 | # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3 |
|
2091 | # Parent bb573313a9e8349099b6ea2b2fb1fc7f424446f3 | |
2092 | mv a b; add d |
|
2092 | mv a b; add d | |
2093 |
|
2093 | |||
2094 | diff -r bb573313a9e8 -r 5918b8d165d1 a |
|
2094 | diff -r bb573313a9e8 -r 5918b8d165d1 a | |
2095 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
2095 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
2096 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2096 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2097 | @@ -1,1 +0,0 @@ |
|
2097 | @@ -1,1 +0,0 @@ | |
2098 | -a |
|
2098 | -a | |
2099 | diff -r bb573313a9e8 -r 5918b8d165d1 b |
|
2099 | diff -r bb573313a9e8 -r 5918b8d165d1 b | |
2100 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2100 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2101 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
2101 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
2102 | @@ -0,0 +1,1 @@ |
|
2102 | @@ -0,0 +1,1 @@ | |
2103 | +a |
|
2103 | +a | |
2104 | diff -r bb573313a9e8 -r 5918b8d165d1 d |
|
2104 | diff -r bb573313a9e8 -r 5918b8d165d1 d | |
2105 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2105 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2106 | +++ b/d Thu Jan 01 00:00:00 1970 +0000 |
|
2106 | +++ b/d Thu Jan 01 00:00:00 1970 +0000 | |
2107 | @@ -0,0 +1,1 @@ |
|
2107 | @@ -0,0 +1,1 @@ | |
2108 | +a |
|
2108 | +a | |
2109 | diff -r bb573313a9e8 -r 5918b8d165d1 g |
|
2109 | diff -r bb573313a9e8 -r 5918b8d165d1 g | |
2110 | --- a/g Thu Jan 01 00:00:00 1970 +0000 |
|
2110 | --- a/g Thu Jan 01 00:00:00 1970 +0000 | |
2111 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 |
|
2111 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 | |
2112 | @@ -1,2 +1,2 @@ |
|
2112 | @@ -1,2 +1,2 @@ | |
2113 | f |
|
2113 | f | |
2114 | -g |
|
2114 | -g | |
2115 | +f |
|
2115 | +f | |
2116 | # HG changeset patch |
|
2116 | # HG changeset patch | |
2117 | # User test |
|
2117 | # User test | |
2118 | # Date 0 0 |
|
2118 | # Date 0 0 | |
2119 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2119 | # Thu Jan 01 00:00:00 1970 +0000 | |
2120 | # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260 |
|
2120 | # Node ID 17d952250a9d03cc3dc77b199ab60e959b9b0260 | |
2121 | # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed |
|
2121 | # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed | |
2122 | mv dir/b e |
|
2122 | mv dir/b e | |
2123 |
|
2123 | |||
2124 | diff -r 5918b8d165d1 -r 17d952250a9d dir/b |
|
2124 | diff -r 5918b8d165d1 -r 17d952250a9d dir/b | |
2125 | --- a/dir/b Thu Jan 01 00:00:00 1970 +0000 |
|
2125 | --- a/dir/b Thu Jan 01 00:00:00 1970 +0000 | |
2126 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2126 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2127 | @@ -1,1 +0,0 @@ |
|
2127 | @@ -1,1 +0,0 @@ | |
2128 | -a |
|
2128 | -a | |
2129 | diff -r 5918b8d165d1 -r 17d952250a9d e |
|
2129 | diff -r 5918b8d165d1 -r 17d952250a9d e | |
2130 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2130 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2131 | +++ b/e Thu Jan 01 00:00:00 1970 +0000 |
|
2131 | +++ b/e Thu Jan 01 00:00:00 1970 +0000 | |
2132 | @@ -0,0 +1,1 @@ |
|
2132 | @@ -0,0 +1,1 @@ | |
2133 | +a |
|
2133 | +a | |
2134 | # HG changeset patch |
|
2134 | # HG changeset patch | |
2135 | # User test |
|
2135 | # User test | |
2136 | # Date 0 0 |
|
2136 | # Date 0 0 | |
2137 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2137 | # Thu Jan 01 00:00:00 1970 +0000 | |
2138 | # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b |
|
2138 | # Node ID 99b31f1c2782e2deb1723cef08930f70fc84b37b | |
2139 | # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed |
|
2139 | # Parent 5918b8d165d1364e78a66d02e66caa0133c5d1ed | |
2140 | add another e |
|
2140 | add another e | |
2141 |
|
2141 | |||
2142 | diff -r 5918b8d165d1 -r 99b31f1c2782 e |
|
2142 | diff -r 5918b8d165d1 -r 99b31f1c2782 e | |
2143 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2143 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2144 | +++ b/e Thu Jan 01 00:00:00 1970 +0000 |
|
2144 | +++ b/e Thu Jan 01 00:00:00 1970 +0000 | |
2145 | @@ -0,0 +1,1 @@ |
|
2145 | @@ -0,0 +1,1 @@ | |
2146 | +ee |
|
2146 | +ee | |
2147 | # HG changeset patch |
|
2147 | # HG changeset patch | |
2148 | # User test |
|
2148 | # User test | |
2149 | # Date 0 0 |
|
2149 | # Date 0 0 | |
2150 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2150 | # Thu Jan 01 00:00:00 1970 +0000 | |
2151 | # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73 |
|
2151 | # Node ID fc281d8ff18d999ad6497b3d27390bcd695dcc73 | |
2152 | # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b |
|
2152 | # Parent 99b31f1c2782e2deb1723cef08930f70fc84b37b | |
2153 | # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260 |
|
2153 | # Parent 17d952250a9d03cc3dc77b199ab60e959b9b0260 | |
2154 | merge 5 and 4 |
|
2154 | merge 5 and 4 | |
2155 |
|
2155 | |||
2156 | diff -r 99b31f1c2782 -r fc281d8ff18d dir/b |
|
2156 | diff -r 99b31f1c2782 -r fc281d8ff18d dir/b | |
2157 | --- a/dir/b Thu Jan 01 00:00:00 1970 +0000 |
|
2157 | --- a/dir/b Thu Jan 01 00:00:00 1970 +0000 | |
2158 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2158 | +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2159 | @@ -1,1 +0,0 @@ |
|
2159 | @@ -1,1 +0,0 @@ | |
2160 | -a |
|
2160 | -a | |
2161 | diff -r 99b31f1c2782 -r fc281d8ff18d e |
|
2161 | diff -r 99b31f1c2782 -r fc281d8ff18d e | |
2162 | --- a/e Thu Jan 01 00:00:00 1970 +0000 |
|
2162 | --- a/e Thu Jan 01 00:00:00 1970 +0000 | |
2163 | +++ b/e Thu Jan 01 00:00:00 1970 +0000 |
|
2163 | +++ b/e Thu Jan 01 00:00:00 1970 +0000 | |
2164 | @@ -1,1 +1,1 @@ |
|
2164 | @@ -1,1 +1,1 @@ | |
2165 | -ee |
|
2165 | -ee | |
2166 | +merge |
|
2166 | +merge | |
2167 | # HG changeset patch |
|
2167 | # HG changeset patch | |
2168 | # User test |
|
2168 | # User test | |
2169 | # Date 0 0 |
|
2169 | # Date 0 0 | |
2170 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2170 | # Thu Jan 01 00:00:00 1970 +0000 | |
2171 | # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd |
|
2171 | # Node ID 02dbb8e276b8ab7abfd07cab50c901647e75c2dd | |
2172 | # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73 |
|
2172 | # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73 | |
2173 | Added tag foo-bar for changeset fc281d8ff18d |
|
2173 | Added tag foo-bar for changeset fc281d8ff18d | |
2174 |
|
2174 | |||
2175 | diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags |
|
2175 | diff -r fc281d8ff18d -r 02dbb8e276b8 .hgtags | |
2176 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
2176 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
2177 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
2177 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |
2178 | @@ -0,0 +1,1 @@ |
|
2178 | @@ -0,0 +1,1 @@ | |
2179 | +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar |
|
2179 | +fc281d8ff18d999ad6497b3d27390bcd695dcc73 foo-bar | |
2180 | # HG changeset patch |
|
2180 | # HG changeset patch | |
2181 | # User test |
|
2181 | # User test | |
2182 | # Date 0 0 |
|
2182 | # Date 0 0 | |
2183 | # Thu Jan 01 00:00:00 1970 +0000 |
|
2183 | # Thu Jan 01 00:00:00 1970 +0000 | |
2184 | # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449 |
|
2184 | # Node ID 24c2e826ddebf80f9dcd60b856bdb8e6715c5449 | |
2185 | # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73 |
|
2185 | # Parent fc281d8ff18d999ad6497b3d27390bcd695dcc73 | |
2186 | add g |
|
2186 | add g | |
2187 |
|
2187 | |||
2188 | diff -r fc281d8ff18d -r 24c2e826ddeb g |
|
2188 | diff -r fc281d8ff18d -r 24c2e826ddeb g | |
2189 | --- a/g Thu Jan 01 00:00:00 1970 +0000 |
|
2189 | --- a/g Thu Jan 01 00:00:00 1970 +0000 | |
2190 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 |
|
2190 | +++ b/g Thu Jan 01 00:00:00 1970 +0000 | |
2191 | @@ -1,2 +1,1 @@ |
|
2191 | @@ -1,2 +1,1 @@ | |
2192 | -f |
|
2192 | -f | |
2193 | -f |
|
2193 | -f | |
2194 | +g |
|
2194 | +g | |
2195 | $ testlog --follow -r6 -r8 -r5 -r7 -r4 |
|
2195 | $ testlog --follow -r6 -r8 -r5 -r7 -r4 | |
2196 | ['6', '8', '5', '7', '4'] |
|
2196 | ['6', '8', '5', '7', '4'] | |
2197 | (group |
|
2197 | (group | |
2198 | (func |
|
2198 | (func | |
2199 | ('symbol', 'descendants') |
|
2199 | ('symbol', 'descendants') | |
2200 | (func |
|
2200 | (func | |
2201 | ('symbol', 'rev') |
|
2201 | ('symbol', 'rev') | |
2202 | ('symbol', '6')))) |
|
2202 | ('symbol', '6')))) | |
2203 |
|
2203 | |||
2204 | Test --follow-first and forward --rev |
|
2204 | Test --follow-first and forward --rev | |
2205 |
|
2205 | |||
2206 | $ testlog --follow-first -r6 -r8 -r5 -r7 -r4 |
|
2206 | $ testlog --follow-first -r6 -r8 -r5 -r7 -r4 | |
2207 | ['6', '8', '5', '7', '4'] |
|
2207 | ['6', '8', '5', '7', '4'] | |
2208 | (group |
|
2208 | (group | |
2209 | (func |
|
2209 | (func | |
2210 | ('symbol', '_firstdescendants') |
|
2210 | ('symbol', '_firstdescendants') | |
2211 | (func |
|
2211 | (func | |
2212 | ('symbol', 'rev') |
|
2212 | ('symbol', 'rev') | |
2213 | ('symbol', '6')))) |
|
2213 | ('symbol', '6')))) | |
2214 | --- log.nodes * (glob) |
|
2214 | --- log.nodes * (glob) | |
2215 | +++ glog.nodes * (glob) |
|
2215 | +++ glog.nodes * (glob) | |
2216 | @@ -1,3 +1,3 @@ |
|
2216 | @@ -1,3 +1,3 @@ | |
2217 | -nodetag 6 |
|
2217 | -nodetag 6 | |
2218 | nodetag 8 |
|
2218 | nodetag 8 | |
2219 | nodetag 7 |
|
2219 | nodetag 7 | |
2220 | +nodetag 6 |
|
2220 | +nodetag 6 | |
2221 |
|
2221 | |||
2222 | Test --follow and backward --rev |
|
2222 | Test --follow and backward --rev | |
2223 |
|
2223 | |||
2224 | $ testlog --follow -r6 -r5 -r7 -r8 -r4 |
|
2224 | $ testlog --follow -r6 -r5 -r7 -r8 -r4 | |
2225 | ['6', '5', '7', '8', '4'] |
|
2225 | ['6', '5', '7', '8', '4'] | |
2226 | (group |
|
2226 | (group | |
2227 | (func |
|
2227 | (func | |
2228 | ('symbol', 'ancestors') |
|
2228 | ('symbol', 'ancestors') | |
2229 | (func |
|
2229 | (func | |
2230 | ('symbol', 'rev') |
|
2230 | ('symbol', 'rev') | |
2231 | ('symbol', '6')))) |
|
2231 | ('symbol', '6')))) | |
2232 |
|
2232 | |||
2233 | Test --follow-first and backward --rev |
|
2233 | Test --follow-first and backward --rev | |
2234 |
|
2234 | |||
2235 | $ testlog --follow-first -r6 -r5 -r7 -r8 -r4 |
|
2235 | $ testlog --follow-first -r6 -r5 -r7 -r8 -r4 | |
2236 | ['6', '5', '7', '8', '4'] |
|
2236 | ['6', '5', '7', '8', '4'] | |
2237 | (group |
|
2237 | (group | |
2238 | (func |
|
2238 | (func | |
2239 | ('symbol', '_firstancestors') |
|
2239 | ('symbol', '_firstancestors') | |
2240 | (func |
|
2240 | (func | |
2241 | ('symbol', 'rev') |
|
2241 | ('symbol', 'rev') | |
2242 | ('symbol', '6')))) |
|
2242 | ('symbol', '6')))) | |
2243 |
|
2243 | |||
2244 | Test --follow with --rev of graphlog extension |
|
2244 | Test --follow with --rev of graphlog extension | |
2245 |
|
2245 | |||
2246 | $ hg --config extensions.graphlog= glog -qfr1 |
|
2246 | $ hg --config extensions.graphlog= glog -qfr1 | |
2247 | o 1:216d4c92cf98 |
|
2247 | o 1:216d4c92cf98 | |
2248 | | |
|
2248 | | | |
2249 | o 0:f8035bb17114 |
|
2249 | o 0:f8035bb17114 | |
2250 |
|
2250 | |||
2251 |
|
2251 | |||
2252 | Test subdir |
|
2252 | Test subdir | |
2253 |
|
2253 | |||
2254 | $ hg up -q 3 |
|
2254 | $ hg up -q 3 | |
2255 | $ cd dir |
|
2255 | $ cd dir | |
2256 | $ testlog . |
|
2256 | $ testlog . | |
2257 | [] |
|
2257 | [] | |
2258 | (group |
|
2258 | (group | |
2259 | (func |
|
2259 | (func | |
2260 | ('symbol', '_matchfiles') |
|
2260 | ('symbol', '_matchfiles') | |
2261 | (list |
|
2261 | (list | |
2262 | ('string', 'r:') |
|
2262 | ('string', 'r:') | |
2263 | ('string', 'd:relpath') |
|
2263 | ('string', 'd:relpath') | |
2264 | ('string', 'p:.')))) |
|
2264 | ('string', 'p:.')))) | |
2265 | $ testlog ../b |
|
2265 | $ testlog ../b | |
2266 | [] |
|
2266 | [] | |
2267 | (group |
|
2267 | (group | |
2268 | (group |
|
2268 | (group | |
2269 | (func |
|
2269 | (func | |
2270 | ('symbol', 'filelog') |
|
2270 | ('symbol', 'filelog') | |
2271 | ('string', '../b')))) |
|
2271 | ('string', '../b')))) | |
2272 | $ testlog -f ../b |
|
2272 | $ testlog -f ../b | |
2273 | [] |
|
2273 | [] | |
2274 | (group |
|
2274 | (group | |
2275 | (group |
|
2275 | (group | |
2276 | (func |
|
2276 | (func | |
2277 | ('symbol', 'follow') |
|
2277 | ('symbol', 'follow') | |
2278 | ('string', 'b')))) |
|
2278 | ('string', 'b')))) | |
2279 | $ cd .. |
|
2279 | $ cd .. | |
2280 |
|
2280 | |||
2281 | Test --hidden |
|
2281 | Test --hidden | |
2282 | (enable obsolete) |
|
2282 | (enable obsolete) | |
2283 |
|
2283 | |||
2284 | $ cat >> $HGRCPATH << EOF |
|
2284 | $ cat >> $HGRCPATH << EOF | |
2285 | > [experimental] |
|
2285 | > [experimental] | |
2286 | > evolution=createmarkers |
|
2286 | > evolution=createmarkers | |
2287 | > EOF |
|
2287 | > EOF | |
2288 |
|
2288 | |||
2289 | $ hg debugobsolete `hg id --debug -i -r 8` |
|
2289 | $ hg debugobsolete `hg id --debug -i -r 8` | |
2290 | $ testlog |
|
2290 | $ testlog | |
2291 | [] |
|
2291 | [] | |
2292 | [] |
|
2292 | [] | |
2293 | $ testlog --hidden |
|
2293 | $ testlog --hidden | |
2294 | [] |
|
2294 | [] | |
2295 | [] |
|
2295 | [] | |
2296 | $ hg log -G --template '{rev} {desc}\n' |
|
2296 | $ hg log -G --template '{rev} {desc}\n' | |
2297 | o 7 Added tag foo-bar for changeset fc281d8ff18d |
|
2297 | o 7 Added tag foo-bar for changeset fc281d8ff18d | |
2298 | | |
|
2298 | | | |
2299 | o 6 merge 5 and 4 |
|
2299 | o 6 merge 5 and 4 | |
2300 | |\ |
|
2300 | |\ | |
2301 | | o 5 add another e |
|
2301 | | o 5 add another e | |
2302 | | | |
|
2302 | | | | |
2303 | o | 4 mv dir/b e |
|
2303 | o | 4 mv dir/b e | |
2304 | |/ |
|
2304 | |/ | |
2305 | @ 3 mv a b; add d |
|
2305 | @ 3 mv a b; add d | |
2306 | | |
|
2306 | | | |
2307 | o 2 mv b dir/b |
|
2307 | o 2 mv b dir/b | |
2308 | | |
|
2308 | | | |
2309 | o 1 copy a b |
|
2309 | o 1 copy a b | |
2310 | | |
|
2310 | | | |
2311 | o 0 add a |
|
2311 | o 0 add a | |
2312 |
|
2312 | |||
2313 |
|
2313 | |||
2314 | A template without trailing newline should do something sane |
|
2314 | A template without trailing newline should do something sane | |
2315 |
|
2315 | |||
2316 | $ hg log -G -r ::2 --template '{rev} {desc}' |
|
2316 | $ hg log -G -r ::2 --template '{rev} {desc}' | |
2317 | o 2 mv b dir/b |
|
2317 | o 2 mv b dir/b | |
2318 | | |
|
2318 | | | |
2319 | o 1 copy a b |
|
2319 | o 1 copy a b | |
2320 | | |
|
2320 | | | |
2321 | o 0 add a |
|
2321 | o 0 add a | |
2322 |
|
2322 | |||
2323 |
|
2323 | |||
2324 | Extra newlines must be preserved |
|
2324 | Extra newlines must be preserved | |
2325 |
|
2325 | |||
2326 | $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n' |
|
2326 | $ hg log -G -r ::2 --template '\n{rev} {desc}\n\n' | |
2327 | o |
|
2327 | o | |
2328 | | 2 mv b dir/b |
|
2328 | | 2 mv b dir/b | |
2329 | | |
|
2329 | | | |
2330 | o |
|
2330 | o | |
2331 | | 1 copy a b |
|
2331 | | 1 copy a b | |
2332 | | |
|
2332 | | | |
2333 | o |
|
2333 | o | |
2334 | 0 add a |
|
2334 | 0 add a | |
2335 |
|
2335 | |||
2336 |
|
2336 | |||
2337 | The almost-empty template should do something sane too ... |
|
2337 | The almost-empty template should do something sane too ... | |
2338 |
|
2338 | |||
2339 | $ hg log -G -r ::2 --template '\n' |
|
2339 | $ hg log -G -r ::2 --template '\n' | |
2340 | o |
|
2340 | o | |
2341 | | |
|
2341 | | | |
2342 | o |
|
2342 | o | |
2343 | | |
|
2343 | | | |
2344 | o |
|
2344 | o | |
2345 |
|
2345 | |||
2346 |
|
2346 | |||
2347 | issue3772 |
|
2347 | issue3772 | |
2348 |
|
2348 | |||
2349 | $ hg log -G -r :null |
|
2349 | $ hg log -G -r :null | |
2350 | o changeset: 0:f8035bb17114 |
|
2350 | o changeset: 0:f8035bb17114 | |
2351 | | user: test |
|
2351 | | user: test | |
2352 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2352 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
2353 | | summary: add a |
|
2353 | | summary: add a | |
2354 | | |
|
2354 | | | |
2355 | o changeset: -1:000000000000 |
|
2355 | o changeset: -1:000000000000 | |
2356 | user: |
|
2356 | user: | |
2357 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2357 | date: Thu Jan 01 00:00:00 1970 +0000 | |
2358 |
|
2358 | |||
2359 | $ hg log -G -r null:null |
|
2359 | $ hg log -G -r null:null | |
2360 | o changeset: -1:000000000000 |
|
2360 | o changeset: -1:000000000000 | |
2361 | user: |
|
2361 | user: | |
2362 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2362 | date: Thu Jan 01 00:00:00 1970 +0000 | |
2363 |
|
2363 | |||
2364 |
|
2364 | |||
2365 | should not draw line down to null due to the magic of fullreposet |
|
2365 | should not draw line down to null due to the magic of fullreposet | |
2366 |
|
2366 | |||
2367 | $ hg log -G -r 'all()' | tail -6 |
|
2367 | $ hg log -G -r 'all()' | tail -6 | |
2368 | | |
|
2368 | | | |
2369 | o changeset: 0:f8035bb17114 |
|
2369 | o changeset: 0:f8035bb17114 | |
2370 | user: test |
|
2370 | user: test | |
2371 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2371 | date: Thu Jan 01 00:00:00 1970 +0000 | |
2372 | summary: add a |
|
2372 | summary: add a | |
2373 |
|
2373 | |||
2374 |
|
2374 | |||
2375 | $ hg log -G -r 'branch(default)' | tail -6 |
|
2375 | $ hg log -G -r 'branch(default)' | tail -6 | |
2376 | | |
|
2376 | | | |
2377 | o changeset: 0:f8035bb17114 |
|
2377 | o changeset: 0:f8035bb17114 | |
2378 | user: test |
|
2378 | user: test | |
2379 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
2379 | date: Thu Jan 01 00:00:00 1970 +0000 | |
2380 | summary: add a |
|
2380 | summary: add a | |
2381 |
|
2381 | |||
2382 |
|
2382 | |||
2383 | working-directory revision |
|
2383 | working-directory revision | |
2384 |
|
2384 | |||
2385 | $ hg log -G -qr '. + wdir()' |
|
2385 | $ hg log -G -qr '. + wdir()' | |
2386 | o 2147483647:ffffffffffff |
|
2386 | o 2147483647:ffffffffffff | |
2387 | | |
|
2387 | | | |
2388 | @ 3:5918b8d165d1 |
|
2388 | @ 3:5918b8d165d1 | |
2389 | | |
|
2389 | | | |
2390 | ~ |
|
2390 | ~ | |
2391 |
|
2391 | |||
2392 | node template with changeset_printer: |
|
2392 | node template with changeset_printer: | |
2393 |
|
2393 | |||
2394 | $ hg log -Gqr 5:7 --config ui.graphnodetemplate='{rev}' |
|
2394 | $ hg log -Gqr 5:7 --config ui.graphnodetemplate='{rev}' | |
2395 | 7 7:02dbb8e276b8 |
|
2395 | 7 7:02dbb8e276b8 | |
2396 | | |
|
2396 | | | |
2397 | 6 6:fc281d8ff18d |
|
2397 | 6 6:fc281d8ff18d | |
2398 | |\ |
|
2398 | |\ | |
2399 | | ~ |
|
2399 | | ~ | |
2400 | 5 5:99b31f1c2782 |
|
2400 | 5 5:99b31f1c2782 | |
2401 | | |
|
2401 | | | |
2402 | ~ |
|
2402 | ~ | |
2403 |
|
2403 | |||
2404 | node template with changeset_templater (shared cache variable): |
|
2404 | node template with changeset_templater (shared cache variable): | |
2405 |
|
2405 | |||
2406 | $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \ |
|
2406 | $ hg log -Gr 5:7 -T '{latesttag % "{rev} {tag}+{distance}"}\n' \ | |
2407 | > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}' |
|
2407 | > --config ui.graphnodetemplate='{ifeq(latesttagdistance, 0, "#", graphnode)}' | |
2408 | o 7 foo-bar+1 |
|
2408 | o 7 foo-bar+1 | |
2409 | | |
|
2409 | | | |
2410 | # 6 foo-bar+0 |
|
2410 | # 6 foo-bar+0 | |
2411 | |\ |
|
2411 | |\ | |
2412 | | ~ |
|
2412 | | ~ | |
2413 | o 5 null+5 |
|
2413 | o 5 null+5 | |
2414 | | |
|
2414 | | | |
2415 | ~ |
|
2415 | ~ | |
2416 |
|
2416 | |||
2417 | label() should just work in node template: |
|
2417 | label() should just work in node template: | |
2418 |
|
2418 | |||
2419 | $ hg log -Gqr 7 --config extensions.color= --color=debug \ |
|
2419 | $ hg log -Gqr 7 --config extensions.color= --color=debug \ | |
2420 | > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}' |
|
2420 | > --config ui.graphnodetemplate='{label("branch.{branch}", rev)}' | |
2421 | [branch.default|7] [log.node|7:02dbb8e276b8] |
|
2421 | [branch.default|7] [log.node|7:02dbb8e276b8] | |
2422 | | |
|
2422 | | | |
2423 | ~ |
|
2423 | ~ | |
2424 |
|
2424 | |||
2425 | $ cd .. |
|
2425 | $ cd .. | |
2426 |
|
2426 | |||
2427 | change graph edge styling |
|
2427 | change graph edge styling | |
2428 |
|
2428 | |||
2429 | $ cd repo |
|
2429 | $ cd repo | |
2430 | $ cat << EOF >> $HGRCPATH |
|
2430 | $ cat << EOF >> $HGRCPATH | |
2431 | > [experimental] |
|
2431 | > [experimental] | |
2432 | > graphstyle.parent = | |
|
2432 | > graphstyle.parent = | | |
2433 | > graphstyle.grandparent = : |
|
2433 | > graphstyle.grandparent = : | |
2434 | > graphstyle.missing = |
|
2434 | > graphstyle.missing = | |
2435 | > EOF |
|
2435 | > EOF | |
2436 | $ hg log -G -r 'file("a")' -m |
|
2436 | $ hg log -G -r 'file("a")' -m | |
2437 | @ changeset: 36:08a19a744424 |
|
2437 | @ changeset: 36:08a19a744424 | |
2438 | : branch: branch |
|
2438 | : branch: branch | |
2439 | : tag: tip |
|
2439 | : tag: tip | |
2440 | : parent: 35:9159c3644c5e |
|
2440 | : parent: 35:9159c3644c5e | |
2441 | : parent: 35:9159c3644c5e |
|
2441 | : parent: 35:9159c3644c5e | |
2442 | : user: test |
|
2442 | : user: test | |
2443 | : date: Thu Jan 01 00:00:36 1970 +0000 |
|
2443 | : date: Thu Jan 01 00:00:36 1970 +0000 | |
2444 | : summary: (36) buggy merge: identical parents |
|
2444 | : summary: (36) buggy merge: identical parents | |
2445 | : |
|
2445 | : | |
2446 | o changeset: 32:d06dffa21a31 |
|
2446 | o changeset: 32:d06dffa21a31 | |
2447 | |\ parent: 27:886ed638191b |
|
2447 | |\ parent: 27:886ed638191b | |
2448 | | : parent: 31:621d83e11f67 |
|
2448 | | : parent: 31:621d83e11f67 | |
2449 | | : user: test |
|
2449 | | : user: test | |
2450 | | : date: Thu Jan 01 00:00:32 1970 +0000 |
|
2450 | | : date: Thu Jan 01 00:00:32 1970 +0000 | |
2451 | | : summary: (32) expand |
|
2451 | | : summary: (32) expand | |
2452 | | : |
|
2452 | | : | |
2453 | o : changeset: 31:621d83e11f67 |
|
2453 | o : changeset: 31:621d83e11f67 | |
2454 | |\: parent: 21:d42a756af44d |
|
2454 | |\: parent: 21:d42a756af44d | |
2455 | | : parent: 30:6e11cd4b648f |
|
2455 | | : parent: 30:6e11cd4b648f | |
2456 | | : user: test |
|
2456 | | : user: test | |
2457 | | : date: Thu Jan 01 00:00:31 1970 +0000 |
|
2457 | | : date: Thu Jan 01 00:00:31 1970 +0000 | |
2458 | | : summary: (31) expand |
|
2458 | | : summary: (31) expand | |
2459 | | : |
|
2459 | | : | |
2460 | o : changeset: 30:6e11cd4b648f |
|
2460 | o : changeset: 30:6e11cd4b648f | |
2461 | |\ \ parent: 28:44ecd0b9ae99 |
|
2461 | |\ \ parent: 28:44ecd0b9ae99 | |
2462 | | ~ : parent: 29:cd9bb2be7593 |
|
2462 | | ~ : parent: 29:cd9bb2be7593 | |
2463 | | : user: test |
|
2463 | | : user: test | |
2464 | | : date: Thu Jan 01 00:00:30 1970 +0000 |
|
2464 | | : date: Thu Jan 01 00:00:30 1970 +0000 | |
2465 | | : summary: (30) expand |
|
2465 | | : summary: (30) expand | |
2466 | | / |
|
2466 | | / | |
2467 | o : changeset: 28:44ecd0b9ae99 |
|
2467 | o : changeset: 28:44ecd0b9ae99 | |
2468 | |\ \ parent: 1:6db2ef61d156 |
|
2468 | |\ \ parent: 1:6db2ef61d156 | |
2469 | | ~ : parent: 26:7f25b6c2f0b9 |
|
2469 | | ~ : parent: 26:7f25b6c2f0b9 | |
2470 | | : user: test |
|
2470 | | : user: test | |
2471 | | : date: Thu Jan 01 00:00:28 1970 +0000 |
|
2471 | | : date: Thu Jan 01 00:00:28 1970 +0000 | |
2472 | | : summary: (28) merge zero known |
|
2472 | | : summary: (28) merge zero known | |
2473 | | / |
|
2473 | | / | |
2474 | o : changeset: 26:7f25b6c2f0b9 |
|
2474 | o : changeset: 26:7f25b6c2f0b9 | |
2475 | |\ \ parent: 18:1aa84d96232a |
|
2475 | |\ \ parent: 18:1aa84d96232a | |
2476 | | | : parent: 25:91da8ed57247 |
|
2476 | | | : parent: 25:91da8ed57247 | |
2477 | | | : user: test |
|
2477 | | | : user: test | |
2478 | | | : date: Thu Jan 01 00:00:26 1970 +0000 |
|
2478 | | | : date: Thu Jan 01 00:00:26 1970 +0000 | |
2479 | | | : summary: (26) merge one known; far right |
|
2479 | | | : summary: (26) merge one known; far right | |
2480 | | | : |
|
2480 | | | : | |
2481 | | o : changeset: 25:91da8ed57247 |
|
2481 | | o : changeset: 25:91da8ed57247 | |
2482 | | |\: parent: 21:d42a756af44d |
|
2482 | | |\: parent: 21:d42a756af44d | |
2483 | | | : parent: 24:a9c19a3d96b7 |
|
2483 | | | : parent: 24:a9c19a3d96b7 | |
2484 | | | : user: test |
|
2484 | | | : user: test | |
2485 | | | : date: Thu Jan 01 00:00:25 1970 +0000 |
|
2485 | | | : date: Thu Jan 01 00:00:25 1970 +0000 | |
2486 | | | : summary: (25) merge one known; far left |
|
2486 | | | : summary: (25) merge one known; far left | |
2487 | | | : |
|
2487 | | | : | |
2488 | | o : changeset: 24:a9c19a3d96b7 |
|
2488 | | o : changeset: 24:a9c19a3d96b7 | |
2489 | | |\ \ parent: 0:e6eb3150255d |
|
2489 | | |\ \ parent: 0:e6eb3150255d | |
2490 | | | ~ : parent: 23:a01cddf0766d |
|
2490 | | | ~ : parent: 23:a01cddf0766d | |
2491 | | | : user: test |
|
2491 | | | : user: test | |
2492 | | | : date: Thu Jan 01 00:00:24 1970 +0000 |
|
2492 | | | : date: Thu Jan 01 00:00:24 1970 +0000 | |
2493 | | | : summary: (24) merge one known; immediate right |
|
2493 | | | : summary: (24) merge one known; immediate right | |
2494 | | | / |
|
2494 | | | / | |
2495 | | o : changeset: 23:a01cddf0766d |
|
2495 | | o : changeset: 23:a01cddf0766d | |
2496 | | |\ \ parent: 1:6db2ef61d156 |
|
2496 | | |\ \ parent: 1:6db2ef61d156 | |
2497 | | | ~ : parent: 22:e0d9cccacb5d |
|
2497 | | | ~ : parent: 22:e0d9cccacb5d | |
2498 | | | : user: test |
|
2498 | | | : user: test | |
2499 | | | : date: Thu Jan 01 00:00:23 1970 +0000 |
|
2499 | | | : date: Thu Jan 01 00:00:23 1970 +0000 | |
2500 | | | : summary: (23) merge one known; immediate left |
|
2500 | | | : summary: (23) merge one known; immediate left | |
2501 | | | / |
|
2501 | | | / | |
2502 | | o : changeset: 22:e0d9cccacb5d |
|
2502 | | o : changeset: 22:e0d9cccacb5d | |
2503 | |/:/ parent: 18:1aa84d96232a |
|
2503 | |/:/ parent: 18:1aa84d96232a | |
2504 | | : parent: 21:d42a756af44d |
|
2504 | | : parent: 21:d42a756af44d | |
2505 | | : user: test |
|
2505 | | : user: test | |
2506 | | : date: Thu Jan 01 00:00:22 1970 +0000 |
|
2506 | | : date: Thu Jan 01 00:00:22 1970 +0000 | |
2507 | | : summary: (22) merge two known; one far left, one far right |
|
2507 | | : summary: (22) merge two known; one far left, one far right | |
2508 | | : |
|
2508 | | : | |
2509 | | o changeset: 21:d42a756af44d |
|
2509 | | o changeset: 21:d42a756af44d | |
2510 | | |\ parent: 19:31ddc2c1573b |
|
2510 | | |\ parent: 19:31ddc2c1573b | |
2511 | | | | parent: 20:d30ed6450e32 |
|
2511 | | | | parent: 20:d30ed6450e32 | |
2512 | | | | user: test |
|
2512 | | | | user: test | |
2513 | | | | date: Thu Jan 01 00:00:21 1970 +0000 |
|
2513 | | | | date: Thu Jan 01 00:00:21 1970 +0000 | |
2514 | | | | summary: (21) expand |
|
2514 | | | | summary: (21) expand | |
2515 | | | | |
|
2515 | | | | | |
2516 | +---o changeset: 20:d30ed6450e32 |
|
2516 | +---o changeset: 20:d30ed6450e32 | |
2517 | | | | parent: 0:e6eb3150255d |
|
2517 | | | | parent: 0:e6eb3150255d | |
2518 | | | ~ parent: 18:1aa84d96232a |
|
2518 | | | ~ parent: 18:1aa84d96232a | |
2519 | | | user: test |
|
2519 | | | user: test | |
2520 | | | date: Thu Jan 01 00:00:20 1970 +0000 |
|
2520 | | | date: Thu Jan 01 00:00:20 1970 +0000 | |
2521 | | | summary: (20) merge two known; two far right |
|
2521 | | | summary: (20) merge two known; two far right | |
2522 | | | |
|
2522 | | | | |
2523 | | o changeset: 19:31ddc2c1573b |
|
2523 | | o changeset: 19:31ddc2c1573b | |
2524 | | |\ parent: 15:1dda3f72782d |
|
2524 | | |\ parent: 15:1dda3f72782d | |
2525 | | | | parent: 17:44765d7c06e0 |
|
2525 | | | | parent: 17:44765d7c06e0 | |
2526 | | | | user: test |
|
2526 | | | | user: test | |
2527 | | | | date: Thu Jan 01 00:00:19 1970 +0000 |
|
2527 | | | | date: Thu Jan 01 00:00:19 1970 +0000 | |
2528 | | | | summary: (19) expand |
|
2528 | | | | summary: (19) expand | |
2529 | | | | |
|
2529 | | | | | |
2530 | o | | changeset: 18:1aa84d96232a |
|
2530 | o | | changeset: 18:1aa84d96232a | |
2531 | |\| | parent: 1:6db2ef61d156 |
|
2531 | |\| | parent: 1:6db2ef61d156 | |
2532 | ~ | | parent: 15:1dda3f72782d |
|
2532 | ~ | | parent: 15:1dda3f72782d | |
2533 | | | user: test |
|
2533 | | | user: test | |
2534 | | | date: Thu Jan 01 00:00:18 1970 +0000 |
|
2534 | | | date: Thu Jan 01 00:00:18 1970 +0000 | |
2535 | | | summary: (18) merge two known; two far left |
|
2535 | | | summary: (18) merge two known; two far left | |
2536 | / / |
|
2536 | / / | |
2537 | | o changeset: 17:44765d7c06e0 |
|
2537 | | o changeset: 17:44765d7c06e0 | |
2538 | | |\ parent: 12:86b91144a6e9 |
|
2538 | | |\ parent: 12:86b91144a6e9 | |
2539 | | | | parent: 16:3677d192927d |
|
2539 | | | | parent: 16:3677d192927d | |
2540 | | | | user: test |
|
2540 | | | | user: test | |
2541 | | | | date: Thu Jan 01 00:00:17 1970 +0000 |
|
2541 | | | | date: Thu Jan 01 00:00:17 1970 +0000 | |
2542 | | | | summary: (17) expand |
|
2542 | | | | summary: (17) expand | |
2543 | | | | |
|
2543 | | | | | |
2544 | | | o changeset: 16:3677d192927d |
|
2544 | | | o changeset: 16:3677d192927d | |
2545 | | | |\ parent: 0:e6eb3150255d |
|
2545 | | | |\ parent: 0:e6eb3150255d | |
2546 | | | ~ ~ parent: 1:6db2ef61d156 |
|
2546 | | | ~ ~ parent: 1:6db2ef61d156 | |
2547 | | | user: test |
|
2547 | | | user: test | |
2548 | | | date: Thu Jan 01 00:00:16 1970 +0000 |
|
2548 | | | date: Thu Jan 01 00:00:16 1970 +0000 | |
2549 | | | summary: (16) merge two known; one immediate right, one near right |
|
2549 | | | summary: (16) merge two known; one immediate right, one near right | |
2550 | | | |
|
2550 | | | | |
2551 | o | changeset: 15:1dda3f72782d |
|
2551 | o | changeset: 15:1dda3f72782d | |
2552 | |\ \ parent: 13:22d8966a97e3 |
|
2552 | |\ \ parent: 13:22d8966a97e3 | |
2553 | | | | parent: 14:8eac370358ef |
|
2553 | | | | parent: 14:8eac370358ef | |
2554 | | | | user: test |
|
2554 | | | | user: test | |
2555 | | | | date: Thu Jan 01 00:00:15 1970 +0000 |
|
2555 | | | | date: Thu Jan 01 00:00:15 1970 +0000 | |
2556 | | | | summary: (15) expand |
|
2556 | | | | summary: (15) expand | |
2557 | | | | |
|
2557 | | | | | |
2558 | | o | changeset: 14:8eac370358ef |
|
2558 | | o | changeset: 14:8eac370358ef | |
2559 | | |\| parent: 0:e6eb3150255d |
|
2559 | | |\| parent: 0:e6eb3150255d | |
2560 | | ~ | parent: 12:86b91144a6e9 |
|
2560 | | ~ | parent: 12:86b91144a6e9 | |
2561 | | | user: test |
|
2561 | | | user: test | |
2562 | | | date: Thu Jan 01 00:00:14 1970 +0000 |
|
2562 | | | date: Thu Jan 01 00:00:14 1970 +0000 | |
2563 | | | summary: (14) merge two known; one immediate right, one far right |
|
2563 | | | summary: (14) merge two known; one immediate right, one far right | |
2564 | | / |
|
2564 | | / | |
2565 | o | changeset: 13:22d8966a97e3 |
|
2565 | o | changeset: 13:22d8966a97e3 | |
2566 | |\ \ parent: 9:7010c0af0a35 |
|
2566 | |\ \ parent: 9:7010c0af0a35 | |
2567 | | | | parent: 11:832d76e6bdf2 |
|
2567 | | | | parent: 11:832d76e6bdf2 | |
2568 | | | | user: test |
|
2568 | | | | user: test | |
2569 | | | | date: Thu Jan 01 00:00:13 1970 +0000 |
|
2569 | | | | date: Thu Jan 01 00:00:13 1970 +0000 | |
2570 | | | | summary: (13) expand |
|
2570 | | | | summary: (13) expand | |
2571 | | | | |
|
2571 | | | | | |
2572 | +---o changeset: 12:86b91144a6e9 |
|
2572 | +---o changeset: 12:86b91144a6e9 | |
2573 | | | | parent: 1:6db2ef61d156 |
|
2573 | | | | parent: 1:6db2ef61d156 | |
2574 | | | ~ parent: 9:7010c0af0a35 |
|
2574 | | | ~ parent: 9:7010c0af0a35 | |
2575 | | | user: test |
|
2575 | | | user: test | |
2576 | | | date: Thu Jan 01 00:00:12 1970 +0000 |
|
2576 | | | date: Thu Jan 01 00:00:12 1970 +0000 | |
2577 | | | summary: (12) merge two known; one immediate right, one far left |
|
2577 | | | summary: (12) merge two known; one immediate right, one far left | |
2578 | | | |
|
2578 | | | | |
2579 | | o changeset: 11:832d76e6bdf2 |
|
2579 | | o changeset: 11:832d76e6bdf2 | |
2580 | | |\ parent: 6:b105a072e251 |
|
2580 | | |\ parent: 6:b105a072e251 | |
2581 | | | | parent: 10:74c64d036d72 |
|
2581 | | | | parent: 10:74c64d036d72 | |
2582 | | | | user: test |
|
2582 | | | | user: test | |
2583 | | | | date: Thu Jan 01 00:00:11 1970 +0000 |
|
2583 | | | | date: Thu Jan 01 00:00:11 1970 +0000 | |
2584 | | | | summary: (11) expand |
|
2584 | | | | summary: (11) expand | |
2585 | | | | |
|
2585 | | | | | |
2586 | | | o changeset: 10:74c64d036d72 |
|
2586 | | | o changeset: 10:74c64d036d72 | |
2587 | | |/| parent: 0:e6eb3150255d |
|
2587 | | |/| parent: 0:e6eb3150255d | |
2588 | | | ~ parent: 6:b105a072e251 |
|
2588 | | | ~ parent: 6:b105a072e251 | |
2589 | | | user: test |
|
2589 | | | user: test | |
2590 | | | date: Thu Jan 01 00:00:10 1970 +0000 |
|
2590 | | | date: Thu Jan 01 00:00:10 1970 +0000 | |
2591 | | | summary: (10) merge two known; one immediate left, one near right |
|
2591 | | | summary: (10) merge two known; one immediate left, one near right | |
2592 | | | |
|
2592 | | | | |
2593 | o | changeset: 9:7010c0af0a35 |
|
2593 | o | changeset: 9:7010c0af0a35 | |
2594 | |\ \ parent: 7:b632bb1b1224 |
|
2594 | |\ \ parent: 7:b632bb1b1224 | |
2595 | | | | parent: 8:7a0b11f71937 |
|
2595 | | | | parent: 8:7a0b11f71937 | |
2596 | | | | user: test |
|
2596 | | | | user: test | |
2597 | | | | date: Thu Jan 01 00:00:09 1970 +0000 |
|
2597 | | | | date: Thu Jan 01 00:00:09 1970 +0000 | |
2598 | | | | summary: (9) expand |
|
2598 | | | | summary: (9) expand | |
2599 | | | | |
|
2599 | | | | | |
2600 | | o | changeset: 8:7a0b11f71937 |
|
2600 | | o | changeset: 8:7a0b11f71937 | |
2601 | |/| | parent: 0:e6eb3150255d |
|
2601 | |/| | parent: 0:e6eb3150255d | |
2602 | | ~ | parent: 7:b632bb1b1224 |
|
2602 | | ~ | parent: 7:b632bb1b1224 | |
2603 | | | user: test |
|
2603 | | | user: test | |
2604 | | | date: Thu Jan 01 00:00:08 1970 +0000 |
|
2604 | | | date: Thu Jan 01 00:00:08 1970 +0000 | |
2605 | | | summary: (8) merge two known; one immediate left, one far right |
|
2605 | | | summary: (8) merge two known; one immediate left, one far right | |
2606 | | / |
|
2606 | | / | |
2607 | o | changeset: 7:b632bb1b1224 |
|
2607 | o | changeset: 7:b632bb1b1224 | |
2608 | |\ \ parent: 2:3d9a33b8d1e1 |
|
2608 | |\ \ parent: 2:3d9a33b8d1e1 | |
2609 | | ~ | parent: 5:4409d547b708 |
|
2609 | | ~ | parent: 5:4409d547b708 | |
2610 | | | user: test |
|
2610 | | | user: test | |
2611 | | | date: Thu Jan 01 00:00:07 1970 +0000 |
|
2611 | | | date: Thu Jan 01 00:00:07 1970 +0000 | |
2612 | | | summary: (7) expand |
|
2612 | | | summary: (7) expand | |
2613 | | / |
|
2613 | | / | |
2614 | | o changeset: 6:b105a072e251 |
|
2614 | | o changeset: 6:b105a072e251 | |
2615 | |/| parent: 2:3d9a33b8d1e1 |
|
2615 | |/| parent: 2:3d9a33b8d1e1 | |
2616 | | ~ parent: 5:4409d547b708 |
|
2616 | | ~ parent: 5:4409d547b708 | |
2617 | | user: test |
|
2617 | | user: test | |
2618 | | date: Thu Jan 01 00:00:06 1970 +0000 |
|
2618 | | date: Thu Jan 01 00:00:06 1970 +0000 | |
2619 | | summary: (6) merge two known; one immediate left, one far left |
|
2619 | | summary: (6) merge two known; one immediate left, one far left | |
2620 | | |
|
2620 | | | |
2621 | o changeset: 5:4409d547b708 |
|
2621 | o changeset: 5:4409d547b708 | |
2622 | |\ parent: 3:27eef8ed80b4 |
|
2622 | |\ parent: 3:27eef8ed80b4 | |
2623 | | ~ parent: 4:26a8bac39d9f |
|
2623 | | ~ parent: 4:26a8bac39d9f | |
2624 | | user: test |
|
2624 | | user: test | |
2625 | | date: Thu Jan 01 00:00:05 1970 +0000 |
|
2625 | | date: Thu Jan 01 00:00:05 1970 +0000 | |
2626 | | summary: (5) expand |
|
2626 | | summary: (5) expand | |
2627 | | |
|
2627 | | | |
2628 | o changeset: 4:26a8bac39d9f |
|
2628 | o changeset: 4:26a8bac39d9f | |
2629 | |\ parent: 1:6db2ef61d156 |
|
2629 | |\ parent: 1:6db2ef61d156 | |
2630 | ~ ~ parent: 3:27eef8ed80b4 |
|
2630 | ~ ~ parent: 3:27eef8ed80b4 | |
2631 | user: test |
|
2631 | user: test | |
2632 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
2632 | date: Thu Jan 01 00:00:04 1970 +0000 | |
2633 | summary: (4) merge two known; one immediate left, one immediate right |
|
2633 | summary: (4) merge two known; one immediate left, one immediate right | |
2634 |
|
2634 | |||
2635 |
|
2635 | |||
2636 | $ cd .. |
|
2636 | $ cd .. | |
|
2637 | ||||
|
2638 | Change graph shorten, test better with graphstyle.missing not none | |||
|
2639 | ||||
|
2640 | $ cd repo | |||
|
2641 | $ cat << EOF >> $HGRCPATH | |||
|
2642 | > [experimental] | |||
|
2643 | > graphstyle.parent = | | |||
|
2644 | > graphstyle.grandparent = : | |||
|
2645 | > graphstyle.missing = ' | |||
|
2646 | > graphshorten = true | |||
|
2647 | > EOF | |||
|
2648 | $ hg log -G -r 'file("a")' -m -T '{rev} {desc}' | |||
|
2649 | @ 36 (36) buggy merge: identical parents | |||
|
2650 | o 32 (32) expand | |||
|
2651 | |\ | |||
|
2652 | o : 31 (31) expand | |||
|
2653 | |\: | |||
|
2654 | o : 30 (30) expand | |||
|
2655 | |\ \ | |||
|
2656 | o \ \ 28 (28) merge zero known | |||
|
2657 | |\ \ \ | |||
|
2658 | o \ \ \ 26 (26) merge one known; far right | |||
|
2659 | |\ \ \ \ | |||
|
2660 | | o-----+ 25 (25) merge one known; far left | |||
|
2661 | | o ' ' : 24 (24) merge one known; immediate right | |||
|
2662 | | |\ \ \ \ | |||
|
2663 | | o---+ ' : 23 (23) merge one known; immediate left | |||
|
2664 | | o-------+ 22 (22) merge two known; one far left, one far right | |||
|
2665 | |/ / / / / | |||
|
2666 | | ' ' ' o 21 (21) expand | |||
|
2667 | | ' ' ' |\ | |||
|
2668 | +-+-------o 20 (20) merge two known; two far right | |||
|
2669 | | ' ' ' o 19 (19) expand | |||
|
2670 | | ' ' ' |\ | |||
|
2671 | o---+---+ | 18 (18) merge two known; two far left | |||
|
2672 | / / / / / | |||
|
2673 | ' ' ' | o 17 (17) expand | |||
|
2674 | ' ' ' | |\ | |||
|
2675 | +-+-------o 16 (16) merge two known; one immediate right, one near right | |||
|
2676 | ' ' ' o | 15 (15) expand | |||
|
2677 | ' ' ' |\ \ | |||
|
2678 | +-------o | 14 (14) merge two known; one immediate right, one far right | |||
|
2679 | ' ' ' | |/ | |||
|
2680 | ' ' ' o | 13 (13) expand | |||
|
2681 | ' ' ' |\ \ | |||
|
2682 | ' +---+---o 12 (12) merge two known; one immediate right, one far left | |||
|
2683 | ' ' ' | o 11 (11) expand | |||
|
2684 | ' ' ' | |\ | |||
|
2685 | +---------o 10 (10) merge two known; one immediate left, one near right | |||
|
2686 | ' ' ' | |/ | |||
|
2687 | ' ' ' o | 9 (9) expand | |||
|
2688 | ' ' ' |\ \ | |||
|
2689 | +-------o | 8 (8) merge two known; one immediate left, one far right | |||
|
2690 | ' ' ' |/ / | |||
|
2691 | ' ' ' o | 7 (7) expand | |||
|
2692 | ' ' ' |\ \ | |||
|
2693 | ' ' ' +---o 6 (6) merge two known; one immediate left, one far left | |||
|
2694 | ' ' ' | '/ | |||
|
2695 | ' ' ' o ' 5 (5) expand | |||
|
2696 | ' ' ' |\ \ | |||
|
2697 | ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right | |||
|
2698 | ' ' ' '/ / | |||
|
2699 | ||||
|
2700 | behavior with newlines | |||
|
2701 | ||||
|
2702 | $ hg log -G -r ::2 -T '{rev} {desc}' | |||
|
2703 | o 2 (2) collapse | |||
|
2704 | o 1 (1) collapse | |||
|
2705 | o 0 (0) root | |||
|
2706 | ||||
|
2707 | $ hg log -G -r ::2 -T '{rev} {desc}\n' | |||
|
2708 | o 2 (2) collapse | |||
|
2709 | o 1 (1) collapse | |||
|
2710 | o 0 (0) root | |||
|
2711 | ||||
|
2712 | $ hg log -G -r ::2 -T '{rev} {desc}\n\n' | |||
|
2713 | o 2 (2) collapse | |||
|
2714 | | | |||
|
2715 | o 1 (1) collapse | |||
|
2716 | | | |||
|
2717 | o 0 (0) root | |||
|
2718 | ||||
|
2719 | ||||
|
2720 | $ hg log -G -r ::2 -T '\n{rev} {desc}' | |||
|
2721 | o | |||
|
2722 | | 2 (2) collapse | |||
|
2723 | o | |||
|
2724 | | 1 (1) collapse | |||
|
2725 | o | |||
|
2726 | 0 (0) root | |||
|
2727 | ||||
|
2728 | $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n' | |||
|
2729 | o 2 (2) collapse | |||
|
2730 | | | |||
|
2731 | | | |||
|
2732 | o 1 (1) collapse | |||
|
2733 | | | |||
|
2734 | | | |||
|
2735 | o 0 (0) root | |||
|
2736 | ||||
|
2737 | ||||
|
2738 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now