551 except SyntaxError, inst: |
551 except SyntaxError, inst: |
552 raise util.Abort(inst.args[0]) |
552 raise util.Abort(inst.args[0]) |
553 if tmpl: t.use_template(tmpl) |
553 if tmpl: t.use_template(tmpl) |
554 return t |
554 return t |
555 return changeset_printer(ui, repo, patch, br, buffered) |
555 return changeset_printer(ui, repo, patch, br, buffered) |
|
556 |
|
557 def finddate(ui, repo, date): |
|
558 """Find the tipmost changeset that matches the given date spec""" |
|
559 df = util.matchdate(date + " to " + date) |
|
560 get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
|
561 changeiter, matchfn = walkchangerevs(ui, repo, [], get, {'rev':None}) |
|
562 results = {} |
|
563 for st, rev, fns in changeiter: |
|
564 if st == 'add': |
|
565 d = get(rev)[2] |
|
566 if df(d[0]): |
|
567 results[rev] = d |
|
568 elif st == 'iter': |
|
569 if rev in results: |
|
570 ui.status("Found revision %s from %s\n" % |
|
571 (rev, util.datestr(results[rev]))) |
|
572 return str(rev) |
|
573 |
|
574 raise util.Abort(_("revision matching date not found")) |
556 |
575 |
557 def walkchangerevs(ui, repo, pats, change, opts): |
576 def walkchangerevs(ui, repo, pats, change, opts): |
558 '''Iterate over files and the revs they changed in. |
577 '''Iterate over files and the revs they changed in. |
559 |
578 |
560 Callers most commonly need to iterate backwards over the history |
579 Callers most commonly need to iterate backwards over the history |