Re: ECB + mercurial
"Berndl, Klaus" <[email protected]> Tue, 23 Feb 2010 14:10:19 +0100
| Newsgroups | gmane.emacs.code-browser |
|---|---|
| Message-ID | <7697A57B1AD9104F993CDF6A5B69430C09225D84B2@CORPMAIL08.corp.capgemini.com> |
Hi,
ECB supperts out of the box all backends supported by VC.
The only thing to do is writing a backend-function and adding it to
the option `ecb-vc-supported-backends'.
Let's go:
below you will find the implementation of BZR and GIT:
You see that with git there is the same problem - see the docstring of
ecb-vc-dir-managed-by-GIT...
It should be easy to adaprt this for Mercurial...for example like follows:
(defun ecb-vc-dir-managed-by-HG (directory)
"Return 'HG if DIRECTORY is managed by Mercurial nil if not.
Because with Mercurial only the top-most directory of a source-tree has a subdir
.hg this function tries recursively upwards if there is a .hg-subdir."
;; With XEmacs we must first load the vc-hooks which contain the function
;; `vc-find-root'
(when ecb-running-xemacs
(ignore-errors (vc-load-vc-hooks)))
(and (locate-library "vc-hg")
(fboundp 'vc-find-root)
(vc-find-root directory ".hg")
(require 'vc)
(require 'vc-hg)
'HG))
The only thing to do for activating this is adding
(ecb-vc-dir-managed-by-HG . ecb-vc-state)
to the option ecb-vc-supported-backends.
Please tell me if this works then i will add it to the default value of
the option `ecb-vc-supported-backends'.
Thanks for pointing out.
Regards
Klaus
(defun ecb-vc-dir-managed-by-BZR (directory)
"Return 'BZR if DIRECTORY is managed by Bazaar. nil if not."
(and (locate-library "vc-bzr")
(ecb-file-exists-p (concat directory "/" ".bzr"))
(require 'vc)
(require 'vc-bzr)
'BZR))
;; Git support
(defun ecb-vc-dir-managed-by-GIT (directory)
"Return 'GIT if DIRECTORY is managed by Git. nil if not.
Because with Git only the top-most directory of a source-tree has a subdir
.git this function tries recursively upwards if there is a .git-subdir."
;; With XEmacs we must first load the vc-hooks which contain the function
;; `vc-find-root'
(when ecb-running-xemacs
(ignore-errors (vc-load-vc-hooks)))
(and (locate-library "vc-git")
(fboundp 'vc-find-root)
(vc-find-root directory ".git")
(require 'vc)
(require 'vc-git)
'GIT))
;; an own implementation for Git...
;; (defun ecb-vc-dir-managed-by-GIT (directory)
;; (let* ((sourcedir (ecb-fix-filename (file-truename directory)))
;; (gitdir (concat sourcedir "/.git/")))
;; (if (and (ecb-file-exists-p gitdir)
;; (locate-library "vc-git"))
;; 'GIT
;; (if (equal sourcedir (ecb-fix-filename "/"))
;; nil
;; (ecb-vc-dir-managed-by-GIT (concat sourcedir "/../"))))))
;;(ecb-vc-dir-managed-by-GIT default-directory)
________________________________
Von: Francesc Rocher [mailto:[email protected]]
Gesendet: Dienstag, 23. Februar 2010 13:32
An: ECB-list
Betreff: [ECB-list] ECB + mercurial
Hello all,
[ I'm sorry if this question has been asked before ]
Does anyone has integrated mercurial into ECB using 'ecb-vc-* functions?
I tried, but with poorly or cpu-consuming results. I use Emacs 23.1.92 (23.2 in the
near future) with its CEDET implementation and the latest ECB CVS-version (2.40).
First try, quite similar to other `ecb-vc-dir-managed-by-*' functions:
---8<---
(defun ecb-vc-dir-managed-by-HG (directory)
"Return 'HG if DIRECTORY is managed by mercurial, nil if not."
(and (locate-library "vc-hg")
(ecb-file-exists-p (concat directory "/" ".hg"))
(require 'vc)
(require 'vc-hg)
'HG))
---8<---
Problem: it does not work in subdirectories, just in the root one.
".hg" directory exists only in the root dir, the same as ".bzr", so I don't understand why it doesn't works.
I don't use bazaar very often, so the question is: vc-bzr backend works fine under ECB?
Second try
---8<---
(defun ecb-vc-dir-managed-by-HG (directory)
"Return 'HG if DIRECTORY is managed by mercurial, nil if not."
(when (= (shell-command
(concat "cd '" directory "' && hg root") nil nil) 0)
'HG))
---8<---
Ok, that works in all subdirectories.
Both solutions consume a lot of cpu when emacs is idle and there are several
files opened. Is this because EBC or CEDET is working in background?
Are there better solutions?
Will mercurial be supported in future ECB releases?
Thanks,
--
Francesc Rocher
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Ecb-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecb-list