annotate lisp/vc-hg.el @ 88026:8fd9758cf44d

*** empty log message ***
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 27 Jan 2008 16:15:43 +0000
parents 5d58981e6690
children d42fe75822fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
1 ;;; vc-hg.el --- VC backend for the mercurial version control system
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
2
79721
73661ddc7ac7 Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79687
diff changeset
3 ;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
4
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
5 ;; Author: Ivan Kanis
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
6 ;; Keywords: tools
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
7
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
9
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
78236
9355f9b7bbff Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78211
diff changeset
12 ;; the Free Software Foundation; either version 3, or (at your option)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
13 ;; any later version.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
14
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
18 ;; GNU General Public License for more details.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
19
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
23 ;; Boston, MA 02110-1301, USA.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
24
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
25 ;;; Commentary:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
26
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
27 ;; This is a mercurial version control backend
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
28
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
29 ;;; Thanks:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
30
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
31 ;;; Bugs:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
32
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
33 ;;; Installation:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
34
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
35 ;;; Todo:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
36
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
37 ;; Implement the rest of the vc interface. See the comment at the
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
38 ;; beginning of vc.el. The current status is:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
39
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
40 ;; FUNCTION NAME STATUS
81982
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
41 ;; BACKEND PROPERTIES
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
42 ;; * revision-granularity OK
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
43 ;; STATE-QUERYING FUNCTIONS
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
44 ;; * registered (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
45 ;; * state (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
46 ;; - state-heuristic (file) ?? PROBABLY NOT NEEDED
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
47 ;; - dir-state (dir) OK
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
48 ;; * working-revision (file) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
49 ;; - latest-on-branch-p (file) ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
50 ;; * checkout-model (file) OK
78167
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
51 ;; - workfile-unchanged-p (file) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
52 ;; - mode-line-string (file) NOT NEEDED
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
53 ;; - dired-state-info (file) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
54 ;; STATE-CHANGING FUNCTIONS
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
55 ;; * register (files &optional rev comment) OK
81982
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
56 ;; * create-repo () OK
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
57 ;; - init-revision () NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
58 ;; - responsible-p (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
59 ;; - could-register (file) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
60 ;; - receive-file (file rev) ?? PROBABLY NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
61 ;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
62 ;; * checkin (files rev comment) OK
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
63 ;; * find-revision (file rev buffer) OK
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
64 ;; * checkout (file &optional editable rev) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
65 ;; * revert (file &optional contents-done) OK
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
66 ;; - rollback (files) ?? PROBABLY NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
67 ;; - merge (file rev1 rev2) NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
68 ;; - merge-news (file) NEEDED
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
69 ;; - steal-lock (file &optional revision) NOT NEEDED
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
70 ;; HISTORY FUNCTIONS
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
71 ;; * print-log (files &optional buffer) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
72 ;; - log-view-mode () OK
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
73 ;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
74 ;; - wash-log (file) ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
75 ;; - logentry-check () NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
76 ;; - comment-history (file) NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
77 ;; - update-changelog (files) NOT NEEDED
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
78 ;; * diff (files &optional rev1 rev2 buffer) OK
85462
43a9834cf1a6 * vc-bzr.el (vc-bzr-diff-tree):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85460
diff changeset
79 ;; - revision-completion-table (files) OK?
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
80 ;; - annotate-command (file buf &optional rev) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
81 ;; - annotate-time () OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
82 ;; - annotate-current-time () ?? NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
83 ;; - annotate-extract-revision-at-line () OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
84 ;; SNAPSHOT SYSTEM
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
85 ;; - create-snapshot (dir name branchp) NEEDED (probably branch?)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
86 ;; - assign-name (file name) NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
87 ;; - retrieve-snapshot (dir name update) ?? NEEDED??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
88 ;; MISCELLANEOUS
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
89 ;; - make-version-backups-p (file) ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
90 ;; - repository-hostname (dirname) ??
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
91 ;; - previous-revision (file rev) OK
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
92 ;; - next-revision (file rev) OK
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
93 ;; - check-headers () ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
94 ;; - clear-headers () ??
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
95 ;; - delete-file (file) TEST IT
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
96 ;; - rename-file (old new) OK
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
97 ;; - find-file-hook () PROBABLY NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
98 ;; - find-file-not-found-hook () PROBABLY NOT NEEDED
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
99
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
100 ;; Implement Stefan Monnier's advice:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
101 ;; vc-hg-registered and vc-hg-state
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
102 ;; Both of those functions should be super extra careful to fail gracefully in
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
103 ;; unexpected circumstances. The reason this is important is that any error
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
104 ;; there will prevent the user from even looking at the file :-(
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
105 ;; Ideally, just like in vc-arch and vc-cvs, checking that the file is under
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
106 ;; mercurial's control and extracting the current revision should be done
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
107 ;; without even using `hg' (this way even if you don't have `hg' installed,
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
108 ;; Emacs is able to tell you this file is under mercurial's control).
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
109
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
110 ;;; History:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
111 ;;
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
112
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
113 ;;; Code:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
114
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
115 (eval-when-compile
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
116 (require 'cl)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
117 (require 'vc))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
118
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
119 ;;; Customization options
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
120
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
121 (defcustom vc-hg-global-switches nil
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
122 "*Global switches to pass to any Hg command."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
123 :type '(choice (const :tag "None" nil)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
124 (string :tag "Argument String")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
125 (repeat :tag "Argument List"
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
126 :value ("")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
127 string))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
128 :version "22.2"
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
129 :group 'vc)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
130
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
131
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
132 ;;; Properties of the backend
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
133
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
134 (defun vc-hg-revision-granularity ()
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
135 'repository)
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
136
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
137 ;;; State querying functions
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
138
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
139 ;;;###autoload (defun vc-hg-registered (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
140 ;;;###autoload "Return non-nil if FILE is registered with hg."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
141 ;;;###autoload (if (vc-find-root file ".hg") ; short cut
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
142 ;;;###autoload (progn
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
143 ;;;###autoload (load "vc-hg")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
144 ;;;###autoload (vc-hg-registered file))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
145
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
146 ;; Modelled after the similar function in vc-bzr.el
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
147 (defun vc-hg-registered (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
148 "Return non-nil if FILE is registered with hg."
78166
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
149 (when (vc-hg-root file) ; short cut
87455
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
150 (let ((state (vc-hg-state file))) ; expensive
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
151 (vc-file-setprop file 'vc-state state)
87865
1a3c90d4d8fa * vc-hg.el (vc-hg-registered): Make it work for non-existent
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87844
diff changeset
152 (and state (not (memq state '(ignored unregistered)))))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
153
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
154 (defun vc-hg-state (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
155 "Hg-specific version of `vc-state'."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
156 (let*
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
157 ((status nil)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
158 (out
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
159 (with-output-to-string
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
160 (with-current-buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
161 standard-output
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
162 (setq status
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
163 (condition-case nil
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
164 ;; Ignore all errors.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
165 (call-process
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
166 "hg" nil t nil "--cwd" (file-name-directory file)
87455
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
167 "status" "-A" (file-name-nondirectory file))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
168 ;; Some problem happened. E.g. We can't find an `hg'
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
169 ;; executable.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
170 (error nil)))))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
171 (when (eq 0 status)
78166
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
172 (when (null (string-match ".*: No such file or directory$" out))
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
173 (let ((state (aref out 0)))
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
174 (cond
87574
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
175 ((eq state ?=) 'up-to-date)
78166
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
176 ((eq state ?A) 'edited)
516805bc7988 (vc-hg-registered): Replace if with when.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78148
diff changeset
177 ((eq state ?M) 'edited)
87450
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
178 ((eq state ?I) 'ignored)
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
179 ((eq state ?R) 'unregistered)
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
180 ((eq state ??) 'unregistered)
87574
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
181 ((eq state ?C) 'up-to-date) ;; Older mercurials use this
87455
06f57a4af48c (vc-hg-registered): Return the false when vc-hg-state
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87450
diff changeset
182 (t 'up-to-date)))))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
183
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
184 (defun vc-hg-dir-state (dir)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
185 (with-temp-buffer
87442
c5df210848ca * vc-bzr.el, vc-cvs.el, vc-git.el, vc-hg.el, vc-mcvs.el, vc-svn.el:
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87428
diff changeset
186 (buffer-disable-undo) ;; Because these buffers can get huge
87604
26665fb0f604 (vc-hg-dir-state, vc-hg-dir-status): Pass the dir
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87599
diff changeset
187 (vc-hg-command (current-buffer) nil dir "status" "-A")
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
188 (goto-char (point-min))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
189 (let ((status-char nil)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
190 (file nil))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
191 (while (not (eobp))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
192 (setq status-char (char-after))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
193 (setq file
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
194 (expand-file-name
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
195 (buffer-substring-no-properties (+ (point) 2)
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
196 (line-end-position))))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
197 (cond
87477
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
198 ;; State flag for a clean file is now C, might change to =.
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
199 ;; The rest of the possible states in "hg status" output:
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
200 ;; ! = deleted, but still tracked
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
201 ;; should not show up in vc-dired, so don't deal with them
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
202 ;; here.
87574
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
203
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
204 ;; Mercurial up to 0.9.5 used C, = is used now.
21fcd219fd6e * mouse.el (mouse-popup-menubar): Fix typo.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87480
diff changeset
205 ((or (eq status-char ?=) (eq status-char ?C))
87480
be64fe15280d (vc-hg-dir-state): Set the vc-backend property.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87477
diff changeset
206 (vc-file-setprop file 'vc-backend 'Hg)
87474
dc4354c7a6c7 (vc-hg-dir-state): Deal with the up-to-date state.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87455
diff changeset
207 (vc-file-setprop file 'vc-state 'up-to-date))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
208 ((eq status-char ?A)
79687
2fe98820fa48 * vc-git.el (vc-git-dir-state):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78404
diff changeset
209 (vc-file-setprop file 'vc-backend 'Hg)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
210 (vc-file-setprop file 'vc-working-revision "0")
87477
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
211 (vc-file-setprop file 'vc-state 'added))
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
212 ((eq status-char ?R)
87480
be64fe15280d (vc-hg-dir-state): Set the vc-backend property.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87477
diff changeset
213 (vc-file-setprop file 'vc-backend 'Hg)
87477
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
214 (vc-file-setprop file 'vc-state 'removed))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
215 ((eq status-char ?M)
79687
2fe98820fa48 * vc-git.el (vc-git-dir-state):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78404
diff changeset
216 (vc-file-setprop file 'vc-backend 'Hg)
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
217 (vc-file-setprop file 'vc-state 'edited))
87450
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
218 ((eq status-char ?I)
87480
be64fe15280d (vc-hg-dir-state): Set the vc-backend property.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87477
diff changeset
219 (vc-file-setprop file 'vc-backend 'Hg)
87450
71fc7b1db920 * vc-hooks.el (vc-state): Document new 'ignored and 'unregistered
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87442
diff changeset
220 (vc-file-setprop file 'vc-state 'ignored))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
221 ((eq status-char ??)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
222 (vc-file-setprop file 'vc-backend 'none)
87477
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
223 (vc-file-setprop file 'vc-state 'unregistered))
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
224 ((eq status-char ?!)
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
225 nil)
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
226 (t ;; Presently C, might change to = in 0.9.6
87480
be64fe15280d (vc-hg-dir-state): Set the vc-backend property.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87477
diff changeset
227 (vc-file-setprop file 'vc-backend 'Hg)
87477
b5060e79eb98 * vc-svn.el (vc-svn-parse-status): Recognize 'added, 'removed,
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87474
diff changeset
228 (vc-file-setprop file 'vc-state 'up-to-date)))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
229 (forward-line)))))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
230
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
231 (defun vc-hg-working-revision (file)
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
232 "Hg-specific version of `vc-working-revision'."
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
233 (let*
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
234 ((status nil)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
235 (out
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
236 (with-output-to-string
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
237 (with-current-buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
238 standard-output
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
239 (setq status
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
240 (condition-case nil
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
241 ;; Ignore all errors.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
242 (call-process
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
243 "hg" nil t nil "--cwd" (file-name-directory file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
244 "log" "-l1" (file-name-nondirectory file))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
245 ;; Some problem happened. E.g. We can't find an `hg'
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
246 ;; executable.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
247 (error nil)))))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
248 (when (eq 0 status)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
249 (if (string-match "changeset: *\\([0-9]*\\)" out)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
250 (match-string 1 out)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
251 "0"))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
252
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
253 ;;; History functions
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
254
87427
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
255 (defun vc-hg-print-log (files &optional buffer)
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
256 "Get change log associated with FILES."
87427
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
257 ;; `log-view-mode' needs to have the file names in order to function
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
258 ;; correctly. "hg log" does not print it, so we insert it here by
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
259 ;; hand.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
260
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
261 ;; `vc-do-command' creates the buffer, but we need it before running
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
262 ;; the command.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
263 (vc-setup-buffer buffer)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
264 ;; If the buffer exists from a previous invocation it might be
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
265 ;; read-only.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
266 (let ((inhibit-read-only t))
81982
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
267 ;; We need to loop and call "hg log" on each file separately.
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
268 ;; "hg log" with multiple file arguments mashes all the logs
87427
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
269 ;; together. Ironically enough, this puts us back near CVS
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
270 ;; which can't generate proper fileset logs either.
81982
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
271 (dolist (file files)
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
272 (with-current-buffer
d4b8336cd8f5 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81964
diff changeset
273 buffer
87427
1aea302af710 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 86234
diff changeset
274 (insert "Working file: " file "\n")) ;; Like RCS/CVS.
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
275 (vc-hg-command buffer 0 file "log"))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
276
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
277 (defvar log-view-message-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
278 (defvar log-view-file-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
279 (defvar log-view-font-lock-keywords)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
280
78404
27f00e50116a Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents: 78363
diff changeset
281 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
282 (require 'add-log) ;; we need the add-log faces
87428
ca399a1984c7 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 87427
diff changeset
283 (set (make-local-variable 'log-view-file-re) "^Working file:[ \t]+\\(.+\\)")
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
284 (set (make-local-variable 'log-view-message-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
285 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
286 (set (make-local-variable 'log-view-font-lock-keywords)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
287 (append
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
288 log-view-font-lock-keywords
79725
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
289 '(
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
290 ;; Handle the case:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
291 ;; user: FirstName LastName <foo@bar>
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
292 ("^user:[ \t]+\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]"
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
293 (1 'change-log-name)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
294 (2 'change-log-email))
79725
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
295 ;; Handle the cases:
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
296 ;; user: foo@bar
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
297 ;; and
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
298 ;; user: foo
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
299 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
4ceae4ec8fb2 (vc-hg-log-view-mode): Handle the user field better.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79722
diff changeset
300 (1 'change-log-email))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
301 ("^date: \\(.+\\)" (1 'change-log-date))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
302 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
303
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
304 (defun vc-hg-diff (files &optional oldvers newvers buffer)
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
305 "Get a difference report using hg between two revisions of FILES."
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
306 (let ((working (vc-working-revision (car files))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
307 (if (and (equal oldvers working) (not newvers))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
308 (setq oldvers nil))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
309 (if (and (not oldvers) newvers)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
310 (setq oldvers working))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
311 (apply #'vc-hg-command (or buffer "*vc-diff*") nil
81998
52950d8efd2b (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81986
diff changeset
312 (mapcar (lambda (file) (file-name-nondirectory file)) files)
52950d8efd2b (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81986
diff changeset
313 "--cwd" (file-name-directory (car files))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
314 "diff"
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
315 (append
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
316 (if oldvers
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
317 (if newvers
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
318 (list "-r" oldvers "-r" newvers)
79800
8cc70128affa (vc-hg-diff): Don't pass an empty string.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 79725
diff changeset
319 (list "-r" oldvers)))))))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
320
85460
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
321 (defun vc-hg-revision-table (files)
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
322 (let ((default-directory (file-name-directory (car files))))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
323 (with-temp-buffer
86234
860a7a8e779e * progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85510
diff changeset
324 (vc-hg-command t nil files "log" "--template" "{rev} ")
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
325 (split-string
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
326 (buffer-substring-no-properties (point-min) (point-max))))))
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
327
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
328 ;; Modelled after the similar function in vc-cvs.el
85460
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
329 (defun vc-hg-revision-completion-table (files)
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
330 (lexical-let ((files files)
78359
2dd5d799a16d * vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78236
diff changeset
331 table)
2dd5d799a16d * vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78236
diff changeset
332 (setq table (lazy-completion-table
85460
d36b2b98840f (vc-hg-revision-completion-table, vc-hg-revision-table): Make it work when the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85141
diff changeset
333 table (lambda () (vc-hg-revision-table files))))
78359
2dd5d799a16d * vc-git.el: (vc-directory-exclusion-list, vc-handled-backends):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78236
diff changeset
334 table))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
335
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
336 (defun vc-hg-annotate-command (file buffer &optional revision)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
337 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
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
338 Optional arg REVISION is a revision to annotate from."
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
339 (vc-hg-command buffer 0 file "annotate" "-d" "-n" (if revision (concat "-r" revision)))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
340 (with-current-buffer buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
341 (goto-char (point-min))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
342 (re-search-forward "^[0-9]")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
343 (delete-region (point-min) (1- (point)))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
344
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
345
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
346 ;; The format for one line output by "hg annotate -d -n" looks like this:
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
347 ;;215 Wed Jun 20 21:22:58 2007 -0700: CONTENTS
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
348 ;; i.e: VERSION_NUMBER DATE: CONTENTS
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
349 (defconst vc-hg-annotate-re "^[ \t]*\\([0-9]+\\) \\(.\\{30\\}\\): ")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
350
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
351 (defun vc-hg-annotate-time ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
352 (when (looking-at vc-hg-annotate-re)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
353 (goto-char (match-end 0))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
354 (vc-annotate-convert-time
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
355 (date-to-time (match-string-no-properties 2)))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
356
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
357 (defun vc-hg-annotate-extract-revision-at-line ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
358 (save-excursion
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
359 (beginning-of-line)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
360 (if (looking-at vc-hg-annotate-re) (match-string-no-properties 1))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
361
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
362 (defun vc-hg-previous-revision (file rev)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
363 (let ((newrev (1- (string-to-number rev))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
364 (when (>= newrev 0)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
365 (number-to-string newrev))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
366
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
367 (defun vc-hg-next-revision (file rev)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
368 (let ((newrev (1+ (string-to-number rev)))
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
369 (tip-revision
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
370 (with-temp-buffer
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
371 (vc-hg-command t 0 nil "tip")
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
372 (goto-char (point-min))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
373 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
374 (string-to-number (match-string-no-properties 1)))))
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
375 ;; We don't want to exceed the maximum possible revision number, ie
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
376 ;; the tip 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
377 (when (<= newrev tip-revision)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
378 (number-to-string newrev))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
379
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
380 ;; Modelled after the similar function in vc-bzr.el
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
381 (defun vc-hg-delete-file (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
382 "Delete FILE and delete it in the hg repository."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
383 (condition-case ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
384 (delete-file file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
385 (file-error nil))
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
386 (vc-hg-command nil 0 file "remove" "--after" "--force"))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
387
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
388 ;; Modelled after the similar function in vc-bzr.el
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
389 (defun vc-hg-rename-file (old new)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
390 "Rename file from OLD to NEW using `hg mv'."
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
391 (vc-hg-command nil 0 new old "mv"))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
392
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
393 (defun vc-hg-register (files &optional rev comment)
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
394 "Register FILES under hg.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
395 REV is ignored.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
396 COMMENT is ignored."
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
397 (vc-hg-command nil 0 files "add"))
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
398
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
399 (defun vc-hg-create-repo ()
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
400 "Create a new Mercurial repository."
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
401 (vc-hg-command nil 0 nil "init"))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
402
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
403 (defalias 'vc-hg-responsible-p 'vc-hg-root)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
404
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
405 ;; Modelled after the similar function in vc-bzr.el
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
406 (defun vc-hg-could-register (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
407 "Return non-nil if FILE could be registered under hg."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
408 (and (vc-hg-responsible-p file) ; shortcut
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
409 (condition-case ()
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
410 (with-temp-buffer
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
411 (vc-hg-command t nil file "add" "--dry-run"))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
412 ;; The command succeeds with no output if file is
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
413 ;; registered.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
414 (error))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
415
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
416 ;; XXX This would remove the file. Is that correct?
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
417 ;; (defun vc-hg-unregister (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
418 ;; "Unregister FILE from hg."
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
419 ;; (vc-hg-command nil nil file "remove"))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
420
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
421 (defun vc-hg-checkin (files rev comment)
78404
27f00e50116a Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents: 78363
diff changeset
422 "Hg-specific version of `vc-backend-checkin'.
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
423 REV is ignored."
82012
878cfe0c0c5a (vc-hg-dir-state): Fix loop.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 81998
diff changeset
424 (vc-hg-command nil 0 files "commit" "-m" comment))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
425
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
426 (defun vc-hg-find-revision (file rev buffer)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
427 (let ((coding-system-for-read 'binary)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
428 (coding-system-for-write 'binary))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
429 (if rev
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
430 (vc-hg-command buffer 0 file "cat" "-r" rev)
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
431 (vc-hg-command buffer 0 file "cat"))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
432
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
433 ;; Modelled after the similar function in vc-bzr.el
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
434 (defun vc-hg-checkout (file &optional editable rev)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
435 "Retrieve a revision of FILE.
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
436 EDITABLE is ignored.
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
437 REV is the revision to check out into WORKFILE."
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
438 (let ((coding-system-for-read 'binary)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
439 (coding-system-for-write 'binary))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
440 (with-current-buffer (or (get-file-buffer file) (current-buffer))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
441 (if rev
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
442 (vc-hg-command t 0 file "cat" "-r" rev)
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
443 (vc-hg-command t 0 file "cat")))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
444
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
445 (defun vc-hg-checkout-model (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
446 'implicit)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
447
78167
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
448 ;; Modelled after the similar function in vc-bzr.el
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
449 (defun vc-hg-workfile-unchanged-p (file)
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
450 (eq 'up-to-date (vc-hg-state file)))
252b7f091c04 (vc-hg-workfile-unchanged-p): New function.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78166
diff changeset
451
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
452 (defun vc-hg-dired-state-info (file)
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
453 "Hg-specific version of `vc-dired-state-info'."
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
454 (let ((hg-state (vc-state file)))
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
455 (if (eq hg-state 'edited)
85139
8ba0e30716a5 Terminology cleanup.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 83759
diff changeset
456 (if (equal (vc-working-revision file) "0")
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
457 "(added)" "(modified)")
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
458 ;; fall back to the default VC representation
78404
27f00e50116a Change capitalization of VC backend names for new backends
Miles Bader <miles@gnu.org>
parents: 78363
diff changeset
459 (vc-default-dired-state-info 'Hg file))))
78148
9cbb2ce8ec8c (vc-hg-state): Handle removed files.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78086
diff changeset
460
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
461 ;; Modelled after the similar function in vc-bzr.el
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
462 (defun vc-hg-revert (file &optional contents-done)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
463 (unless contents-done
78182
86c8d81f944f (vc-hg-diff): Use vc-hg-command.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78167
diff changeset
464 (with-temp-buffer (vc-hg-command t 0 file "revert"))))
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
465
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
466 ;;; Hg specific functionality.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
467
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
468 ;;; XXX This functionality is experimental/work in progress. It might
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
469 ;;; change without notice.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
470 (defvar vc-hg-extra-menu-map
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
471 (let ((map (make-sparse-keymap)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
472 (define-key map [incoming] '(menu-item "Show incoming" vc-hg-incoming))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
473 (define-key map [outgoing] '(menu-item "Show outgoing" vc-hg-outgoing))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
474 map))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
475
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
476 (defun vc-hg-extra-menu () vc-hg-extra-menu-map)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
477
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
478 (define-derived-mode vc-hg-outgoing-mode vc-hg-log-view-mode "Hg-Outgoing")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
479
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
480 (define-derived-mode vc-hg-incoming-mode vc-hg-log-view-mode "Hg-Incoming")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
481
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
482 ;; XXX Experimental function for the vc-dired replacement.
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
483 (defun vc-hg-after-dir-status (update-function buff)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
484 (let ((status-char nil)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
485 (file nil)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
486 (translation '((?= . up-to-date)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
487 (?C . up-to-date)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
488 (?A . added)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
489 (?R . removed)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
490 (?M . edited)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
491 (?I . ignored)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
492 (?! . deleted)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
493 (?? . unregistered)))
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
494 (translated nil)
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
495 (result nil))
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
496 (goto-char (point-min))
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
497 (while (not (eobp))
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
498 (setq status-char (char-after))
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
499 (setq file
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
500 (buffer-substring-no-properties (+ (point) 2)
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
501 (line-end-position)))
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
502 (setq translated (assoc status-char translation))
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
503 (when (and translated (not (eq (cdr translated) 'up-to-date)))
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
504 (push (cons file (cdr translated)) result))
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
505 (forward-line))
87844
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
506 (funcall update-function result buff)))
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
507
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
508 ;; XXX Experimental function for the vc-dired replacement.
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
509 (defun vc-hg-dir-status (dir update-function status-buffer)
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
510 "Return a list of conses (file . state) for DIR."
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
511 (with-current-buffer
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
512 (get-buffer-create
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
513 (expand-file-name " *VC-hg* tmp status" dir))
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
514 (vc-hg-command (current-buffer) 'async dir "status")
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
515 (vc-exec-after
3bd7c8c8bbe7 * vc.el: Make vc-status asynchronous.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87674
diff changeset
516 `(vc-hg-after-dir-status (quote ,update-function) ,status-buffer))))
87599
efe45ef69877 * vc.el (vc-status-fileinfo): New defstruct.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 87574
diff changeset
517
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
518 ;; XXX this adds another top level menu, instead figure out how to
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
519 ;; replace the Log-View menu.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
520 (easy-menu-define log-view-mode-menu vc-hg-outgoing-mode-map
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
521 "Hg-outgoing Display Menu"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
522 `("Hg-outgoing"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
523 ["Push selected" vc-hg-push]))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
524
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
525 (easy-menu-define log-view-mode-menu vc-hg-incoming-mode-map
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
526 "Hg-incoming Display Menu"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
527 `("Hg-incoming"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
528 ["Pull selected" vc-hg-pull]))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
529
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
530 (defun vc-hg-outgoing ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
531 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
532 (let ((bname "*Hg outgoing*"))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
533 (vc-hg-command bname 0 nil "outgoing" "-n")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
534 (pop-to-buffer bname)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
535 (vc-hg-outgoing-mode)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
536
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
537 (defun vc-hg-incoming ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
538 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
539 (let ((bname "*Hg incoming*"))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
540 (vc-hg-command bname 0 nil "incoming" "-n")
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
541 (pop-to-buffer bname)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
542 (vc-hg-incoming-mode)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
543
86234
860a7a8e779e * progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85510
diff changeset
544 (declare-function log-view-get-marked "log-view" ())
860a7a8e779e * progmodes/octave-mod.el (inferior-octave-send-list-and-digest):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85510
diff changeset
545
83759
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
546 ;; XXX maybe also add key bindings for these functions.
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
547 (defun vc-hg-push ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
548 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
549 (let ((marked-list (log-view-get-marked)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
550 (if marked-list
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
551 (vc-hg-command
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
552 nil 0 nil
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
553 (cons "push"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
554 (apply 'nconc
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
555 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
556 (error "No log entries selected for push"))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
557
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
558 (defun vc-hg-pull ()
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
559 (interactive)
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
560 (let ((marked-list (log-view-get-marked)))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
561 (if marked-list
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
562 (vc-hg-command
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
563 nil 0 nil
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
564 (cons "pull"
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
565 (apply 'nconc
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
566 (mapcar (lambda (arg) (list "-r" arg)) marked-list))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
567 (error "No log entries selected for pull"))))
493b2df20f41 (vc-hg-extra-menu-map): New variable.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 82245
diff changeset
568
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
569 ;;; Internal functions
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
570
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
571 (defun vc-hg-command (buffer okstatus file-or-list &rest flags)
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
572 "A wrapper around `vc-do-command' for use in vc-hg.el.
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
573 The difference to vc-do-command is that this function always invokes `hg',
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
574 and that it passes `vc-hg-global-switches' to it before FLAGS."
81964
ba5a7f46413b Put the lower half (the back-end) of NewVC in place. This commit
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 81757
diff changeset
575 (apply 'vc-do-command buffer okstatus "hg" file-or-list
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
576 (if (stringp vc-hg-global-switches)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
577 (cons vc-hg-global-switches flags)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
578 (append vc-hg-global-switches
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
579 flags))))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
580
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
581 (defun vc-hg-root (file)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
582 (vc-find-root file ".hg"))
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
583
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
584 (provide 'vc-hg)
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
585
78086
9a13508185dc Add arch tagline
Miles Bader <miles@gnu.org>
parents: 78075
diff changeset
586 ;; arch-tag: bd094dc5-715a-434f-a331-37b9fb7cd954
78075
dbe1fd006899 vc-hg.el: New file.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
diff changeset
587 ;;; vc-hg.el ends here