Mercurial > emacs
annotate lisp/vc-bzr.el @ 100733:95111c4c05fd
(Top): Update node listing.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 28 Dec 2008 05:03:10 +0000 |
parents | 6974583b6281 |
children | a9dc0e7c3f2b |
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 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
11 ;; This file is part of GNU Emacs. |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
12 |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
16 ;; (at your option) any later version. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
17 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
78372
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 ;;; Commentary: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
28 ;; 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
|
29 ;; <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
|
30 ;; branches of `vc-bzr'. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
31 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
32 ;; 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
|
33 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 ;; Known bugs |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 ;; ========== |
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 ;; 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
|
38 ;; 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
|
39 ;; symlink, thereby not detecting whether the actual contents |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
40 ;; (that is, the target contents) are changed. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
41 ;; 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
|
42 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
43 ;; 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
|
44 ;; 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
|
45 |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94539
diff
changeset
|
46 ;;; Properties of the backend |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94539
diff
changeset
|
47 |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94539
diff
changeset
|
48 (defun vc-bzr-revision-granularity () 'repository) |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94539
diff
changeset
|
49 (defun vc-bzr-checkout-model (files) 'implicit) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
51 ;;; Code: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
52 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 (eval-when-compile |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 (require 'cl) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
55 (require 'vc) ;; for vc-exec-after |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
56 (require 'vc-dir)) |
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 ;; 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
|
59 ;; 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
|
60 (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
|
61 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 (defgroup vc-bzr nil |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 "VC bzr backend." |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
64 :version "22.2" |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 :group 'vc) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 (defcustom vc-bzr-program "bzr" |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 "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
|
69 :group 'vc-bzr |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
70 :type 'string) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
71 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
72 (defcustom vc-bzr-diff-switches nil |
100178
6974583b6281
(vc-bzr-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
99388
diff
changeset
|
73 "String or list of strings specifying switches for bzr diff under VC. |
6974583b6281
(vc-bzr-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
99388
diff
changeset
|
74 If nil, use the value of `vc-diff-switches'. If t, use no switches." |
6974583b6281
(vc-bzr-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
99388
diff
changeset
|
75 :type '(choice (const :tag "Unspecified" nil) |
6974583b6281
(vc-bzr-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
99388
diff
changeset
|
76 (const :tag "None" t) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
77 (string :tag "Argument String") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
78 (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
|
79 :group 'vc-bzr) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
80 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
81 (defcustom vc-bzr-log-switches nil |
100178
6974583b6281
(vc-bzr-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
99388
diff
changeset
|
82 "String or list of strings specifying switches for bzr log under VC." |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
83 :type '(choice (const :tag "None" nil) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
84 (string :tag "Argument String") |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
85 (repeat :tag "Argument List" :value ("") string)) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
86 :group 'vc-bzr) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
87 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
88 ;; 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
|
89 ;; 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
|
90 (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
|
91 "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
|
92 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
|
93 `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
|
94 (let ((process-environment |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
95 (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
|
96 "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
|
97 process-environment))) |
94847
5e64dca662f0
Remove assumption about what nil means as a first arument to vc-do-command.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94729
diff
changeset
|
98 (apply 'vc-do-command (or buffer "*vc*") okstatus vc-bzr-program |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
99 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
|
100 |
81512
1214f1b9e278
(vc-bzr-dir-state): Use setq rather than set.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81477
diff
changeset
|
101 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
102 ;;;###autoload |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
103 (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
|
104 "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
|
105 ;;;###autoload |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
106 (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
|
107 (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
|
108 (defconst vc-bzr-admin-dirstate |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
109 (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
|
110 (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
|
111 (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
|
112 (defconst vc-bzr-admin-revhistory |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
113 (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
|
114 (defconst vc-bzr-admin-lastrev |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
115 (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
|
116 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
117 ;;;###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
|
118 ;;;###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
|
119 ;;;###autoload (progn |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 ;;;###autoload (load "vc-bzr") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
121 ;;;###autoload (vc-bzr-registered file)))) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
122 |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
123 (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
|
124 "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
|
125 ;; 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
|
126 (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
|
127 (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
|
128 (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
|
129 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
130 (require 'sha1) ;For sha1-program |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
131 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
132 (defun vc-bzr-sha1 (file) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
133 (with-temp-buffer |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
134 (set-buffer-multibyte nil) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
135 (let ((prog sha1-program) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
136 (args nil)) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
137 (when (consp prog) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
138 (setq args (cdr prog)) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
139 (setq prog (car prog))) |
94873
66788c63a40a
(vc-bzr-sha1, vc-bzr-command-discarding-stderr)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94847
diff
changeset
|
140 (apply 'process-file prog (file-relative-name file) t nil args) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
141 (buffer-substring (point-min) (+ (point-min) 40))))) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
142 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
143 (defun vc-bzr-state-heuristic (file) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
144 "Like `vc-bzr-state' but hopefully without running Bzr." |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
145 ;; `bzr status' is excrutiatingly slow with large histories and |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
146 ;; pending merges, so try to avoid using it until they fix their |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
147 ;; performance problems. |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
148 ;; This function tries first to parse Bzr internal file |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
149 ;; `checkout/dirstate', but it may fail if Bzr internal file format |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
150 ;; has changed. As a safeguard, the `checkout/dirstate' file is |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
151 ;; only parsed if it contains the string `#bazaar dirstate flat |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
152 ;; format 3' in the first line. |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
153 ;; If the `checkout/dirstate' file cannot be parsed, fall back to |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
154 ;; running `vc-bzr-state'." |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
155 (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
|
156 (when root ; Short cut. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
157 ;; 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
|
158 ;; their format. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
159 (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
|
160 (if (not (file-readable-p dirstate)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
161 (vc-bzr-state file) ; Expensive. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
162 (with-temp-buffer |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
163 (insert-file-contents dirstate) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
164 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
165 (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
|
166 (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
|
167 (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
|
168 (reldir (file-name-directory relfile))) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
169 (if (re-search-forward |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
170 (concat "^\0" |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
171 (if reldir (regexp-quote |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
172 (directory-file-name reldir))) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
173 "\0" |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
174 (regexp-quote (file-name-nondirectory relfile)) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
175 "\0" |
93368
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
176 "[^\0]*\0" ;id? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
177 "\\([^\0]*\\)\0" ;"a/f/d", a=removed? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
178 "[^\0]*\0" ;sha1 (empty if conflicted)? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
179 "\\([^\0]*\\)\0" ;size? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
180 "[^\0]*\0" ;"y/n", executable? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
181 "[^\0]*\0" ;? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
182 "\\([^\0]*\\)\0" ;"a/f/d" a=added? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
183 "\\([^\0]*\\)\0" ;sha1 again? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
184 "[^\0]*\0" ;size again? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
185 "[^\0]*\0" ;"y/n", executable again? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
186 "[^\0]*\0" ;last revid? |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
187 ;; There are more fields when merges are pending. |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
188 ) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
189 nil t) |
93368
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
190 ;; Apparently the second sha1 is the one we want: when |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
191 ;; there's a conflict, the first sha1 is absent (and the |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
192 ;; first size seems to correspond to the file with |
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
193 ;; conflict markers). |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
194 (cond |
93368
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
195 ((eq (char-after (match-beginning 1)) ?a) 'removed) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
196 ((eq (char-after (match-beginning 3)) ?a) 'added) |
93368
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
197 ((and (eq (string-to-number (match-string 2)) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
198 (nth 7 (file-attributes file))) |
93368
411d7b7dfe32
(vc-bzr-state-heuristic): Fix last change for when there are conflicts.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93363
diff
changeset
|
199 (equal (match-string 4) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
200 (vc-bzr-sha1 file))) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
201 'up-to-date) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
202 (t 'edited)) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
203 'unregistered))))))))) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
204 |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
205 (defun vc-bzr-registered (file) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
206 "Return non-nil if FILE is registered with bzr." |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
207 (let ((state (vc-bzr-state-heuristic file))) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
208 (not (memq state '(nil unregistered ignored))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
209 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
210 (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
|
211 "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
|
212 "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
|
213 |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
214 (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
|
215 "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
|
216 (lexical-let* |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
217 ((filename* (expand-file-name filename)) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
218 (rootdir (vc-bzr-root filename*))) |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
219 (when rootdir |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
220 (file-relative-name filename* rootdir)))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
221 |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
222 (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
|
223 "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
|
224 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
|
225 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
|
226 `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
|
227 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
|
228 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
|
229 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
|
230 registered with Bzr. |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
231 |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
232 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
|
233 (with-temp-buffer |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
234 (let ((ret (condition-case nil |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
235 (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
|
236 (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
|
237 (status 'unchanged)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
238 ;; 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
|
239 ;; 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
|
240 ;; | <status>: |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
241 ;; | <file name> |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
242 ;; 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
|
243 ;; 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
|
244 ;; 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
|
245 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
246 (when (re-search-forward |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
247 ;; 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
|
248 (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
|
249 (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
|
250 ;; Bzr appends a '/' to directory names and |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
251 ;; '*' to executable files |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
252 (if (file-directory-p file) "/?" "\\*?") |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
253 "[ \t\n]*$") |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
254 nil t) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
255 (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
|
256 ;; Erase the status text that matched. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
257 (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
|
258 (setq status |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
259 (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
|
260 (when status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
261 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
262 (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
|
263 (cons status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
264 ;; "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
|
265 ;; 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
|
266 ;; `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
|
267 ;; 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
|
268 ;; 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
|
269 ;; 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
|
270 ;; "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
|
271 (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
|
272 |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
273 (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
|
274 (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
|
275 (when (consp result) |
93671
2b3d42806dcc
(vc-bzr-state): Use when instead of if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93602
diff
changeset
|
276 (when (cdr result) |
2b3d42806dcc
(vc-bzr-state): Use when instead of if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93602
diff
changeset
|
277 (message "Warnings in `bzr' output: %s" (cdr result))) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
278 (cdr (assq (car result) |
93118
01d3fd1a2cfe
* vc-hg.el (vc-hg-state):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93039
diff
changeset
|
279 '((added . added) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
280 (kindchanged . edited) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
281 (renamed . edited) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
282 (modified . edited) |
93164
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
283 (removed . removed) |
94521
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
284 (ignored . ignored) |
93164
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
285 (unknown . unregistered) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
286 (unchanged . up-to-date))))))) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
287 |
92537
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
288 (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
|
289 "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
|
290 (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
|
291 (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
|
292 (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
|
293 (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
|
294 ;; 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
|
295 (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
|
296 |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
297 (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
|
298 (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
|
299 ;; 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
|
300 (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
|
301 (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
|
302 (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
|
303 ;; 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
|
304 ;; 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
|
305 (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
|
306 (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
|
307 (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
|
308 ;; 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
|
309 ;; 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
|
310 ;; 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
|
311 (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
|
312 (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
|
313 (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
|
314 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
315 (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
|
316 (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
|
317 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
318 (defun vc-bzr-working-revision (file) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
319 ;; Together with the code in vc-state-heuristic, this makes it possible |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
320 ;; to get the initial VC state of a Bzr file even if Bzr is not installed. |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
321 (lexical-let* |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
322 ((rootdir (vc-bzr-root file)) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
323 (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
|
324 rootdir)) |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
325 (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
|
326 (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
|
327 ;; 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
|
328 ;; 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
|
329 (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
|
330 (with-temp-buffer |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
331 (insert-file-contents branch-format-file) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
332 (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
|
333 (cond |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
334 ((or |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
335 (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
|
336 (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
|
337 ;; count lines in .bzr/branch/revision-history |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
338 (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
|
339 (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
|
340 ((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
|
341 ;; revno is the first number in .bzr/branch/last-revision |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
342 (insert-file-contents lastrev-file) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
343 (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
|
344 (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
|
345 ;; fallback to calling "bzr revno" |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
346 (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
|
347 ((result (vc-bzr-command-discarding-stderr |
94873
66788c63a40a
(vc-bzr-sha1, vc-bzr-command-discarding-stderr)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94847
diff
changeset
|
348 vc-bzr-program "revno" (file-relative-name file))) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
349 (exitcode (car result)) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
350 (output (cdr result))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
351 (cond |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
352 ((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
|
353 (t nil)))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
354 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
355 (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
|
356 "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
|
357 (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
|
358 |
92122
74bf6df13b6c
* vc.el (vc-find-revision): Make vc-parent-buffer local before
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
359 (defun vc-bzr-init-revision (&optional file) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
360 "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
|
361 nil) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
362 |
93602
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
363 (defun vc-bzr-previous-revision (file rev) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
364 (if (string-match "\\`[0-9]+\\'" rev) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
365 (number-to-string (1- (string-to-number rev))) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
366 (concat "before:" rev))) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
367 |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
368 (defun vc-bzr-next-revision (file rev) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
369 (if (string-match "\\`[0-9]+\\'" rev) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
370 (number-to-string (1+ (string-to-number rev))) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
371 (error "Don't know how to compute the next revision of %s" rev))) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
372 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
373 (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
|
374 "Register FILE under bzr. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
375 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
|
376 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
|
377 (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
|
378 (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
|
379 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
380 ;; 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
|
381 ;; that's relatively expensive. |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
382 (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
|
383 "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
|
384 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
|
385 or a superior directory.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
386 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
387 (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
|
388 "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
|
389 (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
|
390 (condition-case () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
391 (with-temp-buffer |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
392 (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
|
393 ;; 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
|
394 ;; registered (in bzr 0.8). |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
395 (goto-char (point-min)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
396 (looking-at "added ")) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
397 (error)))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
398 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
399 (defun vc-bzr-unregister (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
400 "Unregister FILE from bzr." |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
401 (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
|
402 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
403 (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
|
404 "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
|
405 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
|
406 (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
|
407 (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
|
408 |
97401
58215ab2e8e6
(vc-bzr-find-revision): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96539
diff
changeset
|
409 (defun vc-bzr-find-revision (file rev buffer) |
58215ab2e8e6
(vc-bzr-find-revision): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96539
diff
changeset
|
410 "Fetch revision REV of file FILE and put it into BUFFER." |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
411 (with-current-buffer buffer |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
412 (if (and rev (stringp rev) (not (string= rev ""))) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
413 (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
|
414 (vc-bzr-command "cat" t 0 file)))) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
415 |
93563
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
416 (defun vc-bzr-checkout (file &optional editable rev) |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
417 (if rev (error "Operation not supported") |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
418 ;; Else, there's nothing to do. |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
419 nil)) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
420 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
421 (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
|
422 (unless contents-done |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
423 (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
|
424 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
425 (defvar log-view-message-re) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
426 (defvar log-view-file-re) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
427 (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
|
428 (defvar log-view-current-tag-function) |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
429 (defvar log-view-per-file-logs) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
430 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
431 (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
|
432 (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
|
433 (require 'add-log) |
95966
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95232
diff
changeset
|
434 (set (make-local-variable 'log-view-per-file-logs) nil) |
80343
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
435 (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
|
436 (set (make-local-variable 'log-view-message-re) |
80340
756c7bbc9664
(vc-bzr-log-view-mode, vc-bzr-annotate-command)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
80333
diff
changeset
|
437 "^ *-+\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
|
438 (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
|
439 ;; 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
|
440 ;; 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
|
441 (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
|
442 ;; log-view-font-lock-keywords |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
443 '(("^ *committer: \ |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
444 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]" |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
445 (1 'change-log-name) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
446 (2 'change-log-email)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
447 ("^ *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
|
448 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
449 (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
|
450 "Get bzr change log for FILES into specified BUFFER." |
80343
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
451 ;; `vc-do-command' creates the buffer, but we need it before running |
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
452 ;; the command. |
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
453 (vc-setup-buffer buffer) |
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
454 ;; If the buffer exists from a previous invocation it might be |
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
455 ;; read-only. |
93563
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
456 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
457 ;; the log display may not what the user wants - but I see no other |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
458 ;; way of getting the above regexps working. |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
459 (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
|
460 (vc-exec-after |
9add13a0e597
(vc-bzr-print-log, vc-bzr-diff): Do it asynchronously.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93176
diff
changeset
|
461 `(let ((inhibit-read-only t)) |
93563
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
462 (with-current-buffer buffer |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
463 ;; 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
|
464 (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
|
465 (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
|
466 ',(if (stringp vc-bzr-log-switches) |
93563
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
467 (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
|
468 vc-bzr-log-switches)))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
469 |
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
|
470 (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
|
471 "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
|
472 (goto-char (point-min)) |
98220
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
473 (when revision |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
474 (let (case-fold-search) |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
475 (if (re-search-forward |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
476 ;; "revno:" can appear either at the beginning of a line, |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
477 ;; or indented. |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
478 (concat "^[ ]*-+\n[ ]*revno: " |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
479 ;; The revision can contain ".", quote it so that it |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
480 ;; does not interfere with regexp matching. |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
481 (regexp-quote revision) "$") nil t) |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
482 (beginning-of-line 0) |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
483 (goto-char (point-min)))))) |
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-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
|
486 "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
|
487 ;; `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
|
488 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 'async files |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
489 "--diff-options" (mapconcat 'identity |
98464
75e08f08f5e5
(vc-bzr-diff): Use vc-switches rather than the obsolete vc-diff-switches.
Glenn Morris <rgm@gnu.org>
parents:
98220
diff
changeset
|
490 (vc-switches 'bzr 'diff) |
87649 | 491 " ") |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
492 ;; 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
|
493 ;; 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
|
494 (when (or rev1 rev2) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
495 (list "-r" (format "%s..%s" |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
496 (or rev1 "revno:-1") |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
497 (or rev2 "")))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
498 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
499 |
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
|
500 ;; 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
|
501 ;; straight integer revisions. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
502 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
503 (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
|
504 "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
|
505 (condition-case () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
506 (delete-file file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
507 (file-error nil)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
508 (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
|
509 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
510 (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
|
511 "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
|
512 (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
|
513 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
514 (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
|
515 "Internal use.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
516 (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
|
517 |
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
|
518 (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
|
519 "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
|
520 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
|
521 property containing author and date information." |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
522 (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
|
523 (if revision (list "-r" revision))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
524 (with-current-buffer buffer |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
525 ;; Store the tags for the annotated source lines in a hash table |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
526 ;; to allow saving space by sharing the text properties. |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
527 (setq vc-bzr-annotation-table (make-hash-table :test 'equal)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
528 (goto-char (point-min)) |
80340
756c7bbc9664
(vc-bzr-log-view-mode, vc-bzr-annotate-command)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
80333
diff
changeset
|
529 (while (re-search-forward "^\\( *[0-9.]+ *\\) \\([^\n ]+\\) +\\([0-9]\\{8\\}\\) |" |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
530 nil t) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
531 (let* ((rev (match-string 1)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
532 (author (match-string 2)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
533 (date (match-string 3)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
534 (key (match-string 0)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
535 (tag (gethash key vc-bzr-annotation-table))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
536 (unless tag |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
537 (setq tag (propertize rev 'help-echo (concat "Author: " author |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 ", date: " date) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
539 'mouse-face 'highlight)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
540 (puthash key tag vc-bzr-annotation-table)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
541 (replace-match "") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
542 (insert tag " |"))))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
543 |
96213
09da7727f35f
* vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96128
diff
changeset
|
544 (declare-function vc-annotate-convert-time "vc-annotate" (time)) |
09da7727f35f
* vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96128
diff
changeset
|
545 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
546 (defun vc-bzr-annotate-time () |
80340
756c7bbc9664
(vc-bzr-log-view-mode, vc-bzr-annotate-command)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
80333
diff
changeset
|
547 (when (re-search-forward "^ *[0-9.]+ +|" nil t) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
548 (let ((prop (get-text-property (line-beginning-position) 'help-echo))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
549 (string-match "[0-9]+\\'" prop) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
550 (let ((str (match-string-no-properties 0 prop))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
551 (vc-annotate-convert-time |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
552 (encode-time 0 0 0 |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
553 (string-to-number (substring str 6 8)) |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
554 (string-to-number (substring str 4 6)) |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
555 (string-to-number (substring str 0 4)))))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
556 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
557 (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
|
558 "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
|
559 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
|
560 (save-excursion |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 (beginning-of-line) |
96128
d5ad6b6af42d
(vc-bzr-annotate-extract-revision-at-line):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96002
diff
changeset
|
562 (if (looking-at " *\\([0-9.]+\\) *| ") |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 (match-string-no-properties 1)))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
564 |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
565 (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
|
566 "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
|
567 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
|
568 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
|
569 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
|
570 stream. Standard error output is discarded." |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
571 (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
|
572 (cons |
94873
66788c63a40a
(vc-bzr-sha1, vc-bzr-command-discarding-stderr)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94847
diff
changeset
|
573 (apply #'process-file 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
|
574 (buffer-substring (point-min) (point-max))))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
575 |
94539
fee32a11924d
Name change in preparation for ripping out vc-dired.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94522
diff
changeset
|
576 (defun vc-bzr-prettify-state-info (file) |
fee32a11924d
Name change in preparation for ripping out vc-dired.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94522
diff
changeset
|
577 "Bzr-specific version of `vc-prettify-state-info'." |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
578 (if (eq 'edited (vc-state file)) |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
579 (concat "(" (symbol-name (or (vc-file-getprop file 'vc-bzr-state) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
580 'edited)) ")") |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
581 ;; else fall back to default vc.el representation |
94539
fee32a11924d
Name change in preparation for ripping out vc-dired.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94522
diff
changeset
|
582 (vc-default-prettify-state-info 'Bzr file))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
583 |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
584 (defstruct (vc-bzr-extra-fileinfo |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
585 (:copier nil) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
586 (:constructor vc-bzr-create-extra-fileinfo (extra-name)) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
587 (:conc-name vc-bzr-extra-fileinfo->)) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
588 extra-name) ;; original name for rename targets, new name for |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
589 |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
590 (defun vc-bzr-dir-printer (info) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
591 "Pretty-printer for the vc-dir-fileinfo structure." |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
592 (let ((extra (vc-dir-fileinfo->extra info))) |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
593 (vc-default-dir-printer 'Bzr info) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
594 (when extra |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
595 (insert (propertize |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
596 (format " (renamed from %s)" |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
597 (vc-bzr-extra-fileinfo->extra-name extra)) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
598 'face 'font-lock-comment-face))))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
599 |
96539
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
600 ;; FIXME: this needs testing, it's probably incomplete. |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93976
diff
changeset
|
601 (defun vc-bzr-after-dir-status (update-function) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
602 (let ((status-str nil) |
96539
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
603 (translation '(("+N " . added) |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
604 ("-D " . removed) |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
605 (" M " . edited) ;; file text modified |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
606 (" *" . edited) ;; execute bit changed |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
607 (" M*" . edited) ;; text modified + execute bit changed |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
608 ;; FIXME: what about ignored files? |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
609 (" D " . missing) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
610 ;; For conflicts, should we list the .THIS/.BASE/.OTHER? |
96539
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
611 ("C " . conflict) |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
612 ("? " . unregistered) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
613 ("? " . unregistered) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
614 ;; No such state, but we need to distinguish this case. |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
615 ("R " . renamed) |
98524
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
616 ;; For a non existent file FOO, the output is: |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
617 ;; bzr: ERROR: Path(s) do not exist: FOO |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
618 ("bzr" . not-found) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
619 ;; Ignore "P " and "P." for pending patches. |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
620 )) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
621 (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
|
622 (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
|
623 (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
|
624 (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
|
625 (setq status-str |
96539
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
626 (buffer-substring-no-properties (point) (+ (point) 3))) |
93976
c53b75d15c27
(vc-bzr-after-dir-status): Detect the conflict state.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93759
diff
changeset
|
627 (setq translated (cdr (assoc status-str translation))) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
628 (cond |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
629 ((eq translated 'conflict) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
630 ;; For conflicts the file appears twice in the listing: once |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
631 ;; with the M flag and once with the C flag, so take care |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
632 ;; not to add it twice to `result'. Ugly. |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
633 (let* ((file |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
634 (buffer-substring-no-properties |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
635 ;;For files with conflicts the format is: |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
636 ;;C Text conflict in FILENAME |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
637 ;; Bah. |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
638 (+ (point) 21) (line-end-position))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
639 (entry (assoc file result))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
640 (when entry |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
641 (setf (nth 1 entry) 'conflict)))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
642 ((eq translated 'renamed) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
643 (re-search-forward "R \\(.*\\) => \\(.*\\)$" (line-end-position) t) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
644 (let ((new-name (match-string 2)) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
645 (old-name (match-string 1))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
646 (push (list new-name 'edited |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
647 (vc-bzr-create-extra-fileinfo old-name)) result))) |
98524
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
648 ;; do nothing for non existent files |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
649 ((eq translated 'not-found)) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
650 (t |
93976
c53b75d15c27
(vc-bzr-after-dir-status): Detect the conflict state.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93759
diff
changeset
|
651 (push (list (buffer-substring-no-properties |
c53b75d15c27
(vc-bzr-after-dir-status): Detect the conflict state.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93759
diff
changeset
|
652 (+ (point) 4) |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
653 (line-end-position)) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
654 translated) result))) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
655 (forward-line)) |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93976
diff
changeset
|
656 (funcall update-function result))) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
657 |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93976
diff
changeset
|
658 (defun vc-bzr-dir-status (dir update-function) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
659 "Return a list of conses (file . state) for DIR." |
93382
8e46096e0cb3
* vc.el (vc-status-menu-map, vc-status-mode-map): Bind vc-revert.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93368
diff
changeset
|
660 (vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S") |
8e46096e0cb3
* vc.el (vc-status-menu-map, vc-status-mode-map): Bind vc-revert.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93368
diff
changeset
|
661 (vc-exec-after |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93976
diff
changeset
|
662 `(vc-bzr-after-dir-status (quote ,update-function)))) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
663 |
98524
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
664 (defun vc-bzr-dir-status-files (dir files default-state update-function) |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
665 "Return a list of conses (file . state) for DIR." |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
666 (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files) |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
667 (vc-exec-after |
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
668 `(vc-bzr-after-dir-status (quote ,update-function)))) |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
669 |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
670 (defun vc-bzr-dir-extra-headers (dir) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
671 (let ((str (with-temp-buffer |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
672 (vc-bzr-command "info" t 0 dir) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
673 (buffer-string)))) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
674 (concat |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
675 (propertize "Parent branch: " 'face 'font-lock-type-face) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
676 (propertize |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
677 (if (string-match "parent branch: \\(.+\\)$" str) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
678 (match-string 1 str) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
679 "None") |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
680 'face 'font-lock-variable-name-face)))) |
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
681 |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
682 ;;; Revision completion |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
683 |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
684 (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
|
685 (lexical-let ((files files)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
686 ;; 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
|
687 (lambda (string pred action) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
688 (cond |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
689 ((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
|
690 string) |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
691 (completion-table-with-context (substring string 0 (match-end 0)) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
692 ;; FIXME: only allow directories. |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
693 ;; FIXME: don't allow envvars. |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
694 'read-file-name-internal |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
695 (substring string (match-end 0)) |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
696 ;; Dropping `pred'. Maybe we should |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
697 ;; just stash it in |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
698 ;; `read-file-name-predicate'? |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
699 nil |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
700 action)) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
701 ((string-match "\\`\\(before\\):" string) |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
702 (completion-table-with-context (substring string 0 (match-end 0)) |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
703 (vc-bzr-revision-completion-table files) |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
704 (substring string (match-end 0)) |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
705 pred |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
706 action)) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
707 ((string-match "\\`\\(tag\\):" string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
708 (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
|
709 (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
|
710 (table nil)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
711 (with-temp-buffer |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
712 ;; "bzr-1.2 tags" is much faster with --show-ids. |
94873
66788c63a40a
(vc-bzr-sha1, vc-bzr-command-discarding-stderr)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94847
diff
changeset
|
713 (process-file vc-bzr-program nil '(t) nil "tags" "--show-ids") |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
714 ;; 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
|
715 ;; contain spaces. |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
716 (goto-char (point-min)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
717 (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
|
718 (push (match-string-no-properties 1) table))) |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
719 (completion-table-with-context prefix table tag pred action))) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
720 |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
721 ((string-match "\\`\\(revid\\):" string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
722 ;; 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
|
723 ) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
724 ((eq (car-safe action) 'boundaries) |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
725 (list* 'boundaries |
95232
e043650664ff
(vc-bzr-revision-completion-table): Choose the right `:'.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95228
diff
changeset
|
726 (string-match "[^:]*\\'" string) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
727 (string-match ":" (cdr action)))) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
728 (t |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
729 ;; Could use completion-table-with-terminator, except that it |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
730 ;; currently doesn't work right w.r.t pcm and doesn't give |
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
731 ;; the *Completions* output we want. |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
732 (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
|
733 "tag:" "date:" "ancestor:" "branch:" |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
734 "submit:") |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
735 string pred)))))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
736 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
737 (eval-after-load "vc" |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
738 '(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
|
739 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
740 (provide 'vc-bzr) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
741 ;; 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
|
742 ;;; vc-bzr.el ends here |