diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -301,12 +301,9 @@ def filterpatch(ui, headers): 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 @@ def filterpatch(ui, headers): 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: diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -158,13 +158,13 @@ qrecord a.patch -2 +2 2 3 - record change 1/6 to '1.txt'? [Ynsfdaq?] + record change 1/4 to '1.txt'? [Ynsfdaq?] @@ -3,3 +3,3 @@ 3 -4 +4 4 5 - record change 2/6 to '1.txt'? [Ynsfdaq?] + record change 2/4 to '1.txt'? [Ynsfdaq?] diff --git a/2.txt b/2.txt 1 hunks, 1 lines changed examine changes to '2.txt'? [Ynsfdaq?] @@ -175,7 +175,7 @@ qrecord a.patch c d e - record change 4/6 to '2.txt'? [Ynsfdaq?] + record change 3/4 to '2.txt'? [Ynsfdaq?] diff --git a/dir/a.txt b/dir/a.txt 1 hunks, 1 lines changed examine changes to 'dir/a.txt'? [Ynsfdaq?] @@ -255,7 +255,7 @@ qrecord b.patch -4 +4 4 5 - record change 1/3 to '1.txt'? [Ynsfdaq?] + record change 1/2 to '1.txt'? [Ynsfdaq?] diff --git a/dir/a.txt b/dir/a.txt 1 hunks, 1 lines changed examine changes to 'dir/a.txt'? [Ynsfdaq?] @@ -265,7 +265,7 @@ qrecord b.patch someone up - record change 3/3 to 'dir/a.txt'? [Ynsfdaq?] + record change 2/2 to 'dir/a.txt'? [Ynsfdaq?] After qrecord b.patch 'tip' diff --git a/tests/test-record.t b/tests/test-record.t --- a/tests/test-record.t +++ b/tests/test-record.t @@ -302,7 +302,7 @@ Modify end of plain file, add EOL -7264f99c5f5ff3261504828afa4fb4d406c3af54 \ No newline at end of file +7264f99c5f5ff3261504828afa4fb4d406c3af54 - record change 1/3 to 'plain'? [Ynsfdaq?] + record change 1/2 to 'plain'? [Ynsfdaq?] diff --git a/plain2 b/plain2 new file mode 100644 examine changes to 'plain2'? [Ynsfdaq?] @@ -332,21 +332,21 @@ changes numbering 2 3 4 - record change 1/4 to 'plain'? [Ynsfdaq?] + record change 1/3 to 'plain'? [Ynsfdaq?] @@ -8,5 +8,3 @@ 8 9 10 -11 -7264f99c5f5ff3261504828afa4fb4d406c3af54 - record change 2/4 to 'plain'? [Ynsfdaq?] + record change 2/3 to 'plain'? [Ynsfdaq?] diff --git a/plain2 b/plain2 1 hunks, 1 lines changed examine changes to 'plain2'? [Ynsfdaq?] @@ -1,1 +1,2 @@ 1 +2 - record change 4/4 to 'plain2'? [Ynsfdaq?] + record change 3/3 to 'plain2'? [Ynsfdaq?] $ hg tip -p changeset: 11:21df83db12b8