equal
deleted
inserted
replaced
1147 for i in xrange(blo, bhi): |
1147 for i in xrange(blo, bhi): |
1148 yield ('+', b[i]) |
1148 yield ('+', b[i]) |
1149 |
1149 |
1150 prev = {} |
1150 prev = {} |
1151 def display(fn, rev, states, prevstates): |
1151 def display(fn, rev, states, prevstates): |
1152 counts = {'-': 0, '+': 0} |
1152 found = False |
1153 filerevmatches = {} |
1153 filerevmatches = {} |
1154 if not opts['all']: |
1154 r = prev.get(fn, -1) |
1155 a, b, r = prevstates, states, rev |
1155 if opts['all']: |
|
1156 iter = difflinestates(states, prevstates) |
1156 else: |
1157 else: |
1157 a, b, r = states, prevstates, prev.get(fn, -1) |
1158 iter = [('', l) for l in prevstates] |
1158 for change, l in difflinestates(a, b): |
1159 for change, l in iter: |
1159 cols = [fn, str(r)] |
1160 cols = [fn, str(r)] |
1160 if opts['line_number']: |
1161 if opts['line_number']: |
1161 cols.append(str(l.linenum)) |
1162 cols.append(str(l.linenum)) |
1162 if opts['all']: |
1163 if opts['all']: |
1163 cols.append(change) |
1164 cols.append(change) |
1169 continue |
1170 continue |
1170 filerevmatches[c] = 1 |
1171 filerevmatches[c] = 1 |
1171 else: |
1172 else: |
1172 cols.append(l.line) |
1173 cols.append(l.line) |
1173 ui.write(sep.join(cols), eol) |
1174 ui.write(sep.join(cols), eol) |
1174 counts[change] += 1 |
1175 found = True |
1175 return counts['+'], counts['-'] |
1176 return found |
1176 |
1177 |
1177 fstate = {} |
1178 fstate = {} |
1178 skip = {} |
1179 skip = {} |
1179 get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
1180 get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
1180 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
1181 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
1181 count = 0 |
1182 found = False |
1182 follow = opts.get('follow') |
1183 follow = opts.get('follow') |
1183 for st, rev, fns in changeiter: |
1184 for st, rev, fns in changeiter: |
1184 if st == 'window': |
1185 if st == 'window': |
1185 matches.clear() |
1186 matches.clear() |
1186 elif st == 'add': |
1187 elif st == 'add': |
1205 copy = copies.get(rev, {}).get(fn) |
1206 copy = copies.get(rev, {}).get(fn) |
1206 if fn in skip: |
1207 if fn in skip: |
1207 if copy: |
1208 if copy: |
1208 skip[copy] = True |
1209 skip[copy] = True |
1209 continue |
1210 continue |
1210 if not opts['all'] or fstate[fn]: |
1211 if fn in prev or fstate[fn]: |
1211 pos, neg = display(fn, rev, m, fstate[fn]) |
1212 r = display(fn, rev, m, fstate[fn]) |
1212 count += pos + neg |
1213 found = found or r |
1213 if pos and not opts['all']: |
1214 if r and not opts['all']: |
1214 skip[fn] = True |
1215 skip[fn] = True |
1215 if copy: |
1216 if copy: |
1216 skip[copy] = True |
1217 skip[copy] = True |
1217 fstate[fn] = m |
1218 fstate[fn] = m |
1218 if copy: |
1219 if copy: |
1223 fstate.sort() |
1224 fstate.sort() |
1224 for fn, state in fstate: |
1225 for fn, state in fstate: |
1225 if fn in skip: |
1226 if fn in skip: |
1226 continue |
1227 continue |
1227 if fn not in copies.get(prev[fn], {}): |
1228 if fn not in copies.get(prev[fn], {}): |
1228 display(fn, rev, {}, state) |
1229 found = display(fn, rev, {}, state) or found |
1229 return (count == 0 and 1) or 0 |
1230 return (not found and 1) or 0 |
1230 |
1231 |
1231 def heads(ui, repo, **opts): |
1232 def heads(ui, repo, **opts): |
1232 """show current repository heads |
1233 """show current repository heads |
1233 |
1234 |
1234 Show all repository head changesets. |
1235 Show all repository head changesets. |