Commit Graph

300 Commits

Author SHA1 Message Date
Patrick Mezard
744f417d4c patch: write .rej files without rewriting EOLs
Do not pass reject file content to patchfile.writelines() to:
- Avoid line endings transformations
- Avoid polluting overriding implementations with unrelated data. They should
  override write_rej() to deal or ignore reject files properly.

Bug report, analysis and original patch and test by
Shun-ichi GOTO <shunichi.goto@gmail.com>
2010-12-03 11:40:30 +09:00
Patrick Mezard
88ff8c9a1e Test applying context diffs 2010-10-24 12:56:38 +02:00
Mads Kiilerich
287d9de60b import: only the first hg patch marker should be processed (issue2417)
Proper use of the hgpatch state variable had been lost in the final edits of
6f45596f715c - now it works more like intended.
2010-10-14 01:28:29 +02:00
Patrick Mezard
01e8f53ff7 patch: fails immediately upon malformed hunk
patch(1) does silently ignore malformed hunks but this is not something we want
to copy.
2010-10-09 15:13:08 -05:00
Patrick Mezard
095f60fafa patch: always raise PatchError with a message, simplify handling 2010-10-09 15:13:08 -05:00
Patrick Mezard
b52c9228ba patch: simplify externalpatch() arguments 2010-10-09 15:13:08 -05:00
Patrick Mezard
61a67cb90e patch: remove internal patcher fallback and NoHunk error
By now the internal patcher is probably more reliable than anything we might
find on the command line.
2010-10-09 15:13:08 -05:00
Patrick Mezard
f0b64b2f9a patch: remove unused patchmeta.lineno 2010-10-09 15:13:08 -05:00
Patrick Mezard
3c601e6ebf patch: remove unused flags from readgitpatch() 2010-10-09 15:13:08 -05:00
Mads Kiilerich
227683e7b5 import: don't strip '#' lines from patch descriptions (issue 2417)
Previously no '# ' lines came through the parser.

Now only the first '# ' lines are processed, from '# HG changeset patch' and to
the first line not starting with '# '.
2010-10-08 23:39:44 -05:00
Patrick Mezard
df877501f1 Merge with stable 2010-09-28 01:11:24 +02:00
Patrick Mezard
a8f024ef25 patch: test and document a bit binary to regular file upgrade 2010-09-28 00:41:08 +02:00
Patrick Mezard
a9686ec545 patch: upgrade to git patch when removing binary file
Otherwise it may cause data loss when removing binary files in mq with
--git=auto.
2010-09-28 00:41:07 +02:00
Patrick Mezard
5468157807 patch: fix rename text to binary file (issue2400) 2010-09-27 22:47:10 +02:00
Patrick Mezard
979ccf4590 Use lexists() instead of exists() where appropriate 2010-09-20 21:46:56 +02:00
Patrick Mezard
21f3e10fb9 patch: do not overwrite broken untracked symlinks 2010-09-20 21:42:11 +02:00
Patrick Mezard
2d21e62e9b patch: fix target when patching broken symlinks (issue2368) 2010-09-20 21:42:11 +02:00
Martin Geisler
5f46f16fb7 Lowercase error messages 2010-08-29 22:37:58 +02:00
Patrick Mezard
614db673f4 Merge with stable 2010-09-20 22:29:13 +02:00
Martin Geisler
112ea7d5ed patch: break import cycle with cmdutil
The patch module imported cmdutil but used it only in updatedir.
2010-09-13 13:08:09 +02:00
Martin Geisler
e9c2a20771 diff: recurse into subrepositories with --subrepos/-S flag 2010-09-03 12:58:51 +02:00
Martin Geisler
c27c54faec clone, patch, convert: use hex(nullid) instead of '0'*40 2010-09-02 12:08:13 +02:00
Martin Geisler
cb36142754 Merge with stable 2010-08-29 22:55:37 +02:00
Martin Geisler
bfea979db3 util: remove lexists, Python 2.4 introduced os.path.lexists 2010-08-25 16:23:32 +02:00
Martin Geisler
d396293ec7 patch: fix typo in comment 2010-08-12 17:58:03 +02:00
Dan Drake
32aaa61ef2 patch: fix extract() docstring, it returns branch as well 2010-07-22 14:30:27 +09:00
FUJIWARA Katsunori
2f9dbb12f7 i18n: use encoding.colwidth() for correct column width
Some encoding and language combinations (e.g.: UTF-8 and Japanese)
cause encoding characters into sequence of bytes more than column
width of them.

