975 yield start, min(windowsize, start-end-1) |
975 yield start, min(windowsize, start-end-1) |
976 start -= windowsize |
976 start -= windowsize |
977 if windowsize < sizelimit: |
977 if windowsize < sizelimit: |
978 windowsize *= 2 |
978 windowsize *= 2 |
979 |
979 |
980 files, matchfn, anypats = matchpats(repo, pats, opts) |
980 m = match(repo, pats, opts) |
981 follow = opts.get('follow') or opts.get('follow_first') |
981 follow = opts.get('follow') or opts.get('follow_first') |
982 |
982 |
983 if repo.changelog.count() == 0: |
983 if repo.changelog.count() == 0: |
984 return [], matchfn |
984 return [], m |
985 |
985 |
986 if follow: |
986 if follow: |
987 defrange = '%s:0' % repo.changectx().rev() |
987 defrange = '%s:0' % repo.changectx().rev() |
988 else: |
988 else: |
989 defrange = '-1:0' |
989 defrange = '-1:0' |
990 revs = revrange(repo, opts['rev'] or [defrange]) |
990 revs = revrange(repo, opts['rev'] or [defrange]) |
991 wanted = {} |
991 wanted = {} |
992 slowpath = anypats or opts.get('removed') |
992 slowpath = m.anypats() or opts.get('removed') |
993 fncache = {} |
993 fncache = {} |
994 |
994 |
995 if not slowpath and not files: |
995 if not slowpath and not m.files(): |
996 # No files, no patterns. Display all revs. |
996 # No files, no patterns. Display all revs. |
997 wanted = dict.fromkeys(revs) |
997 wanted = dict.fromkeys(revs) |
998 copies = [] |
998 copies = [] |
999 if not slowpath: |
999 if not slowpath: |
1000 # Only files, no patterns. Check the history of each file. |
1000 # Only files, no patterns. Check the history of each file. |
1015 # only yield rev for which we have the changelog, it can |
1015 # only yield rev for which we have the changelog, it can |
1016 # happen while doing "hg log" during a pull or commit |
1016 # happen while doing "hg log" during a pull or commit |
1017 if rev[0] < cl_count: |
1017 if rev[0] < cl_count: |
1018 yield rev |
1018 yield rev |
1019 def iterfiles(): |
1019 def iterfiles(): |
1020 for filename in files: |
1020 for filename in m.files(): |
1021 yield filename, None |
1021 yield filename, None |
1022 for filename_node in copies: |
1022 for filename_node in copies: |
1023 yield filename_node |
1023 yield filename_node |
1024 minrev, maxrev = min(revs), max(revs) |
1024 minrev, maxrev = min(revs), max(revs) |
1025 for file_, node in iterfiles(): |
1025 for file_, node in iterfiles(): |
1054 nullrev): |
1054 nullrev): |
1055 for j in xrange(i - window, i + 1): |
1055 for j in xrange(i - window, i + 1): |
1056 yield j, change(j)[3] |
1056 yield j, change(j)[3] |
1057 |
1057 |
1058 for rev, changefiles in changerevgen(): |
1058 for rev, changefiles in changerevgen(): |
1059 matches = filter(matchfn, changefiles) |
1059 matches = filter(m, changefiles) |
1060 if matches: |
1060 if matches: |
1061 fncache[rev] = matches |
1061 fncache[rev] = matches |
1062 wanted[rev] = 1 |
1062 wanted[rev] = 1 |
1063 |
1063 |
1064 class followfilter: |
1064 class followfilter: |
1107 for x in xrange(rev, stop-1, -1): |
1107 for x in xrange(rev, stop-1, -1): |
1108 if ff.match(x) and x in wanted: |
1108 if ff.match(x) and x in wanted: |
1109 del wanted[x] |
1109 del wanted[x] |
1110 |
1110 |
1111 def iterate(): |
1111 def iterate(): |
1112 if follow and not files: |
1112 if follow and not m.files(): |
1113 ff = followfilter(onlyfirst=opts.get('follow_first')) |
1113 ff = followfilter(onlyfirst=opts.get('follow_first')) |
1114 def want(rev): |
1114 def want(rev): |
1115 if ff.match(rev) and rev in wanted: |
1115 if ff.match(rev) and rev in wanted: |
1116 return True |
1116 return True |
1117 return False |
1117 return False |
1127 for rev in srevs: |
1127 for rev in srevs: |
1128 fns = fncache.get(rev) |
1128 fns = fncache.get(rev) |
1129 if not fns: |
1129 if not fns: |
1130 def fns_generator(): |
1130 def fns_generator(): |
1131 for f in change(rev)[3]: |
1131 for f in change(rev)[3]: |
1132 if matchfn(f): |
1132 if m(f): |
1133 yield f |
1133 yield f |
1134 fns = fns_generator() |
1134 fns = fns_generator() |
1135 yield 'add', rev, fns |
1135 yield 'add', rev, fns |
1136 for rev in nrevs: |
1136 for rev in nrevs: |
1137 yield 'iter', rev, None |
1137 yield 'iter', rev, None |
1138 return iterate(), matchfn |
1138 return iterate(), m |
1139 |
1139 |
1140 def commit(ui, repo, commitfunc, pats, opts): |
1140 def commit(ui, repo, commitfunc, pats, opts): |
1141 '''commit the specified files or all outstanding changes''' |
1141 '''commit the specified files or all outstanding changes''' |
1142 date = opts.get('date') |
1142 date = opts.get('date') |
1143 if date: |
1143 if date: |