mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
patch: enhance diff detection regexp, allow '--- ' in patch message
This commit is contained in:
parent
d6ef50d413
commit
0ad95ca3aa
@ -178,7 +178,8 @@ def extract(ui, fileobj):
|
||||
# (this heuristic is borrowed from quilt)
|
||||
diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
|
||||
r'retrieving revision [0-9]+(\.[0-9]+)*$|'
|
||||
r'(---|\*\*\*)[ \t])', re.MULTILINE)
|
||||
r'(---|\*\*\*)[ \t].*?'
|
||||
r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL)
|
||||
|
||||
fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
|
||||
tmpfp = os.fdopen(fd, 'w')
|
||||
|
@ -375,6 +375,25 @@ hg import -d '0 0' a.patch
|
||||
hg parents -v
|
||||
cd ..
|
||||
|
||||
echo % '--- in commit message'
|
||||
hg init commitconfusion
|
||||
cd commitconfusion
|
||||
cat > a.patch <<EOF
|
||||
module: summary
|
||||
|
||||
--- description
|
||||
|
||||
diff --git a/a b/a
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/a
|
||||
@@ -0,0 +1,1 @@
|
||||
+a
|
||||
EOF
|
||||
hg import -d '0 0' a.patch
|
||||
hg parents -v
|
||||
cd ..
|
||||
|
||||
echo '% tricky header splitting'
|
||||
cat > trickyheaders.patch <<EOF
|
||||
From: User A <user@a>
|
||||
|
@ -318,6 +318,17 @@ module: summary
|
||||
description
|
||||
|
||||
|
||||
% --- in commit message
|
||||
applying a.patch
|
||||
changeset: 0:f34d9187897d
|
||||
tag: tip
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
files: a
|
||||
description:
|
||||
module: summary
|
||||
|
||||
|
||||
% tricky header splitting
|
||||
applying ../trickyheaders.patch
|
||||
# HG changeset patch
|
||||
|
Loading…
Reference in New Issue
Block a user