##// END OF EJS Templates
cmdutil: reimplement finddate() without using walkchangerevs()...
Yuya Nishihara -
r46029:d2b5a765 default
parent child Browse files
Show More
@@ -2230,26 +2230,17 b' def showmarker(fm, marker, index=None):'
2230
2230
2231 def finddate(ui, repo, date):
2231 def finddate(ui, repo, date):
2232 """Find the tipmost changeset that matches the given date spec"""
2232 """Find the tipmost changeset that matches the given date spec"""
2233
2233 mrevs = repo.revs(b'date(%s)', date)
2234 df = dateutil.matchdate(date)
2234 try:
2235 m = scmutil.matchall(repo)
2235 rev = mrevs.max()
2236 results = {}
2236 except ValueError:
2237
2237 raise error.Abort(_(b"revision matching date not found"))
2238 def prep(ctx, fns):
2238
2239 d = ctx.date()
2239 ui.status(
2240 if df(d[0]):
2240 _(b"found revision %d from %s\n")
2241 results[ctx.rev()] = d
2241 % (rev, dateutil.datestr(repo[rev].date()))
2242
2242 )
2243 for ctx in walkchangerevs(repo, m, {b'rev': None}, prep):
2243 return b'%d' % rev
2244 rev = ctx.rev()
2245 if rev in results:
2246 ui.status(
2247 _(b"found revision %d from %s\n")
2248 % (rev, dateutil.datestr(results[rev]))
2249 )
2250 return b'%d' % rev
2251
2252 raise error.Abort(_(b"revision matching date not found"))
2253
2244
2254
2245
2255 def increasingwindows(windowsize=8, sizelimit=512):
2246 def increasingwindows(windowsize=8, sizelimit=512):
General Comments 0
You need to be logged in to leave comments. Login now