comparison mercurial/cmdutil.py @ 9665:1de5ebfa5585

walkchangerevs: drop ui arg
author Matt Mackall <mpm@selenic.com>
date Thu, 29 Oct 2009 19:03:16 -0500
parents 2a4a0dc4fb85
children 8743f2e1bc54
comparison
equal deleted inserted replaced
9664:2a4a0dc4fb85 9665:1de5ebfa5585
1029 def prep(ctx, fns): 1029 def prep(ctx, fns):
1030 d = ctx.date() 1030 d = ctx.date()
1031 if df(d[0]): 1031 if df(d[0]):
1032 results[rev] = d 1032 results[rev] = d
1033 1033
1034 for ctx in walkchangerevs(ui, repo, m, {'rev':None}, prep): 1034 for ctx in walkchangerevs(repo, m, {'rev':None}, prep):
1035 rev = ctx.rev() 1035 rev = ctx.rev()
1036 if rev in results: 1036 if rev in results:
1037 ui.status(_("Found revision %s from %s\n") % 1037 ui.status(_("Found revision %s from %s\n") %
1038 (rev, util.datestr(results[rev]))) 1038 (rev, util.datestr(results[rev])))
1039 return str(rev) 1039 return str(rev)
1040 1040
1041 raise util.Abort(_("revision matching date not found")) 1041 raise util.Abort(_("revision matching date not found"))
1042 1042
1043 def walkchangerevs(ui, repo, match, opts, prepare): 1043 def walkchangerevs(repo, match, opts, prepare):
1044 '''Iterate over files and the revs in which they changed. 1044 '''Iterate over files and the revs in which they changed.
1045 1045
1046 Callers most commonly need to iterate backwards over the history 1046 Callers most commonly need to iterate backwards over the history
1047 in which they are interested. Doing so has awful (quadratic-looking) 1047 in which they are interested. Doing so has awful (quadratic-looking)
1048 performance, so we use iterators in a "windowed" way. 1048 performance, so we use iterators in a "windowed" way.
1086 1086
1087 if not slowpath and not match.files(): 1087 if not slowpath and not match.files():
1088 # No files, no patterns. Display all revs. 1088 # No files, no patterns. Display all revs.
1089 wanted = set(revs) 1089 wanted = set(revs)
1090 copies = [] 1090 copies = []
1091
1091 if not slowpath: 1092 if not slowpath:
1092 # Only files, no patterns. Check the history of each file. 1093 # Only files, no patterns. Check the history of each file.
1093 def filerevgen(filelog, node): 1094 def filerevgen(filelog, node):
1094 cl_count = len(repo) 1095 cl_count = len(repo)
1095 if node is None: 1096 if node is None:
1122 if follow: 1123 if follow:
1123 raise util.Abort(_('cannot follow nonexistent file: "%s"') % file_) 1124 raise util.Abort(_('cannot follow nonexistent file: "%s"') % file_)
1124 slowpath = True 1125 slowpath = True
1125 break 1126 break
1126 else: 1127 else:
1127 ui.warn(_('%s:%s copy source revision cannot be found!\n')
1128 % (file_, short(node)))
1129 continue 1128 continue
1130 for rev, copied in filerevgen(filelog, node): 1129 for rev, copied in filerevgen(filelog, node):
1131 if rev <= maxrev: 1130 if rev <= maxrev:
1132 if rev < minrev: 1131 if rev < minrev:
1133 break 1132 break