Mercurial > emacs
annotate lisp/vc/vc-bzr.el @ 112402:a102f5772eaa
Merge from mainline.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Fri, 21 Jan 2011 12:27:07 -0800 |
parents | 4f72b1e43644 |
children |
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 |
112128 | 3 ;; Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 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 |
101078
5f4e85fd7c0a
Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
5 ;; Author: Dave Love <fx@gnu.org> |
5f4e85fd7c0a
Comments (minor fixes of some header conventions).
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
6 ;; Riccardo Murri <riccardo.murri@gmail.com> |
111878 | 7 ;; Maintainer: FSF |
108971
d928a6a7c3f2
* lisp/finder.el (finder-known-keywords): Add keyword "vc"
Juri Linkov <juri@jurta.org>
parents:
108970
diff
changeset
|
8 ;; Keywords: vc tools |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
9 ;; Created: Sept 2006 |
110015
280c8ae2476d
Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents:
108971
diff
changeset
|
10 ;; Package: vc |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
11 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
12 ;; 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
|
13 |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
14 ;; 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
|
15 ;; 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
|
16 ;; 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
|
17 ;; (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
|
18 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94563
diff
changeset
|
19 ;; 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
|
20 ;; 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
|
21 ;; 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
|
22 ;; 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
|
23 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
24 ;; 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
|
25 ;; 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
|
26 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
27 ;;; Commentary: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
28 |
111878 | 29 ;; See <URL:http://bazaar.canonical.com/> concerning bzr. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
30 |
111878 | 31 ;; This library provides bzr support in VC. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
32 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
33 ;; Known bugs |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
34 ;; ========== |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
35 |
107175
6e6072f0c0a2
2010-02-17 Mark A. Hershberger <mah@everybody.org>
Mark A. Hershberger <mah@everybody.org>
parents:
107097
diff
changeset
|
36 ;; When editing a symlink and *both* the symlink and its target |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
37 ;; 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
|
38 ;; 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
|
39 ;; (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
|
40 ;; 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
|
41 |
94563
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94539
diff
changeset
|
42 ;;; 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
|
43 |
a0bb8ca25a33
Clean up vc*-revision-granularity and vc*-checkout-model.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94539
diff
changeset
|
44 (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
|
45 (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
|
46 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
47 ;;; Code: |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
48 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
49 (eval-when-compile |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
50 (require 'cl) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
51 (require 'vc) ;; for vc-exec-after |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
52 (require 'vc-dir)) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
53 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
54 ;; Clear up the cache to force vc-call to check again and discover |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
55 ;; new functions when we reload this file. |
78404
27f00e50116a
Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents:
78387
diff
changeset
|
56 (put 'Bzr 'vc-functions nil) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
57 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
58 (defgroup vc-bzr nil |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
59 "VC bzr backend." |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
60 :version "22.2" |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
61 :group 'vc) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
62 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
63 (defcustom vc-bzr-program "bzr" |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
64 "Name of the bzr command (excluding any arguments)." |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
65 :group 'vc-bzr |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
66 :type 'string) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
67 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
68 (defcustom vc-bzr-diff-switches nil |
100178
6974583b6281
(vc-bzr-diff-switches): Doc fix. Add t as option.
Glenn Morris <rgm@gnu.org>
parents:
99388
diff
changeset
|
69 "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
|
70 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
|
71 :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
|
72 (const :tag "None" t) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
73 (string :tag "Argument String") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
74 (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
|
75 :group 'vc-bzr) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
76 |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
77 (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
|
78 "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
|
79 :type '(choice (const :tag "None" nil) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
80 (string :tag "Argument String") |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
81 (repeat :tag "Argument List" :value ("") string)) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
82 :group 'vc-bzr) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
83 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
84 ;; 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
|
85 ;; 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
|
86 (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
|
87 "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
|
88 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
|
89 `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
|
90 (let ((process-environment |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
91 (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
|
92 "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
|
93 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
|
94 (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
|
95 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
|
96 |
81512
1214f1b9e278
(vc-bzr-dir-state): Use setq rather than set.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
81477
diff
changeset
|
97 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
98 ;;;###autoload |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
99 (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
|
100 "Name of the directory containing Bzr repository status files.") |
111878 | 101 ;; Used in the autoloaded vc-bzr-registered; see below. |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
102 ;;;###autoload |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
103 (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
|
104 (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
|
105 (defconst vc-bzr-admin-dirstate |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
106 (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
|
107 (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
|
108 (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
|
109 (defconst vc-bzr-admin-revhistory |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
110 (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
|
111 (defconst vc-bzr-admin-lastrev |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
112 (concat vc-bzr-admin-dirname "/branch/last-revision")) |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
113 (defconst vc-bzr-admin-branchconf |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
114 (concat vc-bzr-admin-dirname "/branch/branch.conf")) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
115 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
116 ;;;###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
|
117 ;;;###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
|
118 ;;;###autoload (progn |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
119 ;;;###autoload (load "vc-bzr") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
120 ;;;###autoload (vc-bzr-registered file)))) |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
121 |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
122 (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
|
123 "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
|
124 ;; 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
|
125 (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
|
126 (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
|
127 (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
|
128 |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
129 (defun vc-bzr--branch-conf (file) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
130 "Return the Bzr branch config for file FILE, as a string." |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
131 (with-temp-buffer |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
132 (insert-file-contents |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
133 (expand-file-name vc-bzr-admin-branchconf (vc-bzr-root file))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
134 (buffer-string))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
135 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
136 (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
|
137 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
138 (defun vc-bzr-sha1 (file) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
139 (with-temp-buffer |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
140 (set-buffer-multibyte nil) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
141 (let ((prog sha1-program) |
104595
cfc336042c1b
* vc-bzr.el (vc-bzr-sha1, vc-bzr-revision-completion-table):
Michael Albinus <michael.albinus@gmx.de>
parents:
104086
diff
changeset
|
142 (args nil) |
cfc336042c1b
* vc-bzr.el (vc-bzr-sha1, vc-bzr-revision-completion-table):
Michael Albinus <michael.albinus@gmx.de>
parents:
104086
diff
changeset
|
143 process-file-side-effects) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
144 (when (consp prog) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
145 (setq args (cdr prog)) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
146 (setq prog (car prog))) |
94873
66788c63a40a
(vc-bzr-sha1, vc-bzr-command-discarding-stderr)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94847
diff
changeset
|
147 (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
|
148 (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
|
149 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
150 (defun vc-bzr-state-heuristic (file) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
151 "Like `vc-bzr-state' but hopefully without running Bzr." |
111878 | 152 ;; `bzr status' was excruciatingly slow with large histories and |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
153 ;; 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
|
154 ;; performance problems. |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
155 ;; 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
|
156 ;; `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
|
157 ;; 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
|
158 ;; 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
|
159 ;; format 3' in the first line. |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
160 ;; 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
|
161 ;; running `vc-bzr-state'." |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
162 (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
|
163 (when root ; Short cut. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
164 ;; 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
|
165 ;; their format. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
166 (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root))) |
103236
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
167 (condition-case nil |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
168 (with-temp-buffer |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
169 (insert-file-contents dirstate) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
170 (goto-char (point-min)) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
171 (if (not (looking-at "#bazaar dirstate flat format 3")) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
172 (vc-bzr-state file) ; Some other unknown format? |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
173 (let* ((relfile (file-relative-name file root)) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
174 (reldir (file-name-directory relfile))) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
175 (if (re-search-forward |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
176 (concat "^\0" |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
177 (if reldir (regexp-quote |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
178 (directory-file-name reldir))) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
179 "\0" |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
180 (regexp-quote (file-name-nondirectory relfile)) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
181 "\0" |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
182 "[^\0]*\0" ;id? |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
183 "\\([^\0]*\\)\0" ;"a/f/d", a=removed? |
106723
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
184 "\\([^\0]*\\)\0" ;sha1 (empty if conflicted)? |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
185 "\\([^\0]*\\)\0" ;size?p |
111878 | 186 ;; y/n. Whether or not the current copy |
187 ;; was executable the last time bzr checked? | |
188 "[^\0]*\0" | |
103236
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
189 "[^\0]*\0" ;? |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
190 "\\([^\0]*\\)\0" ;"a/f/d" a=added? |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
191 "\\([^\0]*\\)\0" ;sha1 again? |
106723
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
192 "\\([^\0]*\\)\0" ;size again? |
111878 | 193 ;; y/n. Whether or not the repo thinks |
194 ;; the file should be executable? | |
195 "\\([^\0]*\\)\0" | |
103236
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
196 "[^\0]*\0" ;last revid? |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
197 ;; There are more fields when merges are pending. |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
198 ) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
199 nil t) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
200 ;; Apparently the second sha1 is the one we want: when |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
201 ;; there's a conflict, the first sha1 is absent (and the |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
202 ;; first size seems to correspond to the file with |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
203 ;; conflict markers). |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
204 (cond |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
205 ((eq (char-after (match-beginning 1)) ?a) 'removed) |
106723
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
206 ((eq (char-after (match-beginning 4)) ?a) 'added) |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
207 ((or (and (eq (string-to-number (match-string 3)) |
103236
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
208 (nth 7 (file-attributes file))) |
111878 | 209 (equal (match-string 5) |
210 (vc-bzr-sha1 file)) | |
211 ;; For a file, does the executable state match? | |
212 ;; (Bug#7544) | |
213 (or (not | |
214 (eq (char-after (match-beginning 1)) ?f)) | |
215 (let ((exe | |
216 (memq | |
217 ?x | |
218 (mapcar | |
219 'identity | |
220 (nth 8 (file-attributes file)))))) | |
221 (if (eq (char-after (match-beginning 7)) | |
222 ?y) | |
223 exe | |
224 (not exe))))) | |
106723
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
225 (and |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
226 ;; It looks like for lightweight |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
227 ;; checkouts \2 is empty and we need to |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
228 ;; look for size in \6. |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
229 (eq (match-beginning 2) (match-end 2)) |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
230 (eq (string-to-number (match-string 6)) |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
231 (nth 7 (file-attributes file))) |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
232 (equal (match-string 5) |
82660e679622
(vc-bzr-state-heuristic): Make it work for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106677
diff
changeset
|
233 (vc-bzr-sha1 file)))) |
103236
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
234 'up-to-date) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
235 (t 'edited)) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
236 'unregistered)))) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
237 ;; Either the dirstate file can't be read, or the sha1 |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
238 ;; executable is missing, or ... |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
239 ;; In either case, recent versions of Bzr aren't that slow |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
240 ;; any more. |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
241 (error (vc-bzr-state file))))))) |
b4e12b7edf39
(vc-bzr-state-heuristic): Fallback on vc-bzr-state in case
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
102876
diff
changeset
|
242 |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
243 |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
244 (defun vc-bzr-registered (file) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
245 "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
|
246 (let ((state (vc-bzr-state-heuristic file))) |
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
247 (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
|
248 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
249 (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
|
250 "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
|
251 "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
|
252 |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
253 ;; History of Bzr commands. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
254 (defvar vc-bzr-history nil) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
255 |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
256 (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
|
257 "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
|
258 (lexical-let* |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
259 ((filename* (expand-file-name filename)) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
260 (rootdir (vc-bzr-root filename*))) |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
261 (when rootdir |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
262 (file-relative-name filename* rootdir)))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
263 |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
264 (defun vc-bzr-async-command (command args) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
265 "Run Bzr COMMAND asynchronously with ARGS, displaying the result. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
266 Send the output to a buffer named \"*vc-bzr : NAME*\", where NAME |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
267 is the root of the current Bzr branch. Display the buffer in |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
268 some window, but don't select it." |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
269 ;; TODO: set up hyperlinks. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
270 (let* ((dir default-directory) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
271 (root (vc-bzr-root default-directory)) |
111685
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
272 (buffer (get-buffer-create |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
273 (format "*vc-bzr : %s*" |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
274 (expand-file-name root))))) |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
275 (with-current-buffer buffer |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
276 (setq default-directory root) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
277 (goto-char (point-max)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
278 (unless (eq (point) (point-min)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
279 (insert "\n")) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
280 (insert "Running \"" vc-bzr-program " " command) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
281 (dolist (arg args) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
282 (insert " " arg)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
283 (insert "\"...\n") |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
284 ;; Run bzr in the original working directory. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
285 (let ((default-directory dir)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
286 (apply 'vc-bzr-command command t 'async nil args))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
287 (display-buffer buffer))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
288 |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
289 (defun vc-bzr-pull (prompt) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
290 "Pull changes into the current Bzr branch. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
291 Normally, this runs \"bzr pull\". However, if the branch is a |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
292 bound branch, run \"bzr update\" instead. If there is no default |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
293 location from which to pull or update, or if PROMPT is non-nil, |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
294 prompt for the Bzr command to run." |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
295 (let* ((vc-bzr-program vc-bzr-program) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
296 (branch-conf (vc-bzr--branch-conf default-directory)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
297 ;; Check whether the branch is bound. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
298 (bound (string-match "^bound\\s-*=\\s-*True" branch-conf)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
299 ;; If we need to do a "bzr pull", check for a parent. If it |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
300 ;; does not exist, bzr will need a pull location. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
301 (parent (unless bound |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
302 (string-match |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
303 "^parent_location\\s-*=\\s-*[^\n[:space:]]+" |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
304 branch-conf))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
305 (command (if bound "update" "pull")) |
111685
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
306 args) |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
307 ;; If necessary, prompt for the exact command. |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
308 (when (or prompt (not (or bound parent))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
309 (setq args (split-string |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
310 (read-shell-command |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
311 "Run Bzr (like this): " |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
312 (concat vc-bzr-program " " command) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
313 'vc-bzr-history) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
314 " " t)) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
315 (setq vc-bzr-program (car args) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
316 command (cadr args) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
317 args (cddr args))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
318 (vc-bzr-async-command command args))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
319 |
111685
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
320 (defun vc-bzr-merge-branch () |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
321 "Merge another Bzr branch into the current one. |
111685
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
322 Prompt for the Bzr command to run, providing a pre-defined merge |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
323 source (an upstream branch or a previous merge source) as a |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
324 default if it is available." |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
325 (let* ((branch-conf (vc-bzr--branch-conf default-directory)) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
326 ;; "bzr merge" without an argument defaults to submit_branch, |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
327 ;; then parent_location. We extract the specific location |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
328 ;; and add it explicitly to the command line. |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
329 (location |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
330 (cond |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
331 ((string-match |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
332 "^submit_branch\\s-*=\\s-*\\(?:file://\\)?\\([^\n[:space:]]+\\)$" |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
333 branch-conf) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
334 (match-string 1 branch-conf)) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
335 ((string-match |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
336 "^parent_location\\s-*=\\s-*\\(?:file://\\)?\\([^\n[:space:]]+\\)$" |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
337 branch-conf) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
338 (match-string 1 branch-conf)))) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
339 (cmd |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
340 (split-string |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
341 (read-shell-command |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
342 "Run Bzr (like this): " |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
343 (concat vc-bzr-program " merge --pull" |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
344 (if location (concat " " location) "")) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
345 'vc-bzr-history) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
346 " " t)) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
347 (vc-bzr-program (car cmd)) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
348 (command (cadr cmd)) |
411dce7ee068
Always issue a full prompt in vc-merge-branch operation.
Chong Yidong <cyd@stupidchicken.com>
parents:
111679
diff
changeset
|
349 (args (cddr cmd))) |
111679
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
350 (vc-bzr-async-command command args))) |
33ed3cf8260b
Initial support for unified DVCS pull and merge.
Chong Yidong <cyd@stupidchicken.com>
parents:
110015
diff
changeset
|
351 |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
352 (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
|
353 "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
|
354 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
|
355 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
|
356 `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
|
357 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
|
358 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
|
359 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
|
360 registered with Bzr. |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
361 |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
362 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
|
363 (with-temp-buffer |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
364 (let ((ret (condition-case nil |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
365 (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
|
366 (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
|
367 (status 'unchanged)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
368 ;; 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
|
369 ;; 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
|
370 ;; | <status>: |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
371 ;; | <file name> |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
372 ;; 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
|
373 ;; 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
|
374 ;; 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
|
375 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
376 (when (re-search-forward |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
377 ;; 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
|
378 (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
|
379 (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
|
380 ;; Bzr appends a '/' to directory names and |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
381 ;; '*' to executable files |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
382 (if (file-directory-p file) "/?" "\\*?") |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
383 "[ \t\n]*$") |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
384 nil t) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
385 (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
|
386 ;; Erase the status text that matched. |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
387 (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
|
388 (setq status |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
389 (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
|
390 (when status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
391 (goto-char (point-min)) |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
392 (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
|
393 (cons status |
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
394 ;; "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
|
395 ;; 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
|
396 ;; `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
|
397 ;; 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
|
398 ;; 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
|
399 ;; 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
|
400 ;; "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
|
401 (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
|
402 |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
403 (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
|
404 (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
|
405 (when (consp result) |
93671
2b3d42806dcc
(vc-bzr-state): Use when instead of if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93602
diff
changeset
|
406 (when (cdr result) |
2b3d42806dcc
(vc-bzr-state): Use when instead of if.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93602
diff
changeset
|
407 (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
|
408 (cdr (assq (car result) |
93118
01d3fd1a2cfe
* vc-hg.el (vc-hg-state):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93039
diff
changeset
|
409 '((added . added) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
410 (kindchanged . edited) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
411 (renamed . edited) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
412 (modified . edited) |
93164
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
413 (removed . removed) |
94521
2a61c5f918a5
Change 'needs-patch to 'needs-update.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
94481
diff
changeset
|
414 (ignored . ignored) |
93164
849abb573acb
(vc-bzr-state): Return 'removed for removed files and
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93118
diff
changeset
|
415 (unknown . unregistered) |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
416 (unchanged . up-to-date))))))) |
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
417 |
92537
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
418 (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
|
419 "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
|
420 (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
|
421 (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
|
422 (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
|
423 (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
|
424 ;; 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
|
425 (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
|
426 |
7071cfe2789e
(vc-bzr-resolve-when-done, vc-bzr-find-file-hook): New functions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92122
diff
changeset
|
427 (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
|
428 (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
|
429 ;; 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
|
430 (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
|
431 (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
|
432 (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
|
433 ;; 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
|
434 ;; 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
|
435 (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
|
436 (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
|
437 (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
|
438 ;; 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
|
439 ;; 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
|
440 ;; 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
|
441 (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
|
442 (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
|
443 (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
|
444 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
445 (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
|
446 (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
|
447 |
85139
8ba0e30716a5
Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
85114
diff
changeset
|
448 (defun vc-bzr-working-revision (file) |
93363
9e7b1b11aa5c
(vc-bzr-sha1): New fun.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93180
diff
changeset
|
449 ;; 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
|
450 ;; 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
|
451 (lexical-let* |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
452 ((rootdir (vc-bzr-root file)) |
78748
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
453 (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
|
454 rootdir)) |
0b7bd1d9ffbf
(vc-bzr-admin-lastrev): New constant.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78564
diff
changeset
|
455 (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
|
456 (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
|
457 ;; 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
|
458 ;; May break if they change their format. |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
459 (if (and (file-exists-p branch-format-file) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
460 ;; For lightweight checkouts (obtained with bzr checkout --lightweight) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
461 ;; the branch-format-file does not contain the revision |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
462 ;; information, we need to look up the branch-format-file |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
463 ;; in the place where the lightweight checkout comes |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
464 ;; from. We only do that if it's a local file. |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
465 (let ((location-fname (expand-file-name |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
466 (concat vc-bzr-admin-dirname |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
467 "/branch/location") rootdir))) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
468 ;; The existence of this file is how we distinguish |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
469 ;; lightweight checkouts. |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
470 (if (file-exists-p location-fname) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
471 (with-temp-buffer |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
472 (insert-file-contents location-fname) |
106742
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
473 ;; If the lightweight checkout points to a |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
474 ;; location in the local file system, then we can |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
475 ;; look there for the version information. |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
476 (when (re-search-forward "file://\\(.+\\)" nil t) |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
477 (let ((l-c-parent-dir (match-string 1))) |
106778
95040dd9104b
Fix bug#5345: password asked when visiting files on a lightweight checkout.
Juanma Barranquero <lekktu@gmail.com>
parents:
106751
diff
changeset
|
478 (when (and (memq system-type '(ms-dos windows-nt)) |
95040dd9104b
Fix bug#5345: password asked when visiting files on a lightweight checkout.
Juanma Barranquero <lekktu@gmail.com>
parents:
106751
diff
changeset
|
479 (string-match-p "^/[[:alpha:]]:" l-c-parent-dir)) |
106819
328951014a28
Fix comment for bug#5345.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
480 ;;; The non-Windows code takes a shortcut by using the host/path |
328951014a28
Fix comment for bug#5345.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
481 ;;; separator slash as the start of the absolute path. That |
328951014a28
Fix comment for bug#5345.
Juanma Barranquero <lekktu@gmail.com>
parents:
106815
diff
changeset
|
482 ;;; does not work on Windows, so we must remove it (bug#5345) |
106778
95040dd9104b
Fix bug#5345: password asked when visiting files on a lightweight checkout.
Juanma Barranquero <lekktu@gmail.com>
parents:
106751
diff
changeset
|
483 (setq l-c-parent-dir (substring l-c-parent-dir 1))) |
106742
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
484 (setq branch-format-file |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
485 (expand-file-name vc-bzr-admin-branch-format-file |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
486 l-c-parent-dir)) |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
487 (setq lastrev-file |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
488 (expand-file-name vc-bzr-admin-lastrev l-c-parent-dir)) |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
489 ;; FIXME: maybe it's overkill to check if both these files exist. |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
490 (and (file-exists-p branch-format-file) |
debedd261607
(vc-bzr-working-revision): Fix looking for a revision
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106732
diff
changeset
|
491 (file-exists-p lastrev-file))))) |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
492 t))) |
78564
8f9613d80af0
Don't fiddle with vc-handled-backend.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78521
diff
changeset
|
493 (with-temp-buffer |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
494 (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
|
495 (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
|
496 (cond |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
497 ((or |
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
498 (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
|
499 (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
|
500 ;; 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
|
501 (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
|
502 (number-to-string (count-lines (line-end-position) (point-max)))) |
101790
e98ddfaefcae
(vc-bzr-working-revision): Recognize a newer branch
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101078
diff
changeset
|
503 ((or |
e98ddfaefcae
(vc-bzr-working-revision): Recognize a newer branch
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101078
diff
changeset
|
504 (looking-at "Bazaar Branch Format 6 (bzr 0.15)") |
e98ddfaefcae
(vc-bzr-working-revision): Recognize a newer branch
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101078
diff
changeset
|
505 (looking-at "Bazaar Branch Format 7 (needs bzr 1.6)")) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
506 ;; 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
|
507 (insert-file-contents lastrev-file) |
101790
e98ddfaefcae
(vc-bzr-working-revision): Recognize a newer branch
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101078
diff
changeset
|
508 (when (re-search-forward "[0-9]+" nil t) |
e98ddfaefcae
(vc-bzr-working-revision): Recognize a newer branch
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101078
diff
changeset
|
509 (buffer-substring (match-beginning 0) (match-end 0)))))) |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
510 ;; fallback to calling "bzr revno" |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
511 (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
|
512 ((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
|
513 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
|
514 (exitcode (car result)) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
515 (output (cdr result))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
516 (cond |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
517 ((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
|
518 (t nil)))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
519 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
520 (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
|
521 "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
|
522 (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
|
523 |
92122
74bf6df13b6c
* vc.el (vc-find-revision): Make vc-parent-buffer local before
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87649
diff
changeset
|
524 (defun vc-bzr-init-revision (&optional file) |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
525 "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
|
526 nil) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
527 |
93602
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
528 (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
|
529 (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
|
530 (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
|
531 (concat "before:" rev))) |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
532 |
702b99dd7604
(vc-bzr-previous-revision, vc-bzr-next-revision): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93563
diff
changeset
|
533 (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
|
534 (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
|
535 (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
|
536 (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
|
537 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
538 (defun vc-bzr-register (files &optional rev comment) |
111878 | 539 "Register FILES under bzr. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
540 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
|
541 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
|
542 (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
|
543 (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
|
544 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
545 ;; 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
|
546 ;; that's relatively expensive. |
78431
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
547 (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
|
548 "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
|
549 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
|
550 or a superior directory.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
551 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
552 (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
|
553 "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
|
554 (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
|
555 (condition-case () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
556 (with-temp-buffer |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
557 (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
|
558 ;; 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
|
559 ;; registered (in bzr 0.8). |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
560 (goto-char (point-min)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
561 (looking-at "added ")) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
562 (error)))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
563 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
564 (defun vc-bzr-unregister (file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
565 "Unregister FILE from bzr." |
79688
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
566 (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
|
567 |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
568 (declare-function log-edit-extract-headers "log-edit" (headers string)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
569 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
570 (defun vc-bzr-checkin (files rev comment) |
111878 | 571 "Check FILES in to bzr with log message COMMENT. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
572 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
|
573 (if rev (error "Can't check in a specific revision with bzr")) |
108010
4ae75c6f19d6
vc-bzr.el (vc-bzr-checkin): Undo spurious `async' arg change.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
108009
diff
changeset
|
574 (apply 'vc-bzr-command "commit" nil 0 |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
575 files (cons "-m" (log-edit-extract-headers '(("Author" . "--author") |
108913
c05344a913c8
Improve support for special markup in the VC commit message.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
108840
diff
changeset
|
576 ("Date" . "--commit-time") |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
577 ("Fixes" . "--fixes")) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
578 comment)))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
579 |
97401
58215ab2e8e6
(vc-bzr-find-revision): Rename from
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96539
diff
changeset
|
580 (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
|
581 "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
|
582 (with-current-buffer buffer |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
583 (if (and rev (stringp rev) (not (string= rev ""))) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
584 (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
|
585 (vc-bzr-command "cat" t 0 file)))) |
f82034083629
Copyright and version headers update.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78748
diff
changeset
|
586 |
93563
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
587 (defun vc-bzr-checkout (file &optional editable rev) |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
588 (if rev (error "Operation not supported") |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
589 ;; Else, there's nothing to do. |
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
590 nil)) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
591 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
592 (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
|
593 (unless contents-done |
78521
98c39e79e082
(vc-bzr-registered): Use \0 instead of literal NULs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78435
diff
changeset
|
594 (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
|
595 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
596 (defvar log-view-message-re) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
597 (defvar log-view-file-re) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
598 (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
|
599 (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
|
600 (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
|
601 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
602 (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
|
603 (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
|
604 (require 'add-log) |
95966
054335cbee3d
* log-view.el (log-view-diff-changeset): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
95232
diff
changeset
|
605 (set (make-local-variable 'log-view-per-file-logs) nil) |
104086
1bce2f053aeb
(vc-bzr-print-log): Pass multiple arguments to bzr log.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103236
diff
changeset
|
606 (set (make-local-variable 'log-view-file-re) "\\`a\\`") |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
607 (set (make-local-variable 'log-view-message-re) |
107795
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
608 (if (eq vc-log-view-type 'short) |
106985
e9c454218ac8
(vc-bzr-print-log): Use the more compact --line option
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106982
diff
changeset
|
609 "^ *\\([0-9.]+\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?" |
105010
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
610 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)")) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
611 (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
|
612 ;; 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
|
613 ;; value of log-view-message-re only since Emacs-23. |
107795
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
614 (if (eq vc-log-view-type 'short) |
105010
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
615 (append `((,log-view-message-re |
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
616 (1 'log-view-message-face) |
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
617 (2 'change-log-name) |
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
618 (3 'change-log-date) |
106506
c43a4817b264
Fix short log parsing and fontification.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106476
diff
changeset
|
619 (4 'change-log-list nil lax)))) |
105010
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
620 (append `((,log-view-message-re . 'log-view-message-face)) |
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
621 ;; log-view-font-lock-keywords |
106724
37a9363510b2
(vc-bzr-log-view-mode): Also highlight the author.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106723
diff
changeset
|
622 '(("^ *\\(?:committer\\|author\\): \ |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
623 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]" |
105010
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
624 (1 'change-log-name) |
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
625 (2 'change-log-email)) |
b3c2589ed19e
* vc.el (top): print-log method now takes an optional SHORTLOG
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104618
diff
changeset
|
626 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face))))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
627 |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
628 (defun vc-bzr-print-log (files buffer &optional shortlog start-revision limit) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
629 "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
|
630 ;; `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
|
631 ;; the command. |
3c75e19e7ec9
(vc-bzr-print-log): Insert a file marker. Run the log
Dan Nicolaescu <dann@ics.uci.edu>
parents:
80340
diff
changeset
|
632 (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
|
633 ;; 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
|
634 ;; read-only. |
93563
c505d070db06
(vc-bzr-checkout): Simplify.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93461
diff
changeset
|
635 ;; 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
|
636 ;; 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
|
637 ;; way of getting the above regexps working. |
104086
1bce2f053aeb
(vc-bzr-print-log): Pass multiple arguments to bzr log.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103236
diff
changeset
|
638 (with-current-buffer buffer |
1bce2f053aeb
(vc-bzr-print-log): Pass multiple arguments to bzr log.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103236
diff
changeset
|
639 (apply 'vc-bzr-command "log" buffer 'async files |
106386
d1166d927ca2
(vc-bzr-print-log): Deal with nil arguments better.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106269
diff
changeset
|
640 (append |
106985
e9c454218ac8
(vc-bzr-print-log): Use the more compact --line option
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106982
diff
changeset
|
641 (when shortlog '("--line")) |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
642 (when start-revision (list (format "-r..%s" start-revision))) |
106386
d1166d927ca2
(vc-bzr-print-log): Deal with nil arguments better.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106269
diff
changeset
|
643 (when limit (list "-l" (format "%s" limit))) |
d1166d927ca2
(vc-bzr-print-log): Deal with nil arguments better.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106269
diff
changeset
|
644 (if (stringp vc-bzr-log-switches) |
d1166d927ca2
(vc-bzr-print-log): Deal with nil arguments better.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106269
diff
changeset
|
645 (list vc-bzr-log-switches) |
d1166d927ca2
(vc-bzr-print-log): Deal with nil arguments better.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106269
diff
changeset
|
646 vc-bzr-log-switches))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
647 |
107795
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
648 (defun vc-bzr-log-incoming (buffer remote-location) |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
649 (apply 'vc-bzr-command "missing" buffer 'async nil |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
650 (list "--theirs-only" (unless (string= remote-location "") remote-location)))) |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
651 |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
652 (defun vc-bzr-log-outgoing (buffer remote-location) |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
653 (apply 'vc-bzr-command "missing" buffer 'async nil |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
654 (list "--mine-only" (unless (string= remote-location "") remote-location)))) |
d47e1fb98df3
Add new VC methods: vc-log-incoming and vc-log-outgoing.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107487
diff
changeset
|
655 |
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
|
656 (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
|
657 "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
|
658 (goto-char (point-min)) |
98220
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
659 (when revision |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
660 (let (case-fold-search |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
661 found) |
98220
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
662 (if (re-search-forward |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
663 ;; "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
|
664 ;; or indented. |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
665 (concat "^[ ]*-+\n[ ]*revno: " |
962e4709829b
* vc-bzr.el (vc-bzr-show-log-entry):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98079
diff
changeset
|
666 ;; 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
|
667 ;; 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
|
668 (regexp-quote revision) "$") nil t) |
106472
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
669 (progn |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
670 (beginning-of-line 0) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
671 (setq found t)) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
672 (goto-char (point-min))) |
6e0f1038bc44
Support showing a single log entry from vc-annotate.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106466
diff
changeset
|
673 found))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
674 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
675 (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
|
676 "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
|
677 ;; `bzr diff' exits with code 1 if diff is non-empty. |
106732
d804f575197b
(vc-bzr-diff): Obey vc-disable-async-diff.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106729
diff
changeset
|
678 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") |
d804f575197b
(vc-bzr-diff): Obey vc-disable-async-diff.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106729
diff
changeset
|
679 (if vc-disable-async-diff 1 'async) files |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
680 "--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
|
681 (vc-switches 'bzr 'diff) |
87649 | 682 " ") |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
683 ;; 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
|
684 ;; 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
|
685 (when (or rev1 rev2) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
686 (list "-r" (format "%s..%s" |
96002
26f719e36c03
(log-view-per-file-logs): Pacify byte compiler.
Juanma Barranquero <lekktu@gmail.com>
parents:
95966
diff
changeset
|
687 (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
|
688 (or rev2 "")))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
689 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
690 |
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
|
691 ;; 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
|
692 ;; straight integer revisions. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
693 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
694 (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
|
695 "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
|
696 (condition-case () |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
697 (delete-file file) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
698 (file-error nil)) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
699 (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
|
700 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
701 (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
|
702 "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
|
703 (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
|
704 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
705 (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
|
706 "Internal use.") |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
707 (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
|
708 |
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
|
709 (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
|
710 "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
|
711 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
|
712 property containing author and date information." |
106269
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
713 (apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all" |
93039
e48df1ee4371
Revert unintended change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
93035
diff
changeset
|
714 (if revision (list "-r" revision))) |
106269
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
715 (lexical-let ((table (make-hash-table :test 'equal))) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
716 (set-process-filter |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
717 (get-buffer-process buffer) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
718 (lambda (proc string) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
719 (when (process-buffer proc) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
720 (with-current-buffer (process-buffer proc) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
721 (setq string (concat (process-get proc :vc-left-over) string)) |
112128 | 722 ;; Eg: 102020 Gnus developers 20101020 | regexp." |
723 ;; As of bzr 2.2.2, no email address in whoami (which can | |
724 ;; lead to spaces in the author field) is allowed but discouraged. | |
725 ;; See bug#7792. | |
726 (while (string-match "^\\( *[0-9.]+ *\\) \\(.+?\\) +\\([0-9]\\{8\\}\\)\\( |.*\n\\)" string) | |
106269
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
727 (let* ((rev (match-string 1 string)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
728 (author (match-string 2 string)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
729 (date (match-string 3 string)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
730 (key (substring string (match-beginning 0) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
731 (match-beginning 4))) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
732 (line (match-string 4 string)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
733 (tag (gethash key table)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
734 (inhibit-read-only t)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
735 (setq string (substring string (match-end 0))) |
106461
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
736 (unless tag |
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
737 (setq tag |
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
738 (propertize |
106476
97d377672952
* vc-bzr.el (vc-bzr-annotate-command): More elegant form for last
Chong Yidong <cyd@stupidchicken.com>
parents:
106472
diff
changeset
|
739 (format "%s %-7.7s" rev author) |
106461
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
740 'help-echo (format "Revision: %d, author: %s, date: %s" |
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
741 (string-to-number rev) |
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
742 author date) |
26c68e7906a5
* vc-bzr.el (vc-bzr-annotate-command): Show author in annotation.
Chong Yidong <cyd@stupidchicken.com>
parents:
106388
diff
changeset
|
743 'mouse-face 'highlight)) |
106269
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
744 (puthash key tag table)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
745 (goto-char (process-mark proc)) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
746 (insert tag line) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
747 (move-marker (process-mark proc) (point)))) |
e90925cbde07
(vc-bzr-annotate-command): Make operation asynchronous.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106033
diff
changeset
|
748 (process-put proc :vc-left-over string))))))) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
749 |
96213
09da7727f35f
* vc-hg.el (vc-annotate-convert-time, vc-default-status-printer):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96128
diff
changeset
|
750 (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
|
751 |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
752 (defun vc-bzr-annotate-time () |
112238 | 753 (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
|
754 (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
|
755 (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
|
756 (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
|
757 (vc-annotate-convert-time |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
758 (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
|
759 (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
|
760 (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
|
761 (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
|
762 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
763 (defun vc-bzr-annotate-extract-revision-at-line () |
111878 | 764 "Return revision for current line of annotation buffer, or nil. |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
765 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
|
766 (save-excursion |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
767 (beginning-of-line) |
112128 | 768 (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
|
769 (match-string-no-properties 1)))) |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
770 |
78435
adc16e5bfb60
Remove comments about vc-bzr.el being a modified unofficial version.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78431
diff
changeset
|
771 (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
|
772 "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
|
773 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
|
774 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
|
775 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
|
776 stream. Standard error output is discarded." |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
777 (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
|
778 (cons |
94873
66788c63a40a
(vc-bzr-sha1, vc-bzr-command-discarding-stderr)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94847
diff
changeset
|
779 (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
|
780 (buffer-substring (point-min) (point-max))))) |
abd7f08fa06b
(vc-bzr-registered): Gracefully handle missing "bzr"
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
78404
diff
changeset
|
781 |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
782 (defstruct (vc-bzr-extra-fileinfo |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
783 (:copier nil) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
784 (: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
|
785 (:conc-name vc-bzr-extra-fileinfo->)) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
786 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
|
787 |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
788 (defun vc-bzr-dir-printer (info) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
789 "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
|
790 (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
|
791 (vc-default-dir-printer 'Bzr info) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
792 (when extra |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
793 (insert (propertize |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
794 (format " (renamed from %s)" |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
795 (vc-bzr-extra-fileinfo->extra-name extra)) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
796 'face 'font-lock-comment-face))))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
797 |
96539
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
798 ;; FIXME: this needs testing, it's probably incomplete. |
106677
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
799 (defun vc-bzr-after-dir-status (update-function relative-dir) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
800 (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
|
801 (translation '(("+N " . added) |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
802 ("-D " . removed) |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
803 (" 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
|
804 (" *" . 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
|
805 (" 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
|
806 ;; 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
|
807 (" D " . missing) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
808 ;; 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
|
809 ("C " . conflict) |
d9bc43f652b0
(vc-bzr-after-dir-status): Deal with execute bit changes.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
96213
diff
changeset
|
810 ("? " . unregistered) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
811 ;; 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
|
812 ("R " . renamed) |
107049
6791d69ed71e
(vc-bzr-after-dir-status): Match another renaming indicator.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106985
diff
changeset
|
813 ("RM " . renamed) |
98524
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
814 ;; 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
|
815 ;; 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
|
816 ("bzr" . not-found) |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
817 ;; If the tree is not up to date, bzr will print this warning: |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
818 ;; working tree is out of date, run 'bzr update' |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
819 ;; ignore it. |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
820 ;; FIXME: maybe this warning can be put in the vc-dir header... |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
821 ("wor" . not-found) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
822 ;; Ignore "P " and "P." for pending patches. |
106751
d94786c1fa6c
(vc-bzr-after-dir-status): Ignore pending merges.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106742
diff
changeset
|
823 ("P " . not-found) |
d94786c1fa6c
(vc-bzr-after-dir-status): Ignore pending merges.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106742
diff
changeset
|
824 ("P. " . not-found) |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
825 )) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
826 (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
|
827 (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
|
828 (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
|
829 (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
|
830 (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
|
831 (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
|
832 (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
|
833 (cond |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
834 ((eq translated 'conflict) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
835 ;; 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
|
836 ;; 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
|
837 ;; 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
|
838 (let* ((file |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
839 (buffer-substring-no-properties |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
840 ;;For files with conflicts the format is: |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
841 ;;C Text conflict in FILENAME |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
842 ;; Bah. |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
843 (+ (point) 21) (line-end-position))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
844 (entry (assoc file result))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
845 (when entry |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
846 (setf (nth 1 entry) 'conflict)))) |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
847 ((eq translated 'renamed) |
107049
6791d69ed71e
(vc-bzr-after-dir-status): Match another renaming indicator.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106985
diff
changeset
|
848 (re-search-forward "R[ M] \\(.*\\) => \\(.*\\)$" (line-end-position) t) |
106677
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
849 (let ((new-name (file-relative-name (match-string 2) relative-dir)) |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
850 (old-name (file-relative-name (match-string 1) relative-dir))) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
851 (push (list new-name 'edited |
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
852 (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
|
853 ;; 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
|
854 ((eq translated 'not-found)) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
855 (t |
106677
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
856 (push (list (file-relative-name |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
857 (buffer-substring-no-properties |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
858 (+ (point) 4) |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
859 (line-end-position)) relative-dir) |
98079
9fc5b62e3967
(vc-bzr-extra-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
97401
diff
changeset
|
860 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
|
861 (forward-line)) |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93976
diff
changeset
|
862 (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
|
863 |
94003
2ecb2ea8d5b5
Change `dir-status' to not take (and pass) status-buffer.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93976
diff
changeset
|
864 (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
|
865 "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
|
866 (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
|
867 (vc-exec-after |
106677
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
868 `(vc-bzr-after-dir-status (quote ,update-function) |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
869 ;; "bzr status" results are relative to |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
870 ;; the bzr root directory, NOT to the |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
871 ;; directory "bzr status" was invoked in. |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
872 ;; Ugh. |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
873 ;; We pass the relative directory here so |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
874 ;; that `vc-bzr-after-dir-status' can |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
875 ;; frob the results accordingly. |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
876 (file-relative-name ,dir (vc-bzr-root ,dir))))) |
93035
5f4eb3149e6d
* vc-bzr.el (vc-bzr-dir-status, vc-bzr-after-dir-status):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92980
diff
changeset
|
877 |
98524
622e1277bbf2
(vc-bzr-after-dir-status): Parse the output for non
Dan Nicolaescu <dann@ics.uci.edu>
parents:
98464
diff
changeset
|
878 (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
|
879 "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
|
880 (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
|
881 (vc-exec-after |
106677
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
882 `(vc-bzr-after-dir-status (quote ,update-function) |
f147ed43b1d5
Make vc-dir work on subdirectories of the bzr root.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106670
diff
changeset
|
883 (file-relative-name ,dir (vc-bzr-root ,dir))))) |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
884 |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
885 (defvar vc-bzr-shelve-map |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
886 (let ((map (make-sparse-keymap))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
887 ;; Turn off vc-dir marking |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
888 (define-key map [mouse-2] 'ignore) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
889 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
890 (define-key map [down-mouse-3] 'vc-bzr-shelve-menu) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
891 (define-key map "\C-k" 'vc-bzr-shelve-delete-at-point) |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
892 (define-key map "=" 'vc-bzr-shelve-show-at-point) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
893 (define-key map "\C-m" 'vc-bzr-shelve-show-at-point) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
894 (define-key map "A" 'vc-bzr-shelve-apply-and-keep-at-point) |
106729
b4d5ac4906a0
(vc-bzr-shelve-map): Change binding for vc-bzr-shelve-apply-at-point.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106724
diff
changeset
|
895 (define-key map "P" 'vc-bzr-shelve-apply-at-point) |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
896 (define-key map "S" 'vc-bzr-shelve-snapshot) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
897 map)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
898 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
899 (defvar vc-bzr-shelve-menu-map |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
900 (let ((map (make-sparse-keymap "Bzr Shelve"))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
901 (define-key map [de] |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
902 '(menu-item "Delete shelf" vc-bzr-shelve-delete-at-point |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
903 :help "Delete the current shelf")) |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
904 (define-key map [ap] |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
905 '(menu-item "Apply and keep shelf" vc-bzr-shelve-apply-and-keep-at-point |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
906 :help "Apply the current shelf and keep it")) |
106729
b4d5ac4906a0
(vc-bzr-shelve-map): Change binding for vc-bzr-shelve-apply-at-point.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106724
diff
changeset
|
907 (define-key map [po] |
b4d5ac4906a0
(vc-bzr-shelve-map): Change binding for vc-bzr-shelve-apply-at-point.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106724
diff
changeset
|
908 '(menu-item "Apply and remove shelf (pop)" vc-bzr-shelve-apply-at-point |
b4d5ac4906a0
(vc-bzr-shelve-map): Change binding for vc-bzr-shelve-apply-at-point.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106724
diff
changeset
|
909 :help "Apply the current shelf and remove it")) |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
910 (define-key map [sh] |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
911 '(menu-item "Show shelve" vc-bzr-shelve-show-at-point |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
912 :help "Show the contents of the current shelve")) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
913 map)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
914 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
915 (defvar vc-bzr-extra-menu-map |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
916 (let ((map (make-sparse-keymap))) |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
917 (define-key map [bzr-sn] |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
918 '(menu-item "Shelve a snapshot" vc-bzr-shelve-snapshot |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
919 :help "Shelve the current state of the tree and keep the current state")) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
920 (define-key map [bzr-sh] |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
921 '(menu-item "Shelve..." vc-bzr-shelve |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
922 :help "Shelve changes")) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
923 map)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
924 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
925 (defun vc-bzr-extra-menu () vc-bzr-extra-menu-map) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
926 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
927 (defun vc-bzr-extra-status-menu () vc-bzr-extra-menu-map) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
928 |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
929 (defun vc-bzr-dir-extra-headers (dir) |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
930 (let* |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
931 ((str (with-temp-buffer |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
932 (vc-bzr-command "info" t 0 dir) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
933 (buffer-string))) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
934 (shelve (vc-bzr-shelve-list)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
935 (shelve-help-echo "Use M-x vc-bzr-shelve to create shelves") |
107068
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
936 (root-dir (vc-bzr-root dir)) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
937 (pending-merge |
107097
6692a4cd2966
* vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107068
diff
changeset
|
938 ;; FIXME: looking for .bzr/checkout/merge-hashes is not a |
6692a4cd2966
* vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107068
diff
changeset
|
939 ;; reliable method to detect pending merges, disable this |
6692a4cd2966
* vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107068
diff
changeset
|
940 ;; until a proper solution is implemented. |
6692a4cd2966
* vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107068
diff
changeset
|
941 (and nil |
6692a4cd2966
* vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107068
diff
changeset
|
942 (file-exists-p |
6692a4cd2966
* vc-bzr.el (vc-bzr-dir-extra-headers): Disable the pending merges header.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107068
diff
changeset
|
943 (expand-file-name ".bzr/checkout/merge-hashes" root-dir)))) |
107068
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
944 (pending-merge-help-echo |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
945 (format "A merge has been performed.\nA commit from the top-level directory (%s)\nis required before being able to check in anything else" root-dir)) |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
946 (light-checkout |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
947 (when (string-match ".+light checkout root: \\(.+\\)$" str) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
948 (match-string 1 str))) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
949 (light-checkout-branch |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
950 (when light-checkout |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
951 (when (string-match ".+checkout of branch: \\(.+\\)$" str) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
952 (match-string 1 str))))) |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
953 (concat |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
954 (propertize "Parent branch : " 'face 'font-lock-type-face) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
955 (propertize |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
956 (if (string-match "parent branch: \\(.+\\)$" str) |
102704
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
957 (match-string 1 str) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
958 "None") |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
959 'face 'font-lock-variable-name-face) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
960 "\n" |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
961 (when light-checkout |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
962 (concat |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
963 (propertize "Light checkout root: " 'face 'font-lock-type-face) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
964 (propertize light-checkout 'face 'font-lock-variable-name-face) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
965 "\n")) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
966 (when light-checkout-branch |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
967 (concat |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
968 (propertize "Checkout of branch : " 'face 'font-lock-type-face) |
acda56dde7fb
(vc-bzr-working-revision): Add support for lightweight
Dan Nicolaescu <dann@ics.uci.edu>
parents:
101790
diff
changeset
|
969 (propertize light-checkout-branch 'face 'font-lock-variable-name-face) |
106388
afe271b2ef40
(vc-bzr-dir-extra-headers): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106387
diff
changeset
|
970 "\n")) |
107068
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
971 (when pending-merge |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
972 (concat |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
973 (propertize "Warning : " 'face 'font-lock-warning-face |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
974 'help-echo pending-merge-help-echo) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
975 (propertize "Pending merges, commit recommended before any other action" |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
976 'help-echo pending-merge-help-echo |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
977 'face 'font-lock-warning-face) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
978 "\n")) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
979 (if shelve |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
980 (concat |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
981 (propertize "Shelves :\n" 'face 'font-lock-type-face |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
982 'help-echo shelve-help-echo) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
983 (mapconcat |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
984 (lambda (x) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
985 (propertize x |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
986 'face 'font-lock-variable-name-face |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
987 'mouse-face 'highlight |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
988 'help-echo "mouse-3: Show shelve menu\nA: Apply and keep shelf\nP: Apply and remove shelf (pop)\nS: Snapshot to a shelf\nC-k: Delete shelf" |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
989 'keymap vc-bzr-shelve-map)) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
990 shelve "\n")) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
991 (concat |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
992 (propertize "Shelves : " 'face 'font-lock-type-face |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
993 'help-echo shelve-help-echo) |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
994 (propertize "No shelved changes" |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
995 'help-echo shelve-help-echo |
8d8e02bbef81
(vc-bzr-dir-extra-headers): Add a header when a
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107049
diff
changeset
|
996 'face 'font-lock-variable-name-face)))))) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
997 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
998 (defun vc-bzr-shelve (name) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
999 "Create a shelve." |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1000 (interactive "sShelf name: ") |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1001 (let ((root (vc-bzr-root default-directory))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1002 (when root |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1003 (vc-bzr-command "shelve" nil 0 nil "--all" "-m" name) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1004 (vc-resynch-buffer root t t)))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1005 |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1006 (defun vc-bzr-shelve-show (name) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1007 "Show the contents of shelve NAME." |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1008 (interactive "sShelve name: ") |
107979
bb75dfb8839a
* vc-bzr: Use standard *vc* and *vc-diff* buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107795
diff
changeset
|
1009 (vc-setup-buffer "*vc-diff*") |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1010 ;; FIXME: how can you show the contents of a shelf? |
107979
bb75dfb8839a
* vc-bzr: Use standard *vc* and *vc-diff* buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107795
diff
changeset
|
1011 (vc-bzr-command "unshelve" "*vc-diff*" 'async nil "--preview" name) |
bb75dfb8839a
* vc-bzr: Use standard *vc* and *vc-diff* buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107795
diff
changeset
|
1012 (set-buffer "*vc-diff*") |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1013 (diff-mode) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1014 (setq buffer-read-only t) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1015 (pop-to-buffer (current-buffer))) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1016 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1017 (defun vc-bzr-shelve-apply (name) |
106729
b4d5ac4906a0
(vc-bzr-shelve-map): Change binding for vc-bzr-shelve-apply-at-point.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106724
diff
changeset
|
1018 "Apply shelve NAME and remove it afterwards." |
b4d5ac4906a0
(vc-bzr-shelve-map): Change binding for vc-bzr-shelve-apply-at-point.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106724
diff
changeset
|
1019 (interactive "sApply (and remove) shelf: ") |
107979
bb75dfb8839a
* vc-bzr: Use standard *vc* and *vc-diff* buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107795
diff
changeset
|
1020 (vc-bzr-command "unshelve" nil 0 nil "--apply" name) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1021 (vc-resynch-buffer (vc-bzr-root default-directory) t t)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1022 |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1023 (defun vc-bzr-shelve-apply-and-keep (name) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1024 "Apply shelve NAME and keep it afterwards." |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1025 (interactive "sApply (and keep) shelf: ") |
107979
bb75dfb8839a
* vc-bzr: Use standard *vc* and *vc-diff* buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107795
diff
changeset
|
1026 (vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep" name) |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1027 (vc-resynch-buffer (vc-bzr-root default-directory) t t)) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1028 |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1029 (defun vc-bzr-shelve-snapshot () |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1030 "Create a stash with the current tree state." |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1031 (interactive) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1032 (vc-bzr-command "shelve" nil 0 nil "--all" "-m" |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1033 (let ((ct (current-time))) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1034 (concat |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1035 (format-time-string "Snapshot on %Y-%m-%d" ct) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1036 (format-time-string " at %H:%M" ct)))) |
107979
bb75dfb8839a
* vc-bzr: Use standard *vc* and *vc-diff* buffers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107795
diff
changeset
|
1037 (vc-bzr-command "unshelve" nil 0 nil "--apply" "--keep") |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1038 (vc-resynch-buffer (vc-bzr-root default-directory) t t)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1039 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1040 (defun vc-bzr-shelve-list () |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1041 (with-temp-buffer |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1042 (vc-bzr-command "shelve" (current-buffer) 1 nil "--list" "-q") |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1043 (delete |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1044 "" |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1045 (split-string |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1046 (buffer-substring (point-min) (point-max)) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1047 "\n")))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1048 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1049 (defun vc-bzr-shelve-get-at-point (point) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1050 (save-excursion |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1051 (goto-char point) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1052 (beginning-of-line) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1053 (if (looking-at "^ +\\([0-9]+\\):") |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1054 (match-string 1) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1055 (error "Cannot find shelf at point")))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1056 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1057 (defun vc-bzr-shelve-delete-at-point () |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1058 (interactive) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1059 (let ((shelve (vc-bzr-shelve-get-at-point (point)))) |
111878 | 1060 (when (y-or-n-p (format "Remove shelf %s ? " shelve)) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1061 (vc-bzr-command "unshelve" nil 0 nil "--delete-only" shelve) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1062 (vc-dir-refresh)))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1063 |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1064 (defun vc-bzr-shelve-show-at-point () |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1065 (interactive) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1066 (vc-bzr-shelve-show (vc-bzr-shelve-get-at-point (point)))) |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1067 |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1068 (defun vc-bzr-shelve-apply-at-point () |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1069 (interactive) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1070 (vc-bzr-shelve-apply (vc-bzr-shelve-get-at-point (point)))) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1071 |
107372
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1072 (defun vc-bzr-shelve-apply-and-keep-at-point () |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1073 (interactive) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1074 (vc-bzr-shelve-apply-and-keep (vc-bzr-shelve-get-at-point (point)))) |
b73242777fb9
Add support for shelving snapshots and for showing shelves.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
107175
diff
changeset
|
1075 |
106387
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1076 (defun vc-bzr-shelve-menu (e) |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1077 (interactive "e") |
e01e9655414f
Add support for bzr shelve/unshelve.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106386
diff
changeset
|
1078 (vc-dir-at-event e (popup-menu vc-bzr-shelve-menu-map e))) |
99388
fcdc9cfd2092
(vc-bzr-dir-extra-headers): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
98524
diff
changeset
|
1079 |
106982
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1080 (defun vc-bzr-revision-table (files) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1081 (let ((vc-bzr-revisions '()) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1082 (default-directory (file-name-directory (car files)))) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1083 (with-temp-buffer |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1084 (vc-bzr-command "log" t 0 files "--line") |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1085 (let ((start (point-min)) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1086 (loglines (buffer-substring-no-properties (point-min) (point-max)))) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1087 (while (string-match "^\\([0-9]+\\):" loglines) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1088 (push (match-string 1 loglines) vc-bzr-revisions) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1089 (setq start (+ start (match-end 0))) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1090 (setq loglines (buffer-substring-no-properties start (point-max)))))) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1091 vc-bzr-revisions)) |
38312121c181
working version of vc-bzr-revision-table
Mark A. Hershberger <mhershberger@intrahealth.org>
parents:
106819
diff
changeset
|
1092 |
108009
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1093 (defun vc-bzr-conflicted-files (dir) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1094 (let ((default-directory (vc-bzr-root dir)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1095 (files ())) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1096 (with-temp-buffer |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1097 (vc-bzr-command "status" t 0 default-directory) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1098 (goto-char (point-min)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1099 (when (re-search-forward "^conflicts:\n" nil t) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1100 (while (looking-at " \\(?:Text conflict in \\(.*\\)\\|.*\\)\n") |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1101 (if (match-end 1) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1102 (push (expand-file-name (match-string 1)) files)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1103 (goto-char (match-end 0))))) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1104 files)) |
17d3324f96dd
Make the log-edit comments use RFC822 format throughout.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107979
diff
changeset
|
1105 |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1106 ;;; Revision completion |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1107 |
105800
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1108 (eval-and-compile |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1109 (defconst vc-bzr-revision-keywords |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1110 '("revno" "revid" "last" "before" |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1111 "tag" "date" "ancestor" "branch" "submit"))) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1112 |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1113 (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
|
1114 (lexical-let ((files files)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1115 ;; 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
|
1116 (lambda (string pred action) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1117 (cond |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1118 ((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
|
1119 string) |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1120 (completion-table-with-context (substring string 0 (match-end 0)) |
108681
1b1048318854
* lisp/vc-bzr.el (vc-bzr-revision-completion-table): Apply
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107175
diff
changeset
|
1121 (apply-partially |
1b1048318854
* lisp/vc-bzr.el (vc-bzr-revision-completion-table): Apply
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107175
diff
changeset
|
1122 'completion-table-with-predicate |
1b1048318854
* lisp/vc-bzr.el (vc-bzr-revision-completion-table): Apply
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107175
diff
changeset
|
1123 'completion-file-name-table |
1b1048318854
* lisp/vc-bzr.el (vc-bzr-revision-completion-table): Apply
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107175
diff
changeset
|
1124 'file-directory-p t) |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1125 (substring string (match-end 0)) |
108681
1b1048318854
* lisp/vc-bzr.el (vc-bzr-revision-completion-table): Apply
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
107175
diff
changeset
|
1126 pred |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1127 action)) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1128 ((string-match "\\`\\(before\\):" string) |
94216
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1129 (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
|
1130 (vc-bzr-revision-completion-table files) |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1131 (substring string (match-end 0)) |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1132 pred |
34110d646fc8
(vc-bzr-complete-with-prefix): Remove.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94003
diff
changeset
|
1133 action)) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1134 ((string-match "\\`\\(tag\\):" string) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1135 (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
|
1136 (tag (substring string (match-end 0))) |
104595
cfc336042c1b
* vc-bzr.el (vc-bzr-sha1, vc-bzr-revision-completion-table):
Michael Albinus <michael.albinus@gmx.de>
parents:
104086
diff
changeset
|
1137 (table nil) |
cfc336042c1b
* vc-bzr.el (vc-bzr-sha1, vc-bzr-revision-completion-table):
Michael Albinus <michael.albinus@gmx.de>
parents:
104086
diff
changeset
|
1138 process-file-side-effects) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1139 (with-temp-buffer |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1140 ;; "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
|
1141 (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
|
1142 ;; 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
|
1143 ;; contain spaces. |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1144 (goto-char (point-min)) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1145 (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
|
1146 (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
|
1147 (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
|
1148 |
105800
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1149 ((string-match "\\`\\([a-z]+\\):" string) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1150 ;; no actual completion for the remaining keywords. |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1151 (completion-table-with-context (substring string 0 (match-end 0)) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1152 (if (member (match-string 1 string) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1153 vc-bzr-revision-keywords) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1154 ;; If it's a valid keyword, |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1155 ;; use a non-empty table to |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1156 ;; indicate it. |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1157 '("") nil) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1158 (substring string (match-end 0)) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1159 pred |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1160 action)) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1161 (t |
95228
451f4028c096
* minibuffer.el (completion-boundaries): Change calling convention, so
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95077
diff
changeset
|
1162 ;; 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
|
1163 ;; 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
|
1164 ;; the *Completions* output we want. |
105800
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1165 (complete-with-action action (eval-when-compile |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1166 (mapcar (lambda (s) (concat s ":")) |
35ac8b2ebcf2
(vc-bzr-revision-keywords): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105697
diff
changeset
|
1167 vc-bzr-revision-keywords)) |
92980
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1168 string pred)))))) |
ba464718dbd7
(vc-bzr-diff): Use a faster invocation when possible.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92938
diff
changeset
|
1169 |
111878 | 1170 (provide 'vc-bzr) |
78372
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1171 |
53ed644d1a88
* vc-bzr.el: New file (copied from the trunk).
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
diff
changeset
|
1172 ;;; vc-bzr.el ends here |