So, encoding.colwidth() should be applied instread of len() on i18n
strings.

In addition to it, formatting by '%*s'/'%-*s' also uses "number of
bytes" to calculate space padding size, and should be fixed, too.
2010-07-18 01:06:50 +09:00
Dirkjan Ochtman
56aef99b57 patch: inline small, single-use 'write' function 2010-06-17 15:51:27 +02:00
Dirkjan Ochtman
12058a3e8e patch: inline small, single-use 'close' function 2010-06-17 15:50:35 +02:00
Dirkjan Ochtman
af6b696f0f move working dir/dirstate methods from localrepo to workingctx 2010-06-07 20:03:32 +02:00
Mads Kiilerich
865bdae0fa patch: strip paths in leaked git patchmeta objects 2010-04-26 13:21:03 +02:00
Mads Kiilerich
345145e804 patch: minor cleanup of _applydiff 2010-04-26 13:21:03 +02:00
Mads Kiilerich
63938a51f6 patch: git delete mode shouldn't be used at all 2010-04-26 13:21:02 +02:00
Mads Kiilerich
9f2ca1164a patch: make "unable to strip away" message less confusing 2010-04-26 13:21:02 +02:00
Mads Kiilerich
10fedd8d3d patch: descriptive patchmeta.__repr__ to help debugging 2010-04-26 13:21:02 +02:00
Augie Fackler
2556500e58 patch: refactor applydiff to allow for mempatching 2010-04-17 13:23:24 -05:00
Augie Fackler
4da02e74e7 patch: move mercurial-specific imports after stdlib imports 2010-04-17 13:13:57 -05:00
Nicolas Dumazet
7f1a963829 pylint, pyflakes: remove unused or duplicate imports 2010-04-14 17:58:10 +09:00
Brendan Cully
76b7a3a26b Merge with stable 2010-04-11 20:59:55 -07:00
Peter Arrenbrecht
7abe6f6609 patch: don't look for headers in diff lines
If you have a diff line that matches a header line, the patch splitter
currently breaks your patch at this line. For example a line like:

  +key: value

This can lead to "malformed patch" exceptions. Now fixed.
2010-04-09 20:34:05 +02:00
Brodie Rao
e504a56477 diff: make use of output labeling 2010-04-02 15:22:06 -05:00
Benoit Boissinot
6173388ed6 patch: warn when the internal patcher fails
hopefully we'll soon fix the remaining failures from the internal patcher, and
not use the external one anymore.
2010-03-22 11:08:42 +01:00
Matt Mackall
092c3572fb Merge with stable 2010-03-20 16:57:24 -05:00
Matt Mackall
453a04eaaf Merge with stable 2010-03-20 10:01:56 -05:00
Benoit Boissinot
879a4a71db patch: more precise NoHunk, raised for every file (issue2102) 2010-03-20 14:47:05 +01:00
Benoit Boissinot
6ed4471107 patch: differentiate start of file with diff --git vs '--- ' 2010-03-20 21:16:22 +01:00
Benoit Boissinot
f5bfcde5cb patch: try harder to find the file to patch on file creation (issue2041)
accept the following patch header:
first line:  foo/a.orig
second line: foo/a
2010-03-19 22:52:38 +01:00
Matt Mackall
ef87d8630d Merge with stable 2010-03-19 16:05:16 -05:00
Benoit Boissinot
223c085b2b patch: second line of a context diff starts with '--- ', not '+++ ' 2010-03-19 12:45:39 +01:00
Benoit Boissinot
0ad95ca3aa patch: enhance diff detection regexp, allow '--- ' in patch message 2010-03-18 18:22:34 +01:00