Re: [PATCH] crecord: properly handle files with No newline at eof (issue5268)

2016-09-05 Thread Yuya Nishihara
On Fri, 02 Sep 2016 20:17:07 +, timeless wrote:
> # HG changeset patch
> # User timeless 
> # Date 1472847337 0
> #  Fri Sep 02 20:15:37 2016 +
> # Node ID 68a20f02785b24f08b13e21ffc9e2a05031b07f8
> # Parent  f148bfa40489269be2e48046734f81065129847a
> # Available At https://bitbucket.org/timeless/mercurial-crew
> #  hg pull https://bitbucket.org/timeless/mercurial-crew -r 
> 68a20f02785b
> crecord: properly handle files with No newline at eof (issue5268)
> 
> Yes, this bug was a single character with the wrong case...

I never thought it was. Queued for stable, thanks!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] crecord: properly handle files with No newline at eof (issue5268)

2016-09-02 Thread timeless
# HG changeset patch
# User timeless 
# Date 1472847337 0
#  Fri Sep 02 20:15:37 2016 +
# Node ID 68a20f02785b24f08b13e21ffc9e2a05031b07f8
# Parent  f148bfa40489269be2e48046734f81065129847a
# Available At https://bitbucket.org/timeless/mercurial-crew
#  hg pull https://bitbucket.org/timeless/mercurial-crew -r 
68a20f02785b
crecord: properly handle files with No newline at eof (issue5268)

Yes, this bug was a single character with the wrong case...

diff -r f148bfa40489 -r 68a20f02785b mercurial/crecord.py
--- a/mercurial/crecord.py  Tue Jul 05 09:37:07 2016 +0200
+++ b/mercurial/crecord.py  Fri Sep 02 20:15:37 2016 +
@@ -387,7 +387,7 @@
 
 contextlen = (len(self.before) + len(self.after) +
   removedconvertedtocontext)
-if self.after and self.after[-1] == '\\ no newline at end of file\n':
+if self.after and self.after[-1] == '\\ No newline at end of file\n':
 contextlen -= 1
 fromlen = contextlen + self.removed
 tolen = contextlen + self.added
diff -r f148bfa40489 -r 68a20f02785b tests/test-commit-interactive-curses.t
--- a/tests/test-commit-interactive-curses.tTue Jul 05 09:37:07 2016 +0200
+++ b/tests/test-commit-interactive-curses.tFri Sep 02 20:15:37 2016 +
@@ -9,6 +9,21 @@
   > crecordtest = testModeCommands
   > EOF
 
+Record with noeol at eof (issue5268)
+  $ hg init noeol
+  $ cd noeol
+  $ printf '0' > a
+  $ printf '0\n' > b
+  $ hg ci -Aqm initial
+  $ printf '1\n0' > a
+  $ printf '1\n0\n' > b
+  $ cat  c
+  > EOF
+  $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit  -i -m "add hunks" -d "0 0"
+  $ cd ..
+
+Normal repo
   $ hg init a
   $ cd a
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel