* vc-hg-rename-file does not expand the file name arguments
@ 2010-01-26 3:58 Alex Harsanyi
2010-01-26 6:24 ` Dan Nicolaescu
2012-12-28 15:10 ` Jürgen A. Erhard
0 siblings, 2 replies; 4+ messages in thread
From: Alex Harsanyi @ 2010-01-26 3:58 UTC (permalink / raw)
To: emacs-devel
I believe there is a problem with the implementation of
`vc-hg-rename-file`, in the call: (vc-hg-command nil 0 new "mv" old),
only the NEW parameter will be expanded using `expand-file-name`,
because `vc-hg-command` treats it as a file. The OLD parameter is not
expanded because it is treated as a flag. The problem is that
`vc-rename-file` will read a file name from he minibuffer and pass in
a filename like "~/Projects/test-repo/file1.txt" to the function.
This name is passed directly to the "hg" executable which will fail
because the file does not exist (hg does not do file-name expansion
internally).
For example, create the following mercurial repository:
$ mkdir ~/test-repo
$ cd ~/test-repo
$ hg init .
$ echo Hello > ./file1.txt
$ hg add file1.txt
$ hg commit -m "File1 added"
Now, open file1.txt in Emacs, and try to rename it using "M-x
vc-rename-file". The rename will fail and the *vc* buffer will
contain:
~/test-repo/file1.txt: No such file or directory
abort: no files to copy
I believe the simplest fix is to call `expand-file-name` on the file
names before passing them to the "hg" command.
Based on the comment in the code, I think the same problem exists with
the bzr backend as well.
Cheers,
Alex.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vc-hg-rename-file does not expand the file name arguments
2010-01-26 3:58 vc-hg-rename-file does not expand the file name arguments Alex Harsanyi
@ 2010-01-26 6:24 ` Dan Nicolaescu
2012-12-28 15:10 ` Jürgen A. Erhard
1 sibling, 0 replies; 4+ messages in thread
From: Dan Nicolaescu @ 2010-01-26 6:24 UTC (permalink / raw)
To: Alex Harsanyi; +Cc: emacs-devel
Alex Harsanyi <alexharsanyi@gmail.com> writes:
> I believe there is a problem with the implementation of
> `vc-hg-rename-file`, in the call: (vc-hg-command nil 0 new "mv" old),
> only the NEW parameter will be expanded using `expand-file-name`,
> because `vc-hg-command` treats it as a file. The OLD parameter is not
> expanded because it is treated as a flag. The problem is that
> `vc-rename-file` will read a file name from he minibuffer and pass in
> a filename like "~/Projects/test-repo/file1.txt" to the function.
> This name is passed directly to the "hg" executable which will fail
> because the file does not exist (hg does not do file-name expansion
> internally).
>
> For example, create the following mercurial repository:
>
> $ mkdir ~/test-repo
> $ cd ~/test-repo
> $ hg init .
> $ echo Hello > ./file1.txt
> $ hg add file1.txt
> $ hg commit -m "File1 added"
>
> Now, open file1.txt in Emacs, and try to rename it using "M-x
> vc-rename-file". The rename will fail and the *vc* buffer will
> contain:
>
> ~/test-repo/file1.txt: No such file or directory
> abort: no files to copy
>
> I believe the simplest fix is to call `expand-file-name` on the file
> names before passing them to the "hg" command.
>
> Based on the comment in the code, I think the same problem exists with
> the bzr backend as well.
It would be better if vc-rename-file would do the name expansion so that
backends do not have to.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: vc-hg-rename-file does not expand the file name arguments
2010-01-26 3:58 vc-hg-rename-file does not expand the file name arguments Alex Harsanyi
2010-01-26 6:24 ` Dan Nicolaescu
@ 2012-12-28 15:10 ` Jürgen A. Erhard
2012-12-28 19:37 ` Glenn Morris
1 sibling, 1 reply; 4+ messages in thread
From: Jürgen A. Erhard @ 2012-12-28 15:10 UTC (permalink / raw)
To: emacs-devel
On Tue, Jan 26, 2010 at 11:58:09AM +0800, Alex Harsanyi wrote:
> I believe there is a problem with the implementation of
> `vc-hg-rename-file`, in the call: (vc-hg-command nil 0 new "mv" old),
> only the NEW parameter will be expanded using `expand-file-name`,
> because `vc-hg-command` treats it as a file. The OLD parameter is not
> expanded because it is treated as a flag. The problem is that
> `vc-rename-file` will read a file name from he minibuffer and pass in
> a filename like "~/Projects/test-repo/file1.txt" to the function.
> This name is passed directly to the "hg" executable which will fail
> because the file does not exist (hg does not do file-name expansion
> internally).
>
> For example, create the following mercurial repository:
>
> $ mkdir ~/test-repo
> $ cd ~/test-repo
> $ hg init .
> $ echo Hello > ./file1.txt
> $ hg add file1.txt
> $ hg commit -m "File1 added"
>
> Now, open file1.txt in Emacs, and try to rename it using "M-x
> vc-rename-file". The rename will fail and the *vc* buffer will
> contain:
>
> ~/test-repo/file1.txt: No such file or directory
> abort: no files to copy
>
> I believe the simplest fix is to call `expand-file-name` on the file
> names before passing them to the "hg" command.
>
> Based on the comment in the code, I think the same problem exists with
> the bzr backend as well.
Seems the bzr backend has been fixed. Since it's the main Emacs repo,
that's not surprising.
Bump to get a fix in.
Grits, J
PS: Sorry for that earlier direct reply, Alex.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-28 19:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-26 3:58 vc-hg-rename-file does not expand the file name arguments Alex Harsanyi
2010-01-26 6:24 ` Dan Nicolaescu
2012-12-28 15:10 ` Jürgen A. Erhard
2012-12-28 19:37 ` Glenn Morris
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.