changeset 11728:226a328a7ff3

record: count lines changed as the number of lines added or removed per "record" hunk Record deals in hunks which are tighter than traditional patch hunks, really only a single run of additions/removals. Another addition, even a line after a fixed line is treated as a new hunk by record.
author timeless <timeless@gmail.com>
date Thu, 22 Jul 2010 18:47:46 +0300
parents b6f72d8d77ae
children c91b86a291b0
files hgext/record.py tests/test-qrecord.out tests/test-record.out
diffstat 3 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/record.py	Sun Aug 01 13:52:42 2010 -0500
+++ b/hgext/record.py	Thu Jul 22 18:47:46 2010 +0300
@@ -97,7 +97,7 @@
             if h.startswith('---'):
                 fp.write(_('%d hunks, %d lines changed\n') %
                          (len(self.hunks),
-                          sum([h.added + h.removed for h in self.hunks])))
+                          sum([max(h.added, h.removed) for h in self.hunks])))
                 break
             fp.write(h)
 
--- a/tests/test-qrecord.out	Sun Aug 01 13:52:42 2010 -0500
+++ b/tests/test-qrecord.out	Thu Jul 22 18:47:46 2010 +0300
@@ -81,7 +81,7 @@
  up
 % qrecord a.patch
 diff --git a/1.txt b/1.txt
-2 hunks, 4 lines changed
+2 hunks, 2 lines changed
 examine changes to '1.txt'? [Ynsfdaq?] 
 @@ -1,3 +1,3 @@
  1
@@ -96,7 +96,7 @@
  5
 record change 2/6 to '1.txt'? [Ynsfdaq?] 
 diff --git a/2.txt b/2.txt
-1 hunks, 2 lines changed
+1 hunks, 1 lines changed
 examine changes to '2.txt'? [Ynsfdaq?] 
 @@ -1,5 +1,5 @@
  a
@@ -107,7 +107,7 @@
  e
 record change 4/6 to '2.txt'? [Ynsfdaq?] 
 diff --git a/dir/a.txt b/dir/a.txt
-1 hunks, 2 lines changed
+1 hunks, 1 lines changed
 examine changes to 'dir/a.txt'? [Ynsfdaq?] 
 
 % after qrecord a.patch 'tip'
@@ -164,7 +164,7 @@
  up
 % qrecord b.patch
 diff --git a/1.txt b/1.txt
-1 hunks, 2 lines changed
+1 hunks, 1 lines changed
 examine changes to '1.txt'? [Ynsfdaq?] 
 @@ -1,5 +1,5 @@
  1
@@ -175,7 +175,7 @@
  5
 record change 1/3 to '1.txt'? [Ynsfdaq?] 
 diff --git a/dir/a.txt b/dir/a.txt
-1 hunks, 2 lines changed
+1 hunks, 1 lines changed
 examine changes to 'dir/a.txt'? [Ynsfdaq?] 
 @@ -1,4 +1,4 @@
 -hello world
--- a/tests/test-record.out	Sun Aug 01 13:52:42 2010 -0500
+++ b/tests/test-record.out	Thu Jul 22 18:47:46 2010 +0300
@@ -222,7 +222,7 @@
 record this change to 'plain'? [Ynsfdaq?] 
 % modify end of plain file, add EOL
 diff --git a/plain b/plain
-1 hunks, 2 lines changed
+1 hunks, 1 lines changed
 examine changes to 'plain'? [Ynsfdaq?] 
 @@ -9,4 +9,4 @@
  9
@@ -234,7 +234,7 @@
 record this change to 'plain'? [Ynsfdaq?] 
 % modify beginning, trim end, record both
 diff --git a/plain b/plain
-2 hunks, 4 lines changed
+2 hunks, 3 lines changed
 examine changes to 'plain'? [Ynsfdaq?] 
 @@ -1,4 +1,4 @@
 -1
@@ -276,7 +276,7 @@
 % trim beginning, modify end
 % record end
 diff --git a/plain b/plain
-2 hunks, 5 lines changed
+2 hunks, 4 lines changed
 examine changes to 'plain'? [Ynsfdaq?] 
 @@ -1,9 +1,6 @@
 -2