Mercurial > emacs
annotate lisp/vc-bzr.el @ 93279:7e80f83265e8
*** empty log message ***
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Thu, 27 Mar 2008 07:28:24 +0000 |
parents | 9add13a0e597 |
children | 9e7b1b11aa5c |
rev | line source |
---|---|
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1 ;;; vc-bzr.el --- VC backend for the bzr revision control system |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
2 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
3 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
4 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
5 ;; Author: Dave Love <fx@gnu.org>, Riccardo Murri <riccardo.murri@gmail.com> |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
6 ;; Keywords: tools |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
7 ;; Created: Sept 2006 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
8 ;; Version: 2008-01-04 (Bzr revno 25) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; URL: http://launchpad.net/vc-bzr |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
10 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
11 ;; This file is free software; you can redistribute it and/or modify |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, or (at your option) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 ;; any later version. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
15 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
16 ;; This file is distributed in the hope that it will be useful, |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
79695
f62e87c6eb20
2008-01-05 Sven Joachim <svenjoac@gmx.de>
Romain Francoise <romain@orebokech.com>
parents:
79688
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
20 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;; Boston, MA 02110-1301, USA. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
25 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
26 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 ;;; Commentary: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
29 ;; See <URL:http://bazaar-vcs.org/> concerning bzr. See |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
30 ;; <URL:http://launchpad.net/vc-bzr> for alternate development |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
31 ;; branches of `vc-bzr'. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
33 ;; Load this library to register bzr support in VC. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 ;; Known bugs |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
36 ;; ========== |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
38 ;; When edititing a symlink and *both* the symlink and its target |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
39 ;; are bzr-versioned, `vc-bzr` presently runs `bzr status` on the |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
40 ;; symlink, thereby not detecting whether the actual contents |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 ;; (that is, the target contents) are changed. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
42 ;; See https://bugs.launchpad.net/vc-bzr/+bug/116607 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
44 ;; For an up-to-date list of bugs, please see: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
45 ;; https://bugs.launchpad.net/vc-bzr/+bugs |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
46 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 ;;; Code: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 (eval-when-compile |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 (require 'cl) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 (require 'vc)) ; for vc-exec-after |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 ;; Clear up the cache to force vc-call to check again and discover |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 ;; new functions when we reload this file. |
78404
27f00e50116a
Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents:
78387
diff
changeset
|
56 (put 'Bzr 'vc-functions nil) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 (defgroup vc-bzr nil |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 "VC bzr backend." |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
60 :version "22.2" |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
61 :group 'vc) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 (defcustom vc-bzr-program "bzr" |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
64 "Name of the bzr command (excluding any arguments)." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 :group 'vc-bzr |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 :type 'string) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (defcustom vc-bzr-diff-switches nil |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
69 "String/list of strings specifying extra switches for bzr diff under VC." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 :type '(choice (const :tag "None" nil) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 (string :tag "Argument String") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 (repeat :tag "Argument List" :value ("") string)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 :group 'vc-bzr) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
75 (defcustom vc-bzr-log-switches nil |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
76 "String/list of strings specifying extra switches for `bzr log' under VC." |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
77 :type '(choice (const :tag "None" nil) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
78 (string :tag "Argument String") |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
79 (repeat :tag "Argument List" :value ("") string)) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
80 :group 'vc-bzr) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
81 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
82 ;; since v0.9, bzr supports removing the progress indicators |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
83 ;; by setting environment variable BZR_PROGRESS_BAR to "none". |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 (defun vc-bzr-command (bzr-command buffer okstatus file-or-list &rest args) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
85 "Wrapper round `vc-do-command' using `vc-bzr-program' as COMMAND. |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
86 Invoke the bzr command adding `BZR_PROGRESS_BAR=none' and |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
87 `LC_MESSAGES=C' to the environment." |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
88 (let ((process-environment |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
89 (list* "BZR_PROGRESS_BAR=none" ; Suppress progress output (bzr >=0.9) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
90 "LC_MESSAGES=C" ; Force English output |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
91 process-environment))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
92 (apply 'vc-do-command buffer okstatus vc-bzr-program |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
93 file-or-list bzr-command args))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
94 |
81512
1214f1b9e278
(vc-bzr-dir-state): Use setq rather than set.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81477
diff
changeset
|
95 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
96 ;;;###autoload |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
97 (defconst vc-bzr-admin-dirname ".bzr" |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
98 "Name of the directory containing Bzr repository status files.") |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
99 ;;;###autoload |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
100 (defconst vc-bzr-admin-checkout-format-file |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
101 (concat vc-bzr-admin-dirname "/checkout/format")) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
102 (defconst vc-bzr-admin-dirstate |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
103 (concat vc-bzr-admin-dirname "/checkout/dirstate")) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
104 (defconst vc-bzr-admin-branch-format-file |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
105 (concat vc-bzr-admin-dirname "/branch/format")) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
106 (defconst vc-bzr-admin-revhistory |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
107 (concat vc-bzr-admin-dirname "/branch/revision-history")) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
108 (defconst vc-bzr-admin-lastrev |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
109 (concat vc-bzr-admin-dirname "/branch/last-revision")) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
110 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
111 ;;;###autoload (defun vc-bzr-registered (file) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
112 ;;;###autoload (if (vc-find-root file vc-bzr-admin-checkout-format-file) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
113 ;;;###autoload (progn |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
114 ;;;###autoload (load "vc-bzr") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 ;;;###autoload (vc-bzr-registered file)))) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
116 |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
117 (defun vc-bzr-root (file) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
118 "Return the root directory of the bzr repository containing FILE." |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
119 ;; Cache technique copied from vc-arch.el. |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
120 (or (vc-file-getprop file 'bzr-root) |
87574
21fcd219fd6e
* mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87477
diff
changeset
|
121 (let ((root (vc-find-root file vc-bzr-admin-checkout-format-file))) |
21fcd219fd6e
* mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87477
diff
changeset
|
122 (when root (vc-file-setprop file 'bzr-root root))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
123 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
124 (defun vc-bzr-registered (file) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
125 "Return non-nil if FILE is registered with bzr. |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
126 |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
127 For speed, this function tries first to parse Bzr internal file |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
128 `checkout/dirstate', but it may fail if Bzr internal file format |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
129 has changed. As a safeguard, the `checkout/dirstate' file is |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
130 only parsed if it contains the string `#bazaar dirstate flat |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
131 format 3' in the first line. |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
132 |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
133 If the `checkout/dirstate' file cannot be parsed, fall back to |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
134 running `vc-bzr-state'." |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
135 (lexical-let ((root (vc-bzr-root file))) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
136 (when root ; Short cut. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
137 ;; This looks at internal files. May break if they change |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
138 ;; their format. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
139 (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root))) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
140 (if (not (file-readable-p dirstate)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
141 (vc-bzr-state file) ; Expensive. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
142 (with-temp-buffer |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
143 (insert-file-contents dirstate) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
144 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
145 (if (not (looking-at "#bazaar dirstate flat format 3")) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
146 (vc-bzr-state file) ; Some other unknown format? |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
147 (let* ((relfile (file-relative-name file root)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
148 (reldir (file-name-directory relfile))) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
149 (re-search-forward |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
150 (concat "^\0" |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
151 (if reldir (regexp-quote (directory-file-name reldir))) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
152 "\0" |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
153 (regexp-quote (file-name-nondirectory relfile)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
154 "\0") |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
155 nil t))))))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
156 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
157 (defconst vc-bzr-state-words |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
158 "added\\|ignored\\|kind changed\\|modified\\|removed\\|renamed\\|unknown" |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
159 "Regexp matching file status words as reported in `bzr' output.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
160 |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
161 (defun vc-bzr-file-name-relative (filename) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
162 "Return file name FILENAME stripped of the initial Bzr repository path." |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
163 (lexical-let* |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
164 ((filename* (expand-file-name filename)) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
165 (rootdir (vc-bzr-root filename*))) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
166 (when rootdir |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
167 (file-relative-name filename* rootdir)))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
168 |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
169 (defun vc-bzr-status (file) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
170 "Return FILE status according to Bzr. |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
171 Return value is a cons (STATUS . WARNING), where WARNING is a |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
172 string or nil, and STATUS is one of the symbols: `added', |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
173 `ignored', `kindchanged', `modified', `removed', `renamed', `unknown', |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
174 which directly correspond to `bzr status' output, or 'unchanged |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
175 for files whose copy in the working tree is identical to the one |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
176 in the branch repository, or nil for files that are not |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
177 registered with Bzr. |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
178 |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
179 If any error occurred in running `bzr status', then return nil." |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
180 (with-temp-buffer |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
181 (let ((ret (condition-case nil |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
182 (vc-bzr-command "status" t 0 file) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
183 (file-error nil))) ; vc-bzr-program not found. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
184 (status 'unchanged)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
185 ;; the only secure status indication in `bzr status' output |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
186 ;; is a couple of lines following the pattern:: |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
187 ;; | <status>: |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
188 ;; | <file name> |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
189 ;; if the file is up-to-date, we get no status report from `bzr', |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
190 ;; so if the regexp search for the above pattern fails, we consider |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
191 ;; the file to be up-to-date. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
192 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
193 (when (re-search-forward |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
194 ;; bzr prints paths relative to the repository root. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
195 (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+" |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
196 (regexp-quote (vc-bzr-file-name-relative file)) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
197 ;; Bzr appends a '/' to directory names and |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
198 ;; '*' to executable files |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
199 (if (file-directory-p file) "/?" "\\*?") |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
200 "[ \t\n]*$") |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
201 nil t) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
202 (lexical-let ((statusword (match-string 1))) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
203 ;; Erase the status text that matched. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
204 (delete-region (match-beginning 0) (match-end 0)) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
205 (setq status |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
206 (intern (replace-regexp-in-string " " "" statusword))))) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
207 (when status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
208 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
209 (skip-chars-forward " \n\t") ;Throw away spaces. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
210 (cons status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
211 ;; "bzr" will output warnings and informational messages to |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
212 ;; stderr; due to Emacs' `vc-do-command' (and, it seems, |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
213 ;; `start-process' itself) limitations, we cannot catch stderr |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
214 ;; and stdout into different buffers. So, if there's anything |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
215 ;; left in the buffer after removing the above status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
216 ;; keywords, let us just presume that any other message from |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
217 ;; "bzr" is a user warning, and display it. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
218 (unless (eobp) (buffer-substring (point) (point-max)))))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
219 |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
220 (defun vc-bzr-state (file) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
221 (lexical-let ((result (vc-bzr-status file))) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
222 (when (consp result) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
223 (if (cdr result) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
224 (message "Warnings in `bzr' output: %s" (cdr result))) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
225 (cdr (assq (car result) |
93118
01d3fd1a2cfe
* vc-hg.el (vc-hg-state):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93039
diff
changeset
|
226 '((added . added) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
227 (kindchanged . edited) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
228 (renamed . edited) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
229 (modified . edited) |
93164
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
230 (removed . removed) |
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
231 (ignored . unregistered) |
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
232 (unknown . unregistered) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
233 (unchanged . up-to-date))))))) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
234 |
92537
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
235 (defun vc-bzr-resolve-when-done () |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
236 "Call \"bzr resolve\" if the conflict markers have been removed." |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
237 (save-excursion |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
238 (goto-char (point-min)) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
239 (unless (re-search-forward "^<<<<<<< " nil t) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
240 (vc-bzr-command "resolve" nil 0 buffer-file-name) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
241 ;; Remove the hook so that it is not called multiple times. |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
242 (remove-hook 'after-save-hook 'vc-bzr-resolve-when-done t)))) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
243 |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
244 (defun vc-bzr-find-file-hook () |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
245 (when (and buffer-file-name |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
246 ;; FIXME: We should check that "bzr status" says "conflict". |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
247 (file-exists-p (concat buffer-file-name ".BASE")) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
248 (file-exists-p (concat buffer-file-name ".OTHER")) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
249 (file-exists-p (concat buffer-file-name ".THIS")) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
250 ;; If "bzr status" says there's a conflict but there are no |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
251 ;; conflict markers, it's not clear what we should do. |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
252 (save-excursion |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
253 (goto-char (point-min)) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
254 (re-search-forward "^<<<<<<< " nil t))) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
255 ;; TODO: the merge algorithm used in `bzr merge' is nicely configurable, |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
256 ;; but the one in `bzr pull' isn't, so it would be good to provide an |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
257 ;; elisp function to remerge from the .BASE/OTHER/THIS files. |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
258 (smerge-start-session) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
259 (add-hook 'after-save-hook 'vc-bzr-resolve-when-done nil t) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
260 (message "There are unresolved conflicts in this file"))) |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
261 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
262 (defun vc-bzr-workfile-unchanged-p (file) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
263 (eq 'unchanged (car (vc-bzr-status file)))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
264 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
265 (defun vc-bzr-working-revision (file) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
266 (lexical-let* |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
267 ((rootdir (vc-bzr-root file)) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
268 (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
269 rootdir)) |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
270 (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir)) |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
271 (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir))) |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
272 ;; This looks at internal files to avoid forking a bzr process. |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
273 ;; May break if they change their format. |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
274 (if (file-exists-p branch-format-file) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
275 (with-temp-buffer |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
276 (insert-file-contents branch-format-file) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
277 (goto-char (point-min)) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
278 (cond |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
279 ((or |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
280 (looking-at "Bazaar-NG branch, format 0.0.4") |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
281 (looking-at "Bazaar-NG branch format 5")) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
282 ;; count lines in .bzr/branch/revision-history |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
283 (insert-file-contents revhistory-file) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
284 (number-to-string (count-lines (line-end-position) (point-max)))) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
285 ((looking-at "Bazaar Branch Format 6 (bzr 0.15)") |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
286 ;; revno is the first number in .bzr/branch/last-revision |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
287 (insert-file-contents lastrev-file) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
288 (if (re-search-forward "[0-9]+" nil t) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
289 (buffer-substring (match-beginning 0) (match-end 0)))))) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
290 ;; fallback to calling "bzr revno" |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
291 (lexical-let* |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
292 ((result (vc-bzr-command-discarding-stderr |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
293 vc-bzr-program "revno" file)) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
294 (exitcode (car result)) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
295 (output (cdr result))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
296 (cond |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
297 ((eq exitcode 0) (substring output 0 -1)) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
298 (t nil)))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
299 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
300 (defun vc-bzr-checkout-model (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
301 'implicit) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
302 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
303 (defun vc-bzr-create-repo () |
78404
27f00e50116a
Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents:
78387
diff
changeset
|
304 "Create a new Bzr repository." |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
305 (vc-bzr-command "init" nil 0 nil)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
306 |
92122
74bf6df13b6c
* vc.el (vc-find-revision): Make vc-parent-buffer local before
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
307 (defun vc-bzr-init-revision (&optional file) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
308 "Always return nil, as Bzr cannot register explicit versions." |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
309 nil) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
310 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
311 (defun vc-bzr-register (files &optional rev comment) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
312 "Register FILE under bzr. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
313 Signal an error unless REV is nil. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
314 COMMENT is ignored." |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
315 (if rev (error "Can't register explicit revision with bzr")) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
316 (vc-bzr-command "add" nil 0 files)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
317 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
318 ;; Could run `bzr status' in the directory and see if it succeeds, but |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
319 ;; that's relatively expensive. |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
320 (defalias 'vc-bzr-responsible-p 'vc-bzr-root |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
321 "Return non-nil if FILE is (potentially) controlled by bzr. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
322 The criterion is that there is a `.bzr' directory in the same |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
323 or a superior directory.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
324 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
325 (defun vc-bzr-could-register (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
326 "Return non-nil if FILE could be registered under bzr." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
327 (and (vc-bzr-responsible-p file) ; shortcut |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
328 (condition-case () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
329 (with-temp-buffer |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
330 (vc-bzr-command "add" t 0 file "--dry-run") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
331 ;; The command succeeds with no output if file is |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
332 ;; registered (in bzr 0.8). |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
333 (goto-char (point-min)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
334 (looking-at "added ")) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
335 (error)))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
336 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
337 (defun vc-bzr-unregister (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
338 "Unregister FILE from bzr." |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
339 (vc-bzr-command "remove" nil 0 file "--keep")) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
340 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
341 (defun vc-bzr-checkin (files rev comment) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
342 "Check FILE in to bzr with log message COMMENT. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
343 REV non-nil gets an error." |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
344 (if rev (error "Can't check in a specific revision with bzr")) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
345 (vc-bzr-command "commit" nil 0 files "-m" comment)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
346 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
347 (defun vc-bzr-find-version (file rev buffer) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
348 "Fetch version REV of file FILE and put it into BUFFER." |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
349 (with-current-buffer buffer |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
350 (if (and rev (stringp rev) (not (string= rev ""))) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
351 (vc-bzr-command "cat" t 0 file "-r" rev) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
352 (vc-bzr-command "cat" t 0 file)))) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
353 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
354 (defun vc-bzr-checkout (file &optional editable rev destfile) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 "Checkout revision REV of FILE from bzr to DESTFILE. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
356 EDITABLE is ignored." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
357 (unless destfile |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
358 (setq destfile (vc-version-backup-file-name file rev))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
359 (let ((coding-system-for-read 'binary) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
360 (coding-system-for-write 'binary)) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
361 (with-temp-file destfile |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
362 (if (and rev (stringp rev) (not (string= rev ""))) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
363 (vc-bzr-command "cat" t 0 file "-r" rev) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
364 (vc-bzr-command "cat" t 0 file))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
365 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
366 (defun vc-bzr-revert (file &optional contents-done) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
367 (unless contents-done |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
368 (with-temp-buffer (vc-bzr-command "revert" t 0 file)))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
369 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
370 (defvar log-view-message-re) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
371 (defvar log-view-file-re) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
372 (defvar log-view-font-lock-keywords) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 (defvar log-view-current-tag-function) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
374 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
376 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
377 (require 'add-log) |
92938
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
378 (set (make-local-variable 'log-view-file-re) "^Working file:[ \t]+\\(.+\\)") |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
379 (set (make-local-variable 'log-view-message-re) |
92884
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
380 "^ *-+\n *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)") |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
381 (set (make-local-variable 'log-view-font-lock-keywords) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
382 ;; log-view-font-lock-keywords is careful to use the buffer-local |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
383 ;; value of log-view-message-re only since Emacs-23. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
384 (append `((,log-view-message-re . 'log-view-message-face)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
385 ;; log-view-font-lock-keywords |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
386 '(("^ *committer: \ |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
387 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]" |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
388 (1 'change-log-name) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
389 (2 'change-log-email)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
390 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
391 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
392 (defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
393 "Get bzr change log for FILES into specified BUFFER." |
92938
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
394 ;; `vc-do-command' creates the buffer, but we need it before running |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
395 ;; the command. |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
396 (vc-setup-buffer buffer) |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
397 ;; If the buffer exists from a previous invocation it might be |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
398 ;; read-only. |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
399 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
400 ;; the log display may not what the user wants - but I see no other |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
401 ;; way of getting the above regexps working. |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
402 (dolist (file files) |
93180
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
403 (vc-exec-after |
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
404 `(let ((inhibit-read-only t)) |
92938
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
405 (with-current-buffer buffer |
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
406 ;; Insert the file name so that log-view.el can find it. |
93180
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
407 (insert "Working file: " ',file "\n")) ;; Like RCS/CVS. |
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
408 (apply 'vc-bzr-command "log" ',buffer 'async ',file |
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
409 ',(if (stringp vc-bzr-log-switches) |
92938
89f7b102ea85
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92884
diff
changeset
|
410 (list vc-bzr-log-switches) |
93180
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
411 vc-bzr-log-switches)))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
412 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
413 (defun vc-bzr-show-log-entry (revision) |
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
414 "Find entry for patch name REVISION in bzr change log buffer." |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
415 (goto-char (point-min)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
416 (let (case-fold-search) |
92884
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
417 (if (re-search-forward |
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
418 ;; "revno:" can appear either at the beginning of a line, or indented. |
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
419 (concat "^[ ]*-+\n[ ]*revno: " |
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
420 ;; The revision can contain ".", quote it so that it |
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
421 ;; does not interfere with regexp matching. |
62bd4693326e
(vc-bzr-log-view-mode): "." can be part of a revno.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92537
diff
changeset
|
422 (regexp-quote revision) "$") nil t) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
423 (beginning-of-line 0) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
424 (goto-char (point-min))))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
425 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
426 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
427 "VC bzr backend for diff." |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
428 ;; `bzr diff' exits with code 1 if diff is non-empty. |
93180
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
429 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 'async files |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
430 "--diff-options" (mapconcat 'identity |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
431 (vc-diff-switches-list bzr) |
87649 | 432 " ") |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
433 ;; This `when' is just an optimization because bzr-1.2 is *much* |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
434 ;; faster when the revision argument is not given. |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
435 (when (or rev1 rev2) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
436 (list "-r" (format "%s..%s" |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
437 (or rev1 "revno:-1") |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
438 (or rev2 "")))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
439 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
440 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
441 ;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with |
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
442 ;; straight integer revisions. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
443 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
444 (defun vc-bzr-delete-file (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
445 "Delete FILE and delete it in the bzr repository." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
446 (condition-case () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
447 (delete-file file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
448 (file-error nil)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
449 (vc-bzr-command "remove" nil 0 file)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
450 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
451 (defun vc-bzr-rename-file (old new) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
452 "Rename file from OLD to NEW using `bzr mv'." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
453 (vc-bzr-command "mv" nil 0 new old)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
454 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
455 (defvar vc-bzr-annotation-table nil |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
456 "Internal use.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
457 (make-variable-buffer-local 'vc-bzr-annotation-table) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
458 |
85141
b16f7408cd3f
Carry through today's big terminology change to a few places where I
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85139
diff
changeset
|
459 (defun vc-bzr-annotate-command (file buffer &optional revision) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
460 "Prepare BUFFER for `vc-annotate' on FILE. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
461 Each line is tagged with the revision number, which has a `help-echo' |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
462 property containing author and date information." |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
463 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" |
93039
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
464 (if revision (list "-r" revision))) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
465 (with-current-buffer buffer |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
466 ;; Store the tags for the annotated source lines in a hash table |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
467 ;; to allow saving space by sharing the text properties. |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
468 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
469 (goto-char (point-min)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
470 (while (re-search-forward "^\\( *[0-9]+\\) +\\(.+\\) +\\([0-9]\\{8\\}\\) |" |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
471 nil t) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
472 (let* ((rev (match-string 1)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
473 (author (match-string 2)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
474 (date (match-string 3)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
475 (key (match-string 0)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
476 (tag (gethash key vc-bzr-annotation-table))) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
477 (unless tag |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
478 (setq tag (propertize rev 'help-echo (concat "Author: " author |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
479 ", date: " date) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
480 'mouse-face 'highlight)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
481 (puthash key tag vc-bzr-annotation-table)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
482 (replace-match "") |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
483 (insert tag " |"))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
484 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
485 (defun vc-bzr-annotate-time () |
93039
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
486 (when (re-search-forward "^ *[0-9]+ |" nil t) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
487 (let ((prop (get-text-property (line-beginning-position) 'help-echo))) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
488 (string-match "[0-9]+\\'" prop) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
489 (vc-annotate-convert-time |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
490 (encode-time 0 0 0 |
93039
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
491 (string-to-number (substring (match-string 0 prop) 6 8)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
492 (string-to-number (substring (match-string 0 prop) 4 6)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
493 (string-to-number (substring (match-string 0 prop) 0 4)) |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
494 ))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
495 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
496 (defun vc-bzr-annotate-extract-revision-at-line () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
497 "Return revision for current line of annoation buffer, or nil. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
498 Return nil if current line isn't annotated." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
499 (save-excursion |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
500 (beginning-of-line) |
93039
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
501 (if (looking-at " *\\([0-9]+\\) | ") |
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
502 (match-string-no-properties 1)))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
503 |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
504 (defun vc-bzr-command-discarding-stderr (command &rest args) |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
505 "Execute shell command COMMAND (with ARGS); return its output and exitcode. |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
506 Return value is a cons (EXITCODE . OUTPUT), where EXITCODE is |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
507 the (numerical) exit code of the process, and OUTPUT is a string |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
508 containing whatever the process sent to its standard output |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
509 stream. Standard error output is discarded." |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
510 (with-temp-buffer |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
511 (cons |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
512 (apply #'call-process command nil (list (current-buffer) nil) nil args) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
513 (buffer-substring (point-min) (point-max))))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
514 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
515 ;; TODO: it would be nice to mark the conflicted files in VC Dired, |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
516 ;; and implement a command to run ediff and `bzr resolve' once the |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
517 ;; changes have been merged. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
518 (defun vc-bzr-dir-state (dir &optional localp) |
87424
c0ee02a9ac55
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85462
diff
changeset
|
519 "Find the VC state of all files in DIR and its subdirectories. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
520 Optional argument LOCALP is always ignored." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
521 (let ((bzr-root-directory (vc-bzr-root dir)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
522 (at-start t) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
523 current-bzr-state current-vc-state) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
524 ;; Check that DIR is a bzr repository. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
525 (unless (file-name-absolute-p bzr-root-directory) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
526 (error "Cannot find bzr repository for directory `%s'" dir)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
527 ;; `bzr ls --versioned' lists all versioned files; |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
528 ;; assume they are up-to-date, unless we are given |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
529 ;; evidence of the contrary. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
530 (setq at-start t) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
531 (with-temp-buffer |
87442
c5df210848ca
* vc-bzr.el, vc-cvs.el, vc-git.el, vc-hg.el, vc-mcvs.el, vc-svn.el:
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87424
diff
changeset
|
532 (buffer-disable-undo) ;; Because these buffers can get huge |
87424
c0ee02a9ac55
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85462
diff
changeset
|
533 (vc-bzr-command "ls" t 0 nil "--versioned") |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
534 (goto-char (point-min)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 (while (or at-start |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 (eq 0 (forward-line))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
537 (setq at-start nil) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 (let ((file (expand-file-name |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
539 (buffer-substring-no-properties |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
540 (line-beginning-position) (line-end-position)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
541 bzr-root-directory))) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
542 ;; files are up-to-date unless they appear in the `bzr |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
543 ;; status' output below |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
544 (vc-file-setprop file 'vc-state 'up-to-date) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
545 ;; XXX: is this correct? what happens if one |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
546 ;; mixes different SCMs in the same dir? |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
547 ;; Anyway, we're looking at the output of `bzr ls --versioned', |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
548 ;; so we know these files are registered with Bzr. |
78404
27f00e50116a
Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents:
78387
diff
changeset
|
549 (vc-file-setprop file 'vc-backend 'Bzr)))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
550 ;; `bzr status' reports on added/modified/renamed and unknown/ignored files |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
551 (setq at-start t) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
552 (with-temp-buffer |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
553 (vc-bzr-command "status" t 0 nil) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
554 (goto-char (point-min)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
555 (while (or at-start |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
556 (eq 0 (forward-line))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
557 (setq at-start nil) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
558 (cond |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
559 ((looking-at "^added") |
87477
b5060e79eb98
* vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87450
diff
changeset
|
560 (setq current-vc-state 'added) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 (setq current-bzr-state 'added)) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
562 ((looking-at "^kind changed") |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
563 (setq current-vc-state 'edited) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
564 (setq current-bzr-state 'kindchanged)) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 ((looking-at "^modified") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
566 (setq current-vc-state 'edited) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
567 (setq current-bzr-state 'modified)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
568 ((looking-at "^renamed") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
569 (setq current-vc-state 'edited) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 (setq current-bzr-state 'renamed)) |
87450
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
571 ((looking-at "^ignored") |
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
572 (setq current-vc-state 'ignored) |
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
573 (setq current-bzr-state 'not-versioned)) |
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
574 ((looking-at "^unknown") |
71fc7b1db920
* vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
87442
diff
changeset
|
575 (setq current-vc-state 'unregistered) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
576 (setq current-bzr-state 'not-versioned)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
577 ((looking-at " ") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
578 ;; file names are indented by two spaces |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
579 (when current-vc-state |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
580 (let ((file (expand-file-name |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
581 (buffer-substring-no-properties |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
582 (match-end 0) (line-end-position)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
583 bzr-root-directory))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
584 (vc-file-setprop file 'vc-state current-vc-state) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
585 (vc-file-setprop file 'vc-bzr-state current-bzr-state) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
586 (when (eq 'added current-bzr-state) |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
587 (vc-file-setprop file 'vc-working-revision "0")))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
588 (when (eq 'not-versioned current-bzr-state) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
589 (let ((file (expand-file-name |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
590 (buffer-substring-no-properties |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
591 (match-end 0) (line-end-position)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
592 bzr-root-directory))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
593 (vc-file-setprop file 'vc-backend 'none) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
594 (vc-file-setprop file 'vc-state nil)))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
595 (t |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
596 ;; skip this part of `bzr status' output |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
597 (setq current-vc-state nil) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
598 (setq current-bzr-state nil))))))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
599 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
600 (defun vc-bzr-dired-state-info (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
601 "Bzr-specific version of `vc-dired-state-info'." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
602 (if (eq 'edited (vc-state file)) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
603 (concat "(" (symbol-name (or (vc-file-getprop file 'vc-bzr-state) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
604 'edited)) ")") |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
605 ;; else fall back to default vc.el representation |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
606 (vc-default-dired-state-info 'Bzr file))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
607 |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
608 ;; XXX Experimental function for the vc-dired replacement. |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
609 ;; XXX: this needs testing, it's probably incomplete. |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
610 (defun vc-bzr-after-dir-status (update-function status-buffer) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
611 (let ((status-str nil) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
612 (file nil) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
613 (translation '(("+N" . added) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
614 ("-D" . removed) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
615 (" M" . edited) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
616 ;; XXX: what about ignored files? |
93176
c985261aee9c
* vc-hg.el (vc-hg-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93164
diff
changeset
|
617 (" D" . missing) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
618 ("? " . unregistered))) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
619 (translated nil) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
620 (result nil)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
621 (goto-char (point-min)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
622 (while (not (eobp)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
623 (setq status-str |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
624 (buffer-substring-no-properties (point) (+ (point) 2))) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
625 (setq file |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
626 (buffer-substring-no-properties (+ (point) 4) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
627 (line-end-position))) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
628 (setq translated (assoc status-str translation)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
629 (push (cons file (cdr translated)) result) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
630 (forward-line)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
631 ;; Remove the temporary buffer. |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
632 (kill-buffer (current-buffer)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
633 (funcall update-function result status-buffer))) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
634 |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
635 ;; XXX Experimental function for the vc-dired replacement. |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
636 ;; XXX This probably needs some further refinement and testing. |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
637 (defun vc-bzr-dir-status (dir update-function status-buffer) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
638 "Return a list of conses (file . state) for DIR." |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
639 (with-current-buffer |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
640 (get-buffer-create |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
641 (expand-file-name " *VC-bzr* tmp status" dir)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
642 (erase-buffer) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
643 ;; XXX: Is this the right command to use? |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
644 (vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S") |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
645 (vc-exec-after |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
646 `(vc-bzr-after-dir-status (quote ,update-function) ,status-buffer)) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
647 (current-buffer))) |
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
648 |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
649 ;;; Revision completion |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
650 |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
651 (defun vc-bzr-complete-with-prefix (prefix action table string pred) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
652 (let ((comp (complete-with-action action table string pred))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
653 (if (stringp comp) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
654 (concat prefix comp) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
655 comp))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
656 |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
657 (defun vc-bzr-revision-completion-table (files) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
658 (lexical-let ((files files)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
659 ;; What about using `files'?!? --Stef |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
660 (lambda (string pred action) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
661 (cond |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
662 ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):" |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
663 string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
664 (vc-bzr-complete-with-prefix (substring string 0 (match-end 0)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
665 action |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
666 'read-file-name-internal |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
667 (substring string (match-end 0)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
668 ;; Dropping `pred'. Maybe we should just |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
669 ;; stash it in `read-file-name-predicate'? |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
670 nil)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
671 ((string-match "\\`\\(before\\):" string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
672 (vc-bzr-complete-with-prefix (substring string 0 (match-end 0)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
673 action |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
674 (vc-bzr-revision-completion-table files) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
675 (substring string (match-end 0)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
676 pred)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
677 ((string-match "\\`\\(tag\\):" string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
678 (let ((prefix (substring string 0 (match-end 0))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
679 (tag (substring string (match-end 0))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
680 (table nil)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
681 (with-temp-buffer |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
682 ;; "bzr-1.2 tags" is much faster with --show-ids. |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
683 (call-process vc-bzr-program nil '(t) nil "tags" "--show-ids") |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
684 ;; The output is ambiguous, unless we assume that revids do not |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
685 ;; contain spaces. |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
686 (goto-char (point-min)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
687 (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
688 (push (match-string-no-properties 1) table))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
689 (vc-bzr-complete-with-prefix prefix action table tag pred))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
690 |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
691 ((string-match "\\`\\(revid\\):" string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
692 ;; FIXME: How can I get a list of revision ids? |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
693 ) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
694 (t |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
695 (complete-with-action action '("revno:" "revid:" "last:" "before:" |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
696 "tag:" "date:" "ancestor:" "branch:" |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
697 "submit:") |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
698 string pred)))))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
699 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
700 (eval-after-load "vc" |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
701 '(add-to-list 'vc-directory-exclusion-list vc-bzr-admin-dirname t)) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
702 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
703 (provide 'vc-bzr) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
704 ;; arch-tag: 8101bad8-4e92-4e7d-85ae-d8e08b4e7c06 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
705 ;;; vc-bzr.el ends here |