Fixed a bashism with the use of $RANDOM in hgeditor.
The variable $RANDOM is not POSIX so a portable /bin/sh may not define
it. When creating a directory with a random name it's better to use
mktemp, which, even though is not POSIX, exists in common Unixes
including Linux, OpenBSD, FreeBSD and MacOS X.
% setup LF repository
adding .hgeol
adding a.txt
% hg clone repo repo-LF
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
% printrepr.py a.txt
first
second
third
% hg cat a.txt
first
second
third
% printrepr.py a.txt
first
second
third
fourth
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first
second
third
+fourth
% switching encoding from '\n' to '\r\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first
second
third
+fourth
% reverting back to LF format
first
second
third
% hg commit of inconsistent .txt file marked as binary (should work)
% hg commit of inconsistent .txt file marked as native (should fail)
abort: inconsistent newline style in a.txt
% hg commit --config eol.only-consistent=False (should work)
% hg commit of binary .txt file marked as native (binary files always okay)
% hg clone repo repo-CRLF
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
% printrepr.py a.txt
first\r
second\r
third\r
% hg cat a.txt
first
second
third
% printrepr.py a.txt
first\r
second\r
third\r
fourth\r
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first
second
third
+fourth
% switching encoding from '\r\n' to '\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first
second
third
+fourth
% reverting back to CRLF format
first\r
second\r
third\r
% hg commit of inconsistent .txt file marked as binary (should work)
% hg commit of inconsistent .txt file marked as native (should fail)
abort: inconsistent newline style in a.txt
% hg commit --config eol.only-consistent=False (should work)
% hg commit of binary .txt file marked as native (binary files always okay)
% setup CRLF repository
adding .hgeol
adding a.txt
% hg clone repo repo-LF
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
% printrepr.py a.txt
first
second
third
% hg cat a.txt
first\r
second\r
third\r
% printrepr.py a.txt
first
second
third
fourth
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first\r
second\r
third\r
+fourth\r
% switching encoding from '\n' to '\r\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first\r
second\r
third\r
+fourth\r
% reverting back to LF format
first
second
third
% hg commit of inconsistent .txt file marked as binary (should work)
% hg commit of inconsistent .txt file marked as native (should fail)
abort: inconsistent newline style in a.txt
% hg commit --config eol.only-consistent=False (should work)
% hg commit of binary .txt file marked as native (binary files always okay)
% hg clone repo repo-CRLF
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
% printrepr.py a.txt
first\r
second\r
third\r
% hg cat a.txt
first\r
second\r
third\r
% printrepr.py a.txt
first\r
second\r
third\r
fourth\r
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first\r
second\r
third\r
+fourth\r
% switching encoding from '\r\n' to '\n'
% hg diff only reports a single changed line:
diff --git a/a.txt b/a.txt
--- a/a.txt
+++ b/a.txt
@@ -1,3 +1,4 @@
first\r
second\r
third\r
+fourth\r
% reverting back to CRLF format
first\r
second\r
third\r
% hg commit of inconsistent .txt file marked as binary (should work)
% hg commit of inconsistent .txt file marked as native (should fail)
abort: inconsistent newline style in a.txt
% hg commit --config eol.only-consistent=False (should work)
% hg commit of binary .txt file marked as native (binary files always okay)
# setup LF repository
adding unix.txt
adding win.txt
# setting repository-native EOLs to LF
adding .hgeol
% hg clone mixed mixed-LF
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% hg status (eol extension not yet activated)
% hg status (eol activated)
M win.txt
% hg commit
% hg status
% hg clone mixed mixed-CRLF
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% hg status (eol extension not yet activated)
% hg status (eol activated)
M win.txt
% hg commit
% hg status
# setup CRLF repository
adding unix.txt
adding win.txt
# setting repository-native EOLs to CRLF
adding .hgeol
% hg clone mixed mixed-LF
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% hg status (eol extension not yet activated)
% hg status (eol activated)
M unix.txt
% hg commit
% hg status
% hg clone mixed mixed-CRLF
updating to branch default
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% hg status (eol extension not yet activated)
% hg status (eol activated)
M unix.txt
% hg commit
% hg status