all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Harsanyi <alexharsanyi@gmail.com>
To: emacs-devel@gnu.org
Subject: vc-hg-rename-file does not expand the file name arguments
Date: Tue, 26 Jan 2010 11:58:09 +0800	[thread overview]
Message-ID: <cf628bc61001251958t57ca214erfe5798761dcc7e51@mail.gmail.com> (raw)

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.




             reply	other threads:[~2010-01-26  3:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26  3:58 Alex Harsanyi [this message]
2010-01-26  6:24 ` vc-hg-rename-file does not expand the file name arguments Dan Nicolaescu
2012-12-28 15:10 ` Jürgen A. Erhard
2012-12-28 19:37   ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf628bc61001251958t57ca214erfe5798761dcc7e51@mail.gmail.com \
    --to=alexharsanyi@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.