[PATCH] patch: add support for git delta hunks

Kevin Bullock kbullock+mercurial at ringworld.org
Wed Nov 27 10:05:42 CST 2013


On Nov 27, 2013, at 9:41 AM, Nicolas Vigier <boklm at mars-attacks.org> wrote:

> # HG changeset patch
> # User Nicolas Vigier <boklm at mars-attacks.org>
> # Date 1385424419 -3600
> # Node ID 385cae3ef172c23432045bbf8b5994df54215167
> # Parent  1c46b18b0e1c47fa4cecf21b78c083a54ae9903f
> patch: add support for git delta hunks

Thanks for the patch! This looks quite promising. It wants a test though. Further comments inline below.

(When resending a patch, consider using the --flag option to patchbomb. Usual practice here is --flag V2, V3, etc.)

> diff -r 1c46b18b0e1c -r 385cae3ef172 mercurial/patch.py
> --- a/mercurial/patch.py	Fri Nov 22 17:26:58 2013 -0600
> +++ b/mercurial/patch.py	Tue Nov 26 01:06:59 2013 +0100
[...]
> @@ -1026,8 +1028,11 @@
>     def complete(self):
>         return self.text is not None
> 
> -    def new(self):
> -        return [self.text]
> +    def new(self, lines):
> +        if self.delta:
> +            return [applybindelta(self.text, ''.join(lines))]
> +        else:
> +            return [self.text]

The 'else:' is unnecessary here, and we usually leave it out.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list