Show More
@@ -159,7 +159,6 b' from mercurial import (' | |||||
159 | scmutil, |
|
159 | scmutil, | |
160 | smartset, |
|
160 | smartset, | |
161 | streamclone, |
|
161 | streamclone, | |
162 | templatekw, |
|
|||
163 | util, |
|
162 | util, | |
164 | ) |
|
163 | ) | |
165 | from . import ( |
|
164 | from . import ( | |
@@ -557,7 +556,7 b' def onetimeclientsetup(ui):' | |||||
557 | extensions.wrapfunction(dispatch, 'runcommand', runcommand) |
|
556 | extensions.wrapfunction(dispatch, 'runcommand', runcommand) | |
558 |
|
557 | |||
559 | # disappointing hacks below |
|
558 | # disappointing hacks below | |
560 |
|
|
559 | scmutil.getrenamedfn = getrenamedfn | |
561 | extensions.wrapfunction(revset, 'filelog', filelogrevset) |
|
560 | extensions.wrapfunction(revset, 'filelog', filelogrevset) | |
562 | revset.symbols['filelog'] = revset.filelog |
|
561 | revset.symbols['filelog'] = revset.filelog | |
563 | extensions.wrapfunction(cmdutil, 'walkfilerevs', walkfilerevs) |
|
562 | extensions.wrapfunction(cmdutil, 'walkfilerevs', walkfilerevs) |
@@ -61,7 +61,6 b' from . import (' | |||||
61 | state as statemod, |
|
61 | state as statemod, | |
62 | streamclone, |
|
62 | streamclone, | |
63 | tags as tagsmod, |
|
63 | tags as tagsmod, | |
64 | templatekw, |
|
|||
65 | ui as uimod, |
|
64 | ui as uimod, | |
66 | util, |
|
65 | util, | |
67 | wireprotoserver, |
|
66 | wireprotoserver, | |
@@ -3884,7 +3883,7 b' def log(ui, repo, *pats, **opts):' | |||||
3884 | endrev = None |
|
3883 | endrev = None | |
3885 | if revs: |
|
3884 | if revs: | |
3886 | endrev = revs.max() + 1 |
|
3885 | endrev = revs.max() + 1 | |
3887 |
getrenamed = |
|
3886 | getrenamed = scmutil.getrenamedfn(repo, endrev=endrev) | |
3888 |
|
3887 | |||
3889 | ui.pager('log') |
|
3888 | ui.pager('log') | |
3890 | displayer = logcmdutil.changesetdisplayer(ui, repo, opts, differ, |
|
3889 | displayer = logcmdutil.changesetdisplayer(ui, repo, opts, differ, |
@@ -1191,6 +1191,37 b' def _markchanges(repo, unknown, deleted,' | |||||
1191 | for new, old in renames.iteritems(): |
|
1191 | for new, old in renames.iteritems(): | |
1192 | wctx.copy(old, new) |
|
1192 | wctx.copy(old, new) | |
1193 |
|
1193 | |||
|
1194 | def getrenamedfn(repo, endrev=None): | |||
|
1195 | rcache = {} | |||
|
1196 | if endrev is None: | |||
|
1197 | endrev = len(repo) | |||
|
1198 | ||||
|
1199 | def getrenamed(fn, rev): | |||
|
1200 | '''looks up all renames for a file (up to endrev) the first | |||
|
1201 | time the file is given. It indexes on the changerev and only | |||
|
1202 | parses the manifest if linkrev != changerev. | |||
|
1203 | Returns rename info for fn at changerev rev.''' | |||
|
1204 | if fn not in rcache: | |||
|
1205 | rcache[fn] = {} | |||
|
1206 | fl = repo.file(fn) | |||
|
1207 | for i in fl: | |||
|
1208 | lr = fl.linkrev(i) | |||
|
1209 | renamed = fl.renamed(fl.node(i)) | |||
|
1210 | rcache[fn][lr] = renamed and renamed[0] | |||
|
1211 | if lr >= endrev: | |||
|
1212 | break | |||
|
1213 | if rev in rcache[fn]: | |||
|
1214 | return rcache[fn][rev] | |||
|
1215 | ||||
|
1216 | # If linkrev != rev (i.e. rev not found in rcache) fallback to | |||
|
1217 | # filectx logic. | |||
|
1218 | try: | |||
|
1219 | return repo[rev][fn].copysource() | |||
|
1220 | except error.LookupError: | |||
|
1221 | return None | |||
|
1222 | ||||
|
1223 | return getrenamed | |||
|
1224 | ||||
1194 | def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None): |
|
1225 | def dirstatecopy(ui, repo, wctx, src, dst, dryrun=False, cwd=None): | |
1195 | """Update the dirstate to reflect the intent of copying src to dst. For |
|
1226 | """Update the dirstate to reflect the intent of copying src to dst. For | |
1196 | different reasons it might not end with dst being marked as copied from src. |
|
1227 | different reasons it might not end with dst being marked as copied from src. |
@@ -104,37 +104,6 b' def getlatesttags(context, mapping, patt' | |||||
104 | latesttags[rev] = pdate, pdist + 1, ptag |
|
104 | latesttags[rev] = pdate, pdist + 1, ptag | |
105 | return latesttags[rev] |
|
105 | return latesttags[rev] | |
106 |
|
106 | |||
107 | def getrenamedfn(repo, endrev=None): |
|
|||
108 | rcache = {} |
|
|||
109 | if endrev is None: |
|
|||
110 | endrev = len(repo) |
|
|||
111 |
|
||||
112 | def getrenamed(fn, rev): |
|
|||
113 | '''looks up all renames for a file (up to endrev) the first |
|
|||
114 | time the file is given. It indexes on the changerev and only |
|
|||
115 | parses the manifest if linkrev != changerev. |
|
|||
116 | Returns rename info for fn at changerev rev.''' |
|
|||
117 | if fn not in rcache: |
|
|||
118 | rcache[fn] = {} |
|
|||
119 | fl = repo.file(fn) |
|
|||
120 | for i in fl: |
|
|||
121 | lr = fl.linkrev(i) |
|
|||
122 | renamed = fl.renamed(fl.node(i)) |
|
|||
123 | rcache[fn][lr] = renamed and renamed[0] |
|
|||
124 | if lr >= endrev: |
|
|||
125 | break |
|
|||
126 | if rev in rcache[fn]: |
|
|||
127 | return rcache[fn][rev] |
|
|||
128 |
|
||||
129 | # If linkrev != rev (i.e. rev not found in rcache) fallback to |
|
|||
130 | # filectx logic. |
|
|||
131 | try: |
|
|||
132 | return repo[rev][fn].copysource() |
|
|||
133 | except error.LookupError: |
|
|||
134 | return None |
|
|||
135 |
|
||||
136 | return getrenamed |
|
|||
137 |
|
||||
138 | def getlogcolumns(): |
|
107 | def getlogcolumns(): | |
139 | """Return a dict of log column labels""" |
|
108 | """Return a dict of log column labels""" | |
140 | _ = pycompat.identity # temporarily disable gettext |
|
109 | _ = pycompat.identity # temporarily disable gettext | |
@@ -343,7 +312,7 b' def showfilecopies(context, mapping):' | |||||
343 | copies = context.resource(mapping, 'revcache').get('copies') |
|
312 | copies = context.resource(mapping, 'revcache').get('copies') | |
344 | if copies is None: |
|
313 | if copies is None: | |
345 | if 'getrenamed' not in cache: |
|
314 | if 'getrenamed' not in cache: | |
346 | cache['getrenamed'] = getrenamedfn(repo) |
|
315 | cache['getrenamed'] = scmutil.getrenamedfn(repo) | |
347 | copies = [] |
|
316 | copies = [] | |
348 | getrenamed = cache['getrenamed'] |
|
317 | getrenamed = cache['getrenamed'] | |
349 | for fn in ctx.files(): |
|
318 | for fn in ctx.files(): |
General Comments 0
You need to be logged in to leave comments.
Login now