Mercurial > public > mercurial-scm > hg-stable
diff hgext/record.py @ 13295:fb446228c0d4
record: do not include files into changes count
This turns the prompt sequence from something like:
$ examine changes to foo?
$ record change 1/4 to foo?
$ record change 2/4 to foo?
$ examine changes to bar?
$ record change 4/4 to bar?
into:
$ examine changes to foo?
$ record change 1/3 to foo?
$ record change 2/3 to foo?
$ examine change to bar?
$ record change 3/3 to bar?
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 24 Jan 2011 23:25:46 +0100 |
parents | 98f0adfc89e3 |
children | e5390a8b56db |
line wrap: on
line diff
--- a/hgext/record.py Sun Jan 23 15:21:56 2011 +0100 +++ b/hgext/record.py Mon Jan 24 23:25:46 2011 +0100 @@ -301,12 +301,9 @@ seen = set() applied = {} # 'filename' -> [] of chunks skipfile, skipall = None, None - # XXX: operation count is weird: it counts headers and hunks - # except for the first header. It probably comes from the previous - # mixed header/hunk stream representation. - pos, total = -1, sum((len(h.hunks) + 1) for h in headers) - 1 + pos, total = 1, sum(len(h.hunks) for h in headers) for h in headers: - pos += len(h.hunks) + 1 + pos += len(h.hunks) skipfile = None fixoffset = 0 hdr = ''.join(h.header) @@ -330,7 +327,7 @@ msg = (total == 1 and (_('record this change to %r?') % chunk.filename()) or (_('record change %d/%d to %r?') % - (pos - len(h.hunks) + i + 1, total, chunk.filename()))) + (pos - len(h.hunks) + i, total, chunk.filename()))) r, skipfile, skipall = prompt(skipfile, skipall, msg) if r: if fixoffset: