From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: vc-hg-rename-file does not expand the file name arguments Date: Mon, 25 Jan 2010 22:24:51 -0800 (PST) Message-ID: <201001260624.o0Q6Oppj017777@godzilla.ics.uci.edu> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1264487213 29297 80.91.229.12 (26 Jan 2010 06:26:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Jan 2010 06:26:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alex Harsanyi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 26 07:26:45 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NZesv-0005bu-2v for ged-emacs-devel@m.gmane.org; Tue, 26 Jan 2010 07:26:45 +0100 Original-Received: from localhost ([127.0.0.1]:37001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZesv-0007Cf-RZ for ged-emacs-devel@m.gmane.org; Tue, 26 Jan 2010 01:26:45 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZesn-0007CA-PU for emacs-devel@gnu.org; Tue, 26 Jan 2010 01:26:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZesh-00079A-Vy for emacs-devel@gnu.org; Tue, 26 Jan 2010 01:26:36 -0500 Original-Received: from [199.232.76.173] (port=46203 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZesh-000790-Ge for emacs-devel@gnu.org; Tue, 26 Jan 2010 01:26:31 -0500 Original-Received: from colin-baker-v0.ics.uci.edu ([128.195.1.153]:55397) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NZesg-0005Kt-U8 for emacs-devel@gnu.org; Tue, 26 Jan 2010 01:26:31 -0500 Original-Received: from godzilla.ics.uci.edu (godzilla.ics.uci.edu [128.195.10.101]) by colin-baker-v0.ics.uci.edu (8.13.8/8.13.8) with ESMTP id o0Q6Opm1005489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 25 Jan 2010 22:24:51 -0800 Original-Received: (from dann@localhost) by godzilla.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id o0Q6Oppj017777; Mon, 25 Jan 2010 22:24:51 -0800 (PST) In-Reply-To: (Alex Harsanyi's message of "Tue, 26 Jan 2010 11:58:09 +0800") Original-Lines: 38 X-ICS-MailScanner-Information: Please send mail to helpdesk@ics.uci.edu or more information X-ICS-MailScanner-ID: o0Q6Opm1005489 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-1.363, required 5, autolearn=disabled, ALL_TRUSTED -1.44, TW_BZ 0.08) X-ICS-MailScanner-From: dann@godzilla.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:120419 Archived-At: Alex Harsanyi 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.