* vc-bzr sha1sum dependency
@ 2009-04-21 17:26 Mike Mattie
2009-04-21 20:24 ` Leo
2009-04-23 21:04 ` Thien-Thi Nguyen
0 siblings, 2 replies; 3+ messages in thread
From: Mike Mattie @ 2009-04-21 17:26 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 1904 bytes --]
I was recently bit by the fact that vc-bzr uses sha1sum, and external program
to compute the state of a file in vc-bzr-state-heuristic.
This depedency is suprising and buried rather deep. I looked at the code in question
and discovered that vc-bzr is picking apart an internal bzr file to find the state
of a file, bypassing the now expensive call to bzr status.
When the sha1sum program is not found a signal is thrown in a vc find-file hook.
This interruption produces a error message, but also causes the buffer to not appear.
The buffer has been created actually, but the switch to the buffer is not reached due
to the signal. Even worse if you do find the buffer then the vc mode line updates
produce regular errors, and even saving a file was difficult.
On digging a bit further I also realized that the [backend]-state-heuristic is a part
of the vc API, and it looks to me like it is scoped to implement work-arounds for
"stay local" like functionality for revision control systems that do not support
offline as well.
I wrote a quick fix for vc-bzr, and I have included that patch. It is
however a band-aid solution. It creates a new vc-bzr-state-heuristic function
that switches between the "fast"/heuristic and "slow"/status paths.
After some more thought this sort of a fix might belong in the middle
layer: vc-hooks. If the error trap and code path switch is
implemented there the backend heuristic functions would have a
real error path, which is needed assuming that they are assumed brittle by
their design role.
Another and possibly parallel solution is to merge a C implementation of sha1
into Emacs itself, which is probably a good idea as well.
Your thoughts are appreciated, and I am willing to reform the patch as necessary,
inclusive of the feedback from the list.
--
GnuPG Key: B9012279 is available from HKP server pgp.mit.edu
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: vc-bzr sha1sum dependency
2009-04-21 17:26 vc-bzr sha1sum dependency Mike Mattie
@ 2009-04-21 20:24 ` Leo
2009-04-23 21:04 ` Thien-Thi Nguyen
1 sibling, 0 replies; 3+ messages in thread
From: Leo @ 2009-04-21 20:24 UTC (permalink / raw)
To: emacs-devel
On 2009-04-21 18:26 +0100, Mike Mattie wrote:
> I was recently bit by the fact that vc-bzr uses sha1sum, and external program
> to compute the state of a file in vc-bzr-state-heuristic.
>
> This depedency is suprising and buried rather deep. I looked at the code in question
> and discovered that vc-bzr is picking apart an internal bzr file to find the state
> of a file, bypassing the now expensive call to bzr status.
I used to use the following code but I no longer use bzr or windows.
;;; re-define vc-bzr-sha1 to work in windows
(require 'vc-bzr)
(defun vc-bzr-sha1 (file)
(let ((sha1-use-external nil))
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents file)
(sha1-region (point-min) (point-max)))))
Best wishes,
--
.: Leo :. [ sdl.web AT gmail.com ] .: I use Emacs :.
www.git-scm.com
git - the one true version control system
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: vc-bzr sha1sum dependency
2009-04-21 17:26 vc-bzr sha1sum dependency Mike Mattie
2009-04-21 20:24 ` Leo
@ 2009-04-23 21:04 ` Thien-Thi Nguyen
1 sibling, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2009-04-23 21:04 UTC (permalink / raw)
To: Mike Mattie; +Cc: emacs-devel
() Mike Mattie <codermattie@gmail.com>
() Tue, 21 Apr 2009 10:26:04 -0700
Your thoughts are appreciated, and I am willing to reform the
patch as necessary, inclusive of the feedback from the list.
I think it would be cool to use gnulib for SHA1, MD4, MD5, etc.
thi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-23 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-21 17:26 vc-bzr sha1sum dependency Mike Mattie
2009-04-21 20:24 ` Leo
2009-04-23 21:04 ` Thien-Thi Nguyen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).