emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VC and Tramp


From: Kai Großjohann
Subject: Re: VC and Tramp
Date: 13 Nov 2000 18:06:07 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.0.90

On 13 Nov 2000, Andre Spiegel wrote:

> The problem is that while most of VC's code works fine with tramp,
> there are a few small things that don't, in particular relating to
> vc-do-command.  Kai asked me whether we should add support for tramp
> via a separate backend, e.g. vc-rcs-tramp.el, which would have to
> duplicate a lot of code from vc-rcs.el (and then do that again for
> vc-sccs.el and vc-cvs.el), or whether vc-do-command should be
> extended to handle the problematic cases.
> 
> I strongly favor the latter.  And since tramp is now an integral
> part of Emacs (it is, isn't it?), I even wonder whether it needs to
> be done via the general file-name-handler mechanism, or whether some
> hard-coded solution in vc-do-command wouldn't be even better.

There are a (small) number of issues.  Let's talk about vc-do-command
first.  It uses call-process to start the external program.
call-process doesn't grok remote files and so it doesn't work
remotely.

* The modify-vc-do-command approach.

** One alternative is to use shell-command instead, it decides based
on default-directory which filename handler to invoke.

** Another alternative is to enhance call-process so that it works
remotely.  But then it is not clear how should call-process find out
which filename handler to invoke?  (We could define that it does this
based on default-directory, but I'm not sure that this is a clean
solution.)  Richard didn't like this idea.

** Therefore, Richard proposed a new function process-file which
receives a file name, a command, and command-line arguments as
parameters, and then uses the file name to determine the filename
handler to invoke.

** Another idea would be to make vc-do-command a filename handler
operation.


* The vc-{rcs,sccs,cvs}-tramp.el approach.

** It should be fairly simple to copy vc-do-command and replace the
call-process command such that it does the right thing for Tramp.
Then all functions in vc-rcs.el need to be copied to use the modified
vc-do-command instead.  Alas, most of the functions in vc-rcs.el call
vc-do-command, so this leads to a lot of code duplication.


I like Richard's suggestion best because I think there are a number of
other places where a process-file function could be meaningfully used,
and with his suggestion, all of them would inherit the remote
functionality.  That'd be nifty.


The new VC does some things in the background -- vc-do-command
provides an option for this.  I haven't thought about running things
in the background, yet.  I'd like to extend Tramp such that it
provides background commands, but that is not easy to do.  It might be
very fragile, too.  Therefore, I wish it was possible to make do
without asynchronous commands in vc-do-command.  I'm not sure what
needs to be done such that VC can deal with this situation, where it
asks for an async command but doesn't get one.  André?


In the short run, it doesn't make sense to look for a real solution,
I'm going to kluge it for Tramp like I did it before: I advised
vc-do-command to run a slightly changed version for Tramp.  After all,
I'd like Tramp to work for Emacs 20 and XEmacs, too.


I think the other issues can be discussed separately from the ones
described in this messages.  Here's a short summary, I hope you can
see whether or not they can indeed be discussed separately:

- vc-workfile-unchanged-p relies on file modification times.  For some
  files, Tramp is able to determine the file modification time, for
  others, it isn't.  For the time being, I have advised
  vc-workfile-unchanged-p to always invoke vc-backend-diff for Tramp
  files.

- vc-checkout has changed a lot, I don't grok the new version.  Not
  sure what needs to be done here.  But it invokes file modtimes, so
  the same issue as for vc-workfile-unchanged-p might arise.

- vc-user-login-name expects a uid and returns a user name, but the
  uid-to-username mapping might be different for remote files.  But VC
  wouldn't need to map numbers to names at all, if file-attributes
  would return the user name rather than the number!  (This was true
  for the old VC, didn't check for the new VC.)  Idea 1: augment
  file-attributes such that it returns user and group names in
  addition to numbers, the use the names in VC.  Idea 2: add a `file'
  argument to vc-user-login-name so that the filename handler
  machinery can find out which number-to-name mapping to use.


I'm embarrassed that I didn't have enough time to work on Tramp for
Emacs 21 (it still doesn't work), so it is now much too late to
include Tramp in Emacs 21.1.  Sorry.

kai
-- 
The arms should be held in a natural and unaffected way and never
be conspicuous. -- Revised Technique of Latin American Dancing



reply via email to

[Prev in Thread] Current Thread [Next in Thread]