summaryrefslogtreecommitdiff
path: root/lisp/vc/vc-bzr.el
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2014-11-14 09:05:02 +0100
committerUlrich Müller <ulm@gentoo.org>2015-01-17 10:56:45 +0100
commit6a6bb820d08368f9754bae73c9507c6fc36d1dca (patch)
tree25d06758c067550e8b351cfd96b2497645d877e3 /lisp/vc/vc-bzr.el
parentd48c98cda83d2c74981c61a0b9d9b379c46217f4 (diff)
downloademacs-6a6bb820d08368f9754bae73c9507c6fc36d1dca.tar.gz
Discard the Bazaar case in repository version detection
* version.el (emacs-bzr-version-dirstate, emacs-bzr-version-bzr): Remove. (emacs-repository-get-version): Discard the Bazaar case. * vc/vc-bzr.el (vc-bzr-version-dirstate): Rename from emacs-bzr-version-dirstate and move from version.el to here. (vc-bzr-working-revision): Use it.
Diffstat (limited to 'lisp/vc/vc-bzr.el')
-rw-r--r--lisp/vc/vc-bzr.el20
1 files changed, 18 insertions, 2 deletions
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 163df1fdb5e..94574fdec62 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -493,6 +493,22 @@ in the branch repository (or whose status not be determined)."
(add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t)
(message "There are unresolved conflicts in this file")))
+(defun vc-bzr-workfile-unchanged-p (file)
+ (eq 'unchanged (car (vc-bzr-status file))))
+
+(defun vc-bzr-version-dirstate (dir)
+ "Try to return as a string the bzr revision ID of directory DIR.
+This uses the dirstate file's parent revision entry.
+Returns nil if unable to find this information."
+ (let ((file (expand-file-name ".bzr/checkout/dirstate" dir)))
+ (when (file-readable-p file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (and (looking-at "#bazaar dirstate flat format 3")
+ (forward-line 3)
+ (looking-at "[0-9]+\0\\([^\0\n]+\\)\0")
+ (match-string 1))))))
+
(defun vc-bzr-working-revision (file)
(let* ((rootdir (vc-bzr-root file))
(branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
@@ -538,8 +554,8 @@ in the branch repository (or whose status not be determined)."
;; files exist.
(and (file-exists-p branch-format-file)
(file-exists-p lastrev-file)
- (equal (emacs-bzr-version-dirstate l-c-parent-dir)
- (emacs-bzr-version-dirstate rootdir))))))
+ (equal (vc-bzr-version-dirstate l-c-parent-dir)
+ (vc-bzr-version-dirstate rootdir))))))
t)))
(with-temp-buffer
(insert-file-contents branch-format-file)