[PATCH] record: hg record can't edit new files (issue 4304)

Laurent Charignon lcharignon at fb.com
Mon Mar 9 19:58:57 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1425686263 28800
#      Fri Mar 06 15:57:43 2015 -0800
# Node ID 3c8a2debe9a9820aaccc5fee766a941eba625658
# Parent  4e865115566e75f938cbff9dcf081da39008a161
record: hg record can't edit new files (issue 4304)

While using the record extension to select changes, the user couldn't see the
content of newly added files and had to select/reject them based on filename.
The test is changed accordingly in two places.

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -76,7 +76,7 @@
     """
     diffgit_re = re.compile('diff --git a/(.*) b/(.*)$')
     diff_re = re.compile('diff -r .* (.*)$')
-    allhunks_re = re.compile('(?:index|new file|deleted file) ')
+    allhunks_re = re.compile('(?:index|deleted file) ')
     pretty_re = re.compile('(?:new file|deleted file) ')
     special_re = re.compile('(?:index|new|deleted|copy|rename) ')
 
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -473,18 +473,22 @@
 
   $ hg -v record -l msg -d '12 2' r<<EOF
   > y
+  > y
   > EOF
   diff --git a/r b/r
   new file mode 100644
   examine changes to 'r'? [Ynesfdaq?] y
   
+  @@ -0,0 +1,1 @@
+  +$Id$
+  record this change to 'r'? [Ynesfdaq?] y
+  
   committing files:
   r
   committing manifest
   committing changelog
   committed changeset 3:82a2f715724d
   overwriting r expanding keywords
- - status call required for dirstate.normallookup() check
   $ hg status r
   $ hg --verbose rollback
   repository tip rolled back to revision 2 (undo commit)
@@ -501,11 +505,16 @@
   $ hg add i
   $ hg --verbose record -d '13 1' -m recignored<<EOF
   > y
+  > y
   > EOF
   diff --git a/i b/i
   new file mode 100644
   examine changes to 'i'? [Ynesfdaq?] y
   
+  @@ -0,0 +1,1 @@
+  +$Id$
+  record this change to 'i'? [Ynesfdaq?] y
+  
   committing files:
   i
   committing manifest
diff --git a/tests/test-mq-subrepo.t b/tests/test-mq-subrepo.t
--- a/tests/test-mq-subrepo.t
+++ b/tests/test-mq-subrepo.t
@@ -295,6 +295,10 @@
   new file mode 100644
   examine changes to '.hgsub'? [Ynesfdaq?] y
   
+  @@ -0,0 +1,1 @@
+  +sub = sub
+  record this change to '.hgsub'? [Ynesfdaq?] y
+  
   abort: uncommitted changes in subrepository sub
   [255]
   % update substate when adding .hgsub w/clean updated subrepo
@@ -304,6 +308,10 @@
   new file mode 100644
   examine changes to '.hgsub'? [Ynesfdaq?] y
   
+  @@ -0,0 +1,1 @@
+  +sub = sub
+  record this change to '.hgsub'? [Ynesfdaq?] y
+  
   path sub
    source   sub
    revision b2fdb12cd82b021c3b7053d67802e77b6eeaee31
diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -235,7 +235,19 @@
   new file mode 100644
   examine changes to 'plain'? [Ynesfdaq?] y
   
-
+  @@ -0,0 +1,10 @@
+  +1
+  +2
+  +3
+  +4
+  +5
+  +6
+  +7
+  +8
+  +9
+  +10
+  record this change to 'plain'? [Ynesfdaq?] y
+  
   $ hg tip -p
   changeset:   7:11fb457c1be4
   tag:         tip
@@ -317,6 +329,7 @@
   > y
   > y
   > y
+  > y
   > EOF
   diff --git a/plain b/plain
   1 hunks, 1 lines changed
@@ -335,7 +348,10 @@
   new file mode 100644
   examine changes to 'plain2'? [Ynesfdaq?] y
   
-
+  @@ -0,0 +1,1 @@
+  +1
+  record change 2/2 to 'plain2'? [Ynesfdaq?] y
+  
 Modify beginning, trim end, record both, add another file to test
 changes numbering
 


More information about the Mercurial-devel mailing list