Commit Graph

69 Commits

Author SHA1 Message Date
Mads Kiilerich
35ef3c1409 mdiff: carriage return (\r) is also ignorable whitespace 2010-10-19 03:55:06 +02:00
Benoit Boissinot
0a73b8e369 mdiff.patch(): add a special case for when the base text is empty
remove the special casing from revlog.addgroup()
2010-08-23 13:28:04 +02:00
Benoit Boissinot
621e9c06bf remove header handling out of mdiff.bunidiff, rename it 2010-03-09 18:31:57 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Patrick Mezard
a9ef9386bc mq: preserve --git flag when merging patches
Without this, merging a patch queue without diff.git=1 downgrades all git
patches to regular patches, losing data in the process.
2010-01-01 19:53:05 +01:00
Patrick Mezard
2f3f5f28ea mdiff: fix diff -b/B/w on mixed whitespace hunks (issue127)
Previous code was computing hunks then checking if these hunks could be ignored
when taking whitespace/blank-lines options in accounts. This approach is simple
but fails with hunks containing both whitespace and non-whitespace changes, the
whole hunk is emitted while it can be mostly made of whitespace. The new
version normalize the whitespaces before hunk generation, and test for
blank-lines afterwards.
2009-11-11 18:31:42 +01:00
Martin Geisler
5b4e5428df replace "i in range(len(xs))" with "i, x in enumerate(xs)"
The remaining occurrences should be the ones where "xs" is mutated or
where "i" is used for index arithmetic.
2009-05-26 22:59:52 +02:00
Patrick Mezard
d6ce43b965 patch: support diff data loss detection and upgrade
In worst case, generating diff in upgrade mode can be two times more expensive
than generating it in git mode directly: we may have to regenerate the whole
diff again whenever a git feature is detected. Also, the first diff attempt is
completely buffered instead of being streamed. That said, even without having
profiled it yet, I am convinced we can fast-path the upgrade mode if necessary
were it to be used in regular diff commands, and not only in mq where avoiding
data loss is worth the price.
2010-01-01 20:54:05 +01:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Dirkjan Ochtman
9bf5b2380e diff: fix obscure off-by-one error in diff -p 2008-11-27 17:00:54 +01:00
Thomas Arendsen Hein
712c41183e Remove trailing space 2008-10-22 18:55:07 +02:00
Dirkjan Ochtman
7c9e09c95d patch/diff: use a separate function to write the first line of a file diff 2008-10-22 13:14:52 +02:00
Martin Geisler
d0e419c6a7 mdiff: compare content of binary files directly
A plain Python string comparison stops when the first mismatch is
found, whereas the call to md5 would need to compute the hash over the
entire string and only then do the comparison.
2008-08-09 02:10:22 +02:00
Dirkjan Ochtman
34d6bea8db python 2.6 compatibility: compatibility wrappers for hash functions 2008-04-04 22:36:40 +02:00
Patrick Mezard
8e0cbccd26 Let --unified default to diff.unified (issue 1076) 2008-04-04 22:15:14 +02:00
Matt Mackall
11423d02c7 diff: don't show function name by default
We'd mistakenly made the -p option always on, which meant there was no
way to turn it off. It also meant that we were sometimes splitting
multibyte characters in function name, which isn't a good default.
2008-01-16 11:14:24 -06:00
Dustin Sallings
bebcdac954 Use both the from and to name in mdiff.unidiff.
This fixes a compatibility issue with git diffs.
* * *
2007-11-01 12:17:59 -07:00
Matt Mackall
a92b40c2ed revlog: generate trivial deltas against null revision
To avoid extra memory usage and performance issues with large files,
generate a trivial delta header for deltas against the null revision
rather than calling the usual delta generator.

We append the delta header to meta rather than prepending it to data
to avoid a large allocate and copy.
2007-10-03 17:17:27 -05:00
Matt Mackall
6a7cb8cbaa diff: correctly handle combinations of whitespace options 2007-07-14 12:44:47 -05:00
Alexis S. L. Carvalho
e85eaa593d git patches: correct handling of filenames with spaces
Add a trailing TAB to the "--- filename" lines if there's a space
in the file name.  This allows patch(1) to work correctly.  The
same is done for diff --nodates.

This was originally suggested by Andrei Vermel, but at the time
I thought git was doing something different.
2007-06-22 19:06:04 -03:00
Alexis S. L. Carvalho
425cc6372f add mdiff.get_matching_blocks 2007-04-16 20:17:39 -03:00
Thomas Arendsen Hein
134efad44c merge with crew-stable 2007-02-20 20:55:23 +01:00
tailgunner@smtp.ru
5474a24e48 Don't lie that "binary file has changed"
Without -a option to "hg diff", mdiff.unidiff reported that "Binary
file foo has changed" without even trying to compare things. Now it
computes MD5 of old and new files, compares them and makes the conclusion.
2007-02-17 09:54:56 -02:00
Matt Mackall
f17a4e1934 Replace demandload with new demandimport 2006-12-13 13:27:09 -06:00
Stephen Darnell
a808384cf1 Add -D/--nodates options to hg diff/export that removes dates from diff headers
and replace uses of sed in the tests with --nodates.
2006-09-26 00:05:24 +01:00
Brendan Cully
619c7dab4b Remove dates from git export file lines - they confuse git-apply 2006-08-29 17:08:42 -07:00
Brendan Cully
c18265f47c Add diff --git option 2006-08-14 22:48:03 -07:00
Vadim Gelfer
13d751feaf refactor text diff/patch code.
rename commands.dodiff to patch.diff.
rename commands.doexport to patch.export.
move some functions from commands to new mercurial.cmdutil module.
turn list of diff options into mdiff.diffopts class.

patch.diff and patch.export now has clean api for call from 3rd party
python code.
2006-08-12 16:13:27 -07:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Haakon Riiser
7b06333d1a diff: add -b/-B options 2006-06-29 15:16:25 +02:00
Vadim Gelfer
9a0c813fdc use demandload more. 2006-06-20 23:58:21 -07:00
Vadim Gelfer
1de5bf52df fix speed regression in mdiff caused by line split bugfix. 2006-05-10 13:39:12 -07:00
Vadim Gelfer
c440466a54 fix diffs containing embedded "\r".
add test to make sure fix stays fixed.
2006-05-10 10:31:54 -07:00
mason@suse.com
492b52fda3 Fill in the uncompressed size during revlog.addgroup
This uses code from Matt to calculate the size change that
would result from applying a delta to keep an accurate running
total of the text size during revlog.addgroup
2006-04-04 16:38:44 -04:00
Thomas Arendsen Hein
ba28644c7c Fix diff against an empty file (issue124) and add a test for this. 2006-02-15 14:22:16 +01:00
mason@suse.com
7bc44b52d9 Add new bdiff based unidiff generation. 2006-01-24 15:02:10 +13:00
twaldmann@thinkmo.de
584aa09dd6 minor optimization: save some string trash 2005-11-14 02:30:19 +02:00
Matt Mackall
e2ec207d22 Remove now unused sortdiff and diff from mdiff 2005-10-25 22:17:31 -07:00
Matt Mackall
c155ce9cdc Clean up mdiff imports 2005-10-04 11:25:48 -07:00
Benoit Boissinot
e36bbe72ee make diff dates be epoch for add/remove 2005-10-04 11:21:48 -07:00
mpm@selenic.com
af3be1f6a1 Add automatic binary file detection to diff and export
Based on a patch by Fuming Wang

- add util.binary which decides whether a file is binary if it has any NUL
  characters in the first 1K.
- teach mdiff.unidiff to print "binary file <x> has changed" for binary files
- add text flag to cause unidiff and dodiff to treat all files as text
- add -a and --text flags (like diff(1)) to hg diff and export
- update docs
2005-08-23 19:58:46 -07:00
mpm@selenic.com
4394004b4a Remove all remaining print statements
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Remove all remaining print statements

Convert most prints to ui.warn or ui.write
Pass a write function into transactions

manifest hash: d1b0af7a344fc087a5acfe3ae87b782c20d043e0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCx1Q3ywK+sNU5EO8RAqSTAJwM5t/m+JOlf2ZXOjuItCSdFiubcwCdFm3G
HoicikSYpTgfCj2pIRfyLjo=
=Loqo
-----END PGP SIGNATURE-----
2005-07-02 18:57:59 -08:00
mpm@selenic.com
0fb5db6915 Whitespace cleanups
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whitespace cleanups

manifest hash: ac954bc3a4f034c12638a259ecd65841f5b63c5c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwuubywK+sNU5EO8RAluIAJ98XQpNdZUpSmYKgDmrMRlbL76ZzQCfes0t
rknNUN/PhtyA4bzL646dOz4=
=UyCE
-----END PGP SIGNATURE-----
2005-06-29 10:42:35 -08:00
mpm@selenic.com
d2615cc70c Start using bdiff for generating deltas
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Start using bdiff for generating deltas

manifest hash: bf6ed7d17d96810b7f40b50811b104b568c64b4b
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCubqVywK+sNU5EO8RAor6AKCm8Zqg0DIhLzaMPp5/GKPKk/GjKwCfbCe+
/CBmpvcTxSJofY9RE08cCVY=
=2yu2
-----END PGP SIGNATURE-----
2005-06-22 11:23:01 -08:00
Thomas Arendsen Hein
878eebd88e Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Changes from the original patch:
- - Use 'diff -r ...' instead of 'hg diff -r ...' to support filetype detection
  by at least file(1) and vim.
- - Adjusted tests for this change.
- - Some cleanups.

manifest hash: 5f37d1ef75ea7f4e48b53f02371053ba54fb70f8
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCsyZzW7P1GVgWeRoRAqczAJ479lR9Z289sP+VH5L+N7pQRU14SACfUueq
88ABloIR3VyRIa4qbujnZio=
=Vva9
-----END PGP SIGNATURE-----
2005-06-17 20:37:23 +01:00
mpm@selenic.com
923df46e46 Fix another sortdiff cornercase
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fix another sortdiff cornercase

manifest hash: 32b2d1750689c561c9471fb68a9f3571364399cb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCsL6AywK+sNU5EO8RAhaeAJ4zw18vo4oGTvymplKb7olKEeg0aQCfVxX1
2o/PcrE6EeboHpQn5E0Wb/Y=
=eENW
-----END PGP SIGNATURE-----
2005-06-15 15:49:20 -08:00
mpm@selenic.com
b51d9e3229 mdiff: fix the fix
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mdiff: fix the fix

I saw you check in the thing back in but with another typo.

You check in "la < lenb", should be "la < lena".

So we are even :-)

Chris


manifest hash: 57157502250b0120bcc12a75a530d4c133673b39
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCrg5tywK+sNU5EO8RAvLPAKCOs76LKPniKHFa15YwzWWsNZ5/xACfesl3
WCiUjdeYUtU3jVKCEwmjAT0=
=+GFy
-----END PGP SIGNATURE-----
2005-06-13 14:53:33 -08:00