all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* epatch for multifile patches
@ 2017-03-08 11:57 Arseny Sher
  0 siblings, 0 replies; 4+ messages in thread
From: Arseny Sher @ 2017-03-08 11:57 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I am having trouble using epatch while applying multifile patches.
Consider the following simple example:

ars@ars-thinkpad ~/tmp $ mkdir -p old/src
ars@ars-thinkpad ~/tmp $ echo "void main() { }" > old/src/hello.c
ars@ars-thinkpad ~/tmp $ mkdir -p new/src
ars@ars-thinkpad ~/tmp $ echo "int main() { return 0; }" > new/src/hello.c
ars@ars-thinkpad ~/tmp $ diff -cr old/ new/ > tmp.patch
ars@ars-thinkpad ~/tmp $ cat tmp.patch
diff -cr old/src/hello.c new/src/hello.c
*** old/src/hello.c	2017-03-08 14:29:24.743846995 +0300
--- new/src/hello.c	2017-03-08 14:29:32.399846824 +0300
***************
*** 1 ****
! void main() { }
--- 1 ----
! int main() { return 0; }


Now I start emacs and do M-x epatch. First of all, it asks me for
patch buffer or file, I point to '~/tmp/tmp.patch'. Then it asks for
directory to patch, I say '~/tmp/old' and ediff complains

Ediff has inferred that
	/home/ars/tmp/old/hello.c
is assumed to be the target for this patch.  However, this file does not exist.

Please enter an alternative patch target ...


because it ignores the path ('src' directory in this case) to the file.
Ediff manual says: "Ediff can recognize multi-file patches only if they
are in the context format or GNU unified format. All other patches are
treated as 1-file patches. Ediff is [hopefully] using the same algorithm
as patch to determine which files need to be patched." So, if I
understood it correctly, this should work. Is it a bug or what?

I tried it on GNU Emacs versions 25.1, 25.2 RC2 and daily build
26.0.50.2, the result is the same.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* epatch for multifile patches
@ 2017-03-08 13:34 Arseny Sher
  2017-03-08 14:35 ` Arseny Sher
  2017-03-08 14:58 ` Michael Heerdegen
  0 siblings, 2 replies; 4+ messages in thread
From: Arseny Sher @ 2017-03-08 13:34 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I am having trouble using epatch while applying multifile patches.
Consider the following simple example:

ars@ars-thinkpad ~/tmp $ mkdir -p old/src
ars@ars-thinkpad ~/tmp $ echo "void main() { }" > old/src/hello.c
ars@ars-thinkpad ~/tmp $ mkdir -p new/src
ars@ars-thinkpad ~/tmp $ echo "int main() { return 0; }" > new/src/hello.c
ars@ars-thinkpad ~/tmp $ diff -cr old/ new/ > tmp.patch
ars@ars-thinkpad ~/tmp $ cat tmp.patch
diff -cr old/src/hello.c new/src/hello.c
*** old/src/hello.c	2017-03-08 14:29:24.743846995 +0300
--- new/src/hello.c	2017-03-08 14:29:32.399846824 +0300
***************
*** 1 ****
! void main() { }
--- 1 ----
! int main() { return 0; }


Now I start emacs and do M-x epatch. First of all, it asks me for
patch buffer or file, I point to '~/tmp/tmp.patch'. Then it asks for
directory to patch, I say '~/tmp/old' and ediff complains

Ediff has inferred that
	/home/ars/tmp/old/hello.c
is assumed to be the target for this patch.  However, this file does not exist.

Please enter an alternative patch target ...


because it ignores the path ('src' directory in this case) to the file.
Ediff manual says: "Ediff can recognize multi-file patches only if they
are in the context format or GNU unified format. All other patches are
treated as 1-file patches. Ediff is [hopefully] using the same algorithm
as patch to determine which files need to be patched." So, if I
understood it correctly, this should work. Is it a bug or what?

I tried it on GNU Emacs versions 25.1, 25.2 RC2 and daily build
26.0.50.2, the result is the same.

I use GNU/Linux, Ubuntu 14.04.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: epatch for multifile patches
  2017-03-08 13:34 epatch for multifile patches Arseny Sher
@ 2017-03-08 14:35 ` Arseny Sher
  2017-03-08 14:58 ` Michael Heerdegen
  1 sibling, 0 replies; 4+ messages in thread
From: Arseny Sher @ 2017-03-08 14:35 UTC (permalink / raw)
  To: help-gnu-emacs

Sorry for duplicating mails, they weren't delivered for dozens of minutes
and I thought something went wrong...I am new to mailing lists.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: epatch for multifile patches
  2017-03-08 13:34 epatch for multifile patches Arseny Sher
  2017-03-08 14:35 ` Arseny Sher
@ 2017-03-08 14:58 ` Michael Heerdegen
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Heerdegen @ 2017-03-08 14:58 UTC (permalink / raw)
  To: Arseny Sher; +Cc: help-gnu-emacs

Arseny Sher <sher-ars@yandex.ru> writes:

> Hello,
>
> I am having trouble using epatch while applying multifile patches.
> Consider the following simple example:
>
> ars@ars-thinkpad ~/tmp $ mkdir -p old/src
> ars@ars-thinkpad ~/tmp $ echo "void main() { }" > old/src/hello.c
> ars@ars-thinkpad ~/tmp $ mkdir -p new/src
> ars@ars-thinkpad ~/tmp $ echo "int main() { return 0; }" >
> new/src/hello.c
> ars@ars-thinkpad ~/tmp $ diff -cr old/ new/ > tmp.patch
> ars@ars-thinkpad ~/tmp $ cat tmp.patch
> diff -cr old/src/hello.c new/src/hello.c
> *** old/src/hello.c	2017-03-08 14:29:24.743846995 +0300
> --- new/src/hello.c	2017-03-08 14:29:32.399846824 +0300
> ***************
> *** 1 ****
> ! void main() { }
> --- 1 ----
> ! int main() { return 0; }
>
>
> Now I start emacs and do M-x epatch. First of all, it asks me for
> patch buffer or file, I point to '~/tmp/tmp.patch'. Then it asks for
> directory to patch, I say '~/tmp/old' and ediff complains
>
> Ediff has inferred that
> 	/home/ars/tmp/old/hello.c
> is assumed to be the target for this patch.  However, this file does
> not exist.
>
> Please enter an alternative patch target ...
>
>
> because it ignores the path ('src' directory in this case) to the file.
> Ediff manual says: "Ediff can recognize multi-file patches only if they
> are in the context format or GNU unified format. All other patches are
> treated as 1-file patches. Ediff is [hopefully] using the same algorithm
> as patch to determine which files need to be patched." So, if I
> understood it correctly, this should work. Is it a bug or what?

I asked a similar question some time ago on emacs-dev.  My impression
was that nobody is actually really using this...

The behavior doesn't make sense, so it is a bug.  It should not be hard
to fix for someone knowing the code.  I stepped through the code with
edebug, everything is there, just the file paths are treated in a way
which is not correct in such cases.

If there is no related bug report yet, maybe you can create one (I
didn't)?


Thanks,

Michael.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-08 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 13:34 epatch for multifile patches Arseny Sher
2017-03-08 14:35 ` Arseny Sher
2017-03-08 14:58 ` Michael Heerdegen
  -- strict thread matches above, loose matches on Subject: below --
2017-03-08 11:57 Arseny Sher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.