]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/vc-bzr.el
Merge from origin/emacs-24
[gnu-emacs] / lisp / vc / vc-bzr.el
index 48476dc96543a6f8269059e40e5c2c0eb2da2b29..96d6d1da48c34280622ac4fa1dbd7705aac78f36 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-bzr.el --- VC backend for the bzr revision control system  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2014 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2015 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;;        Riccardo Murri <riccardo.murri@gmail.com>
@@ -493,6 +493,19 @@ 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-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 +551,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)
@@ -596,18 +609,6 @@ in the branch repository (or whose status not be determined)."
 The criterion is that there is a `.bzr' directory in the same
 or a superior directory.")
 
-(defun vc-bzr-could-register (file)
-  "Return non-nil if FILE could be registered under bzr."
-  (and (vc-bzr-responsible-p file)      ; shortcut
-       (condition-case ()
-           (with-temp-buffer
-             (vc-bzr-command "add" t 0 file "--dry-run")
-             ;; The command succeeds with no output if file is
-             ;; registered (in bzr 0.8).
-             (goto-char (point-min))
-             (looking-at "added "))
-         (error))))
-
 (defun vc-bzr-unregister (file)
   "Unregister FILE from bzr."
   (vc-bzr-command "remove" nil 0 file "--keep"))
@@ -779,7 +780,7 @@ If LIMIT is non-nil, show no more than this many entries."
 
 (autoload 'vc-switches "vc")
 
-(defun vc-bzr-diff (files &optional async rev1 rev2 buffer)
+(defun vc-bzr-diff (files &optional rev1 rev2 buffer async)
   "VC bzr backend for diff."
   (let* ((switches (vc-switches 'bzr 'diff))
          (args
@@ -979,9 +980,9 @@ stream.  Standard error output is discarded."
         (forward-line))
       (funcall update-function result)))
 
-(defun vc-bzr-dir-status (dir update-function)
+(defun vc-bzr-dir-status-files (dir files update-function)
   "Return a list of conses (file . state) for DIR."
-  (vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S")
+  (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files)
   (vc-run-delayed
    (vc-bzr-after-dir-status update-function
                             ;; "bzr status" results are relative to
@@ -993,13 +994,6 @@ stream.  Standard error output is discarded."
                             ;; frob the results accordingly.
                             (file-relative-name dir (vc-bzr-root dir)))))
 
-(defun vc-bzr-dir-status-files (dir files _default-state update-function)
-  "Return a list of conses (file . state) for DIR."
-  (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files)
-  (vc-run-delayed
-   (vc-bzr-after-dir-status update-function
-                            (file-relative-name dir (vc-bzr-root dir)))))
-
 (defvar vc-bzr-shelve-map
   (let ((map (make-sparse-keymap)))
     ;; Turn off vc-dir marking