PageRenderTime 53ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/emacs/elisp/psvn.el

http://inkedmn.googlecode.com/
Emacs Lisp | 4224 lines | 3346 code | 382 blank | 496 comment | 145 complexity | 90d3eb1b61bff1a0773ff6e4d7dc70ba MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. ;;; psvn.el --- Subversion interface for emacs
  2. ;; Copyright (C) 2002-2006 by Stefan Reichoer
  3. ;; Author: Stefan Reichoer, <stefan@xsteve.at>
  4. ;; $Id: psvn.el 19791 2006-05-23 19:37:33Z xsteve $
  5. ;; psvn.el is free software; you can redistribute it and/or modify
  6. ;; it under the terms of the GNU General Public License as published by
  7. ;; the Free Software Foundation; either version 2, or (at your option)
  8. ;; any later version.
  9. ;; psvn.el is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;; You should have received a copy of the GNU General Public License
  14. ;; along with GNU Emacs; see the file COPYING. If not, write to
  15. ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  16. ;; Boston, MA 02111-1307, USA.
  17. ;;; Commentary
  18. ;; psvn.el is tested with GNU Emacs 21.3 on windows, debian linux,
  19. ;; freebsd5, red hat el3 with svn 1.2.3
  20. ;; psvn.el is an interface for the revision control tool subversion
  21. ;; (see http://subversion.tigris.org)
  22. ;; psvn.el provides a similar interface for subversion as pcl-cvs for cvs.
  23. ;; At the moment the following commands are implemented:
  24. ;;
  25. ;; M-x svn-status: run 'svn -status -v'
  26. ;; M-x svn-examine (like pcl-cvs cvs-examine) is alias for svn-status
  27. ;;
  28. ;; and show the result in the svn-status-buffer-name buffer (normally: *svn-status*).
  29. ;; If svn-status-verbose is set to nil, only "svn status" without "-v"
  30. ;; is run. Currently you have to toggle this variable manually.
  31. ;; This buffer uses svn-status mode in which the following keys are defined:
  32. ;; g - svn-status-update: run 'svn status -v'
  33. ;; M-s - svn-status-update: run 'svn status -v'
  34. ;; C-u g - svn-status-update: run 'svn status -vu'
  35. ;; = - svn-status-show-svn-diff run 'svn diff'
  36. ;; l - svn-status-show-svn-log run 'svn log'
  37. ;; i - svn-status-info run 'svn info'
  38. ;; r - svn-status-revert run 'svn revert'
  39. ;; X v - svn-status-resolved run 'svn resolved'
  40. ;; U - svn-status-update-cmd run 'svn update'
  41. ;; M-u - svn-status-update-cmd run 'svn update'
  42. ;; c - svn-status-commit run 'svn commit'
  43. ;; a - svn-status-add-file run 'svn add --non-recursive'
  44. ;; A - svn-status-add-file-recursively run 'svn add'
  45. ;; + - svn-status-make-directory run 'svn mkdir'
  46. ;; R - svn-status-mv run 'svn mv'
  47. ;; D - svn-status-rm run 'svn rm'
  48. ;; M-c - svn-status-cleanup run 'svn cleanup'
  49. ;; b - svn-status-blame run 'svn blame'
  50. ;; X e - svn-status-export run 'svn export'
  51. ;; RET - svn-status-find-file-or-examine-directory
  52. ;; ^ - svn-status-examine-parent
  53. ;; ~ - svn-status-get-specific-revision
  54. ;; E - svn-status-ediff-with-revision
  55. ;; X X - svn-status-resolve-conflicts
  56. ;; s - svn-status-show-process-buffer
  57. ;; e - svn-status-toggle-edit-cmd-flag
  58. ;; ? - svn-status-toggle-hide-unknown
  59. ;; _ - svn-status-toggle-hide-unmodified
  60. ;; m - svn-status-set-user-mark
  61. ;; u - svn-status-unset-user-mark
  62. ;; $ - svn-status-toggle-elide
  63. ;; w - svn-status-copy-filename-as-kill
  64. ;; DEL - svn-status-unset-user-mark-backwards
  65. ;; * ! - svn-status-unset-all-usermarks
  66. ;; * ? - svn-status-mark-unknown
  67. ;; * A - svn-status-mark-added
  68. ;; * M - svn-status-mark-modified
  69. ;; * D - svn-status-mark-deleted
  70. ;; * * - svn-status-mark-changed
  71. ;; . - svn-status-goto-root-or-return
  72. ;; f - svn-status-find-file
  73. ;; o - svn-status-find-file-other-window
  74. ;; v - svn-status-view-file-other-window
  75. ;; I - svn-status-parse-info
  76. ;; V - svn-status-svnversion
  77. ;; P l - svn-status-property-list
  78. ;; P s - svn-status-property-set
  79. ;; P d - svn-status-property-delete
  80. ;; P e - svn-status-property-edit-one-entry
  81. ;; P i - svn-status-property-ignore-file
  82. ;; P I - svn-status-property-ignore-file-extension
  83. ;; P C-i - svn-status-property-edit-svn-ignore
  84. ;; P k - svn-status-property-set-keyword-list
  85. ;; P y - svn-status-property-set-eol-style
  86. ;; P x - svn-status-property-set-executable
  87. ;; h - svn-status-use-history
  88. ;; q - svn-status-bury-buffer
  89. ;; C-x C-j - svn-status-dired-jump
  90. ;; The output in the buffer contains this header to ease reading
  91. ;; of svn output:
  92. ;; FPH BASE CMTD Author em File
  93. ;; F = Filemark
  94. ;; P = Property mark
  95. ;; H = History mark
  96. ;; BASE = local base revision
  97. ;; CMTD = last committed revision
  98. ;; Author = author of change
  99. ;; em = "**" or "(Update Available)" [see `svn-status-short-mod-flag-p']
  100. ;; if file can be updated
  101. ;; File = path/filename
  102. ;;
  103. ;; To use psvn.el put the following line in your .emacs:
  104. ;; (require 'psvn)
  105. ;; Start the svn interface with M-x svn-status
  106. ;; The latest version of psvn.el can be found at:
  107. ;; http://www.xsteve.at/prg/emacs/psvn.el
  108. ;; Or you can check it out from the subversion repository:
  109. ;; svn co http://svn.collab.net/repos/svn/trunk/contrib/client-side/psvn psvn
  110. ;; TODO:
  111. ;; * shortcut for svn propset svn:keywords "Date" psvn.el
  112. ;; * docstrings for the functions
  113. ;; * perhaps shortcuts for ranges, dates
  114. ;; * when editing the command line - offer help from the svn client
  115. ;; * finish svn-status-property-set
  116. ;; * Add repository browser
  117. ;; * Improve support for svn blame
  118. ;; * Get rid of all byte-compiler warnings
  119. ;; * SVK working copy support
  120. ;; * multiple independent buffers in svn-status-mode
  121. ;; There are "TODO" comments in other parts of this file as well.
  122. ;; Overview over the implemented/not (yet) implemented svn sub-commands:
  123. ;; * add implemented
  124. ;; * blame implemented
  125. ;; * cat implemented
  126. ;; * checkout (co)
  127. ;; * cleanup implemented
  128. ;; * commit (ci) implemented
  129. ;; * copy (cp)
  130. ;; * delete (del, remove, rm) implemented
  131. ;; * diff (di) implemented
  132. ;; * export implemented
  133. ;; * help (?, h)
  134. ;; * import
  135. ;; * info implemented
  136. ;; * list (ls) implemented
  137. ;; * lock
  138. ;; * log implemented
  139. ;; * merge
  140. ;; * mkdir implemented
  141. ;; * move (mv, rename, ren) implemented
  142. ;; * propdel (pdel) implemented
  143. ;; * propedit (pedit, pe) not needed
  144. ;; * propget (pget, pg) used
  145. ;; * proplist (plist, pl) implemented
  146. ;; * propset (pset, ps) used
  147. ;; * resolved implemented
  148. ;; * revert implemented
  149. ;; * status (stat, st) implemented
  150. ;; * switch (sw)
  151. ;; * unlock
  152. ;; * update (up) implemented
  153. ;; For the not yet implemented commands you should use the command line
  154. ;; svn client. If there are user requests for any missing commands I will
  155. ;; probably implement them.
  156. ;; Comments / suggestions and bug reports are welcome!
  157. ;; Development notes
  158. ;; -----------------
  159. ;; "svn-" is the package prefix used in psvn.el. There are also longer
  160. ;; prefixes which clarify the code and help symbol completion, but they
  161. ;; are not intended to prevent name clashes with other packages. All
  162. ;; interactive commands meant to be used only in a specific mode should
  163. ;; have names beginning with the name of that mode: for example,
  164. ;; "svn-status-add-file" in "svn-status-mode". "psvn" should be used
  165. ;; only in names of files, customization groups, and features. If SVK
  166. ;; support is ever added, it should use "svn-svk-" when no existing
  167. ;; prefix is applicable.
  168. ;; Many of the variables marked as `risky-local-variable' are probably
  169. ;; impossible to abuse, as the commands that read them are used only in
  170. ;; buffers that are not visiting any files. Better safe than sorry.
  171. ;;; Code:
  172. (require 'easymenu)
  173. (condition-case nil
  174. (progn
  175. (require 'diff-mode))
  176. (error nil))
  177. (defconst svn-psvn-revision "$Id: psvn.el 19791 2006-05-23 19:37:33Z xsteve $"
  178. "The revision number of psvn.")
  179. ;;; user setable variables
  180. (defcustom svn-status-verbose t
  181. "*Add '-v' to svn status call."
  182. :type 'boolean
  183. :group 'psvn)
  184. (defcustom svn-log-edit-file-name "++svn-log++"
  185. "*Name of a saved log file.
  186. This can be either absolute, or relative to the default directory
  187. of the *svn-log-edit* buffer."
  188. :type 'file
  189. :group 'psvn)
  190. (put 'svn-log-edit-file-name 'risky-local-variable t)
  191. (defcustom svn-log-edit-insert-files-to-commit t
  192. "*Insert the filelist to commit in the *svn-log* buffer"
  193. :type 'boolean
  194. :group 'psvn)
  195. (defcustom svn-log-edit-use-log-edit-mode
  196. (and (condition-case nil (require 'log-edit) (error nil)) t)
  197. "*Use log-edit-mode as base for svn-log-edit-mode
  198. This variable takes effect only when psvn.el is being loaded."
  199. :type 'boolean
  200. :group 'psvn)
  201. (defcustom svn-status-hide-unknown nil
  202. "*Hide unknown files in `svn-status-buffer-name' buffer.
  203. This can be toggled with \\[svn-status-toggle-hide-unknown]."
  204. :type 'boolean
  205. :group 'psvn)
  206. (defcustom svn-status-hide-unmodified nil
  207. "*Hide unmodified files in `svn-status-buffer-name' buffer.
  208. This can be toggled with \\[svn-status-toggle-hide-unmodified]."
  209. :type 'boolean
  210. :group 'psvn)
  211. (defcustom svn-status-sort-status-buffer t
  212. "*Whether to sort the `svn-status-buffer-name' buffer.
  213. Setting this variable to nil speeds up \[M-x svn-status], however the
  214. listing may then become incorrect.
  215. This can be toggled with \\[svn-status-toggle-sort-status-buffer]."
  216. :type 'boolean
  217. :group 'psvn)
  218. (defcustom svn-status-unmark-files-after-list '(commit revert)
  219. "*List of operations after which all user marks will be removed.
  220. Possible values are: commit, revert."
  221. :type '(set (const commit)
  222. (const revert))
  223. :group 'psvn)
  224. (defcustom svn-status-preserve-window-configuration nil
  225. "*Try to preserve the window configuration."
  226. :type 'boolean
  227. :group 'psvn)
  228. (defcustom svn-status-negate-meaning-of-arg-commands '()
  229. "*List of operations that should use a negated meaning of the prefix argument.
  230. The supported functions are `svn-status' and `svn-status-set-user-mark'."
  231. :type '(set (function-item svn-status)
  232. (function-item svn-status-set-user-mark))
  233. :group 'psvn)
  234. (defcustom svn-status-svn-executable "svn"
  235. "*The name of the svn executable.
  236. This can be either absolute or looked up on `exec-path'."
  237. ;; Don't use (file :must-match t). It doesn't know about `exec-path'.
  238. :type 'file
  239. :group 'psvn)
  240. (put 'svn-status-svn-executable 'risky-local-variable t)
  241. (defcustom svn-status-default-export-directory "~/" "*The default directory that is suggested svn export."
  242. :type 'file
  243. :group 'psvn)
  244. (defcustom svn-status-svn-environment-var-list '()
  245. "*A list of environment variables that should be set for that svn process.
  246. Each element is either a string \"VARIABLE=VALUE\" which will be added to
  247. the environment when svn is run, or just \"VARIABLE\" which causes that
  248. variable to be entirely removed from the environment.
  249. You could set this for example to '(\"LANG=C\")"
  250. :type '(repeat string)
  251. :group 'psvn)
  252. (put 'svn-status-svn-environment-var-list 'risky-local-variable t)
  253. (defcustom svn-browse-url-function nil
  254. ;; If the user hasn't changed `svn-browse-url-function', then changing
  255. ;; `browse-url-browser-function' should affect psvn even after it has
  256. ;; been loaded.
  257. "Function to display a Subversion related WWW page in a browser.
  258. So far, this is used only for \"trac\" issue tracker integration.
  259. By default, this is nil, which means use `browse-url-browser-function'.
  260. Any non-nil value overrides that variable, with the same syntax."
  261. ;; It would be nice to show the full list of browsers supported by
  262. ;; browse-url, but (custom-variable-type 'browse-url-browser-function)
  263. ;; returns just `function' if browse-url has not yet been loaded,
  264. ;; and there seems to be no easy way to autoload browse-url when
  265. ;; the custom-type of svn-browse-url-function is actually needed.
  266. ;; So I'll only offer enough choices to cover all supported types.
  267. :type `(choice (const :tag "Specified by `browse-url-browser-function'" nil)
  268. (function :value browse-url-default-browser
  269. ;; In XEmacs 21.4.17, the `function' widget matches
  270. ;; all objects. Constrain it here so that alists
  271. ;; fall through to the next choice. Accept either
  272. ;; a symbol (fbound or not) or a lambda expression.
  273. :match ,(lambda (widget value)
  274. (or (symbolp value) (functionp value))))
  275. (svn-alist :tag "Regexp/function association list"
  276. :key-type regexp :value-type function
  277. :value (("." . browse-url-default-browser))))
  278. :link '(emacs-commentary-link "browse-url")
  279. :group 'psvn)
  280. ;; (put 'svn-browse-url-function 'risky-local-variable t)
  281. ;; already implied by "-function" suffix
  282. (defcustom svn-status-window-alist
  283. '((diff "*svn-diff*") (log "*svn-log*") (info t) (blame t) (proplist t) (update t))
  284. "An alist to specify which windows should be used for svn command outputs.
  285. The following keys are supported: diff, log, info, blame, proplist, update.
  286. The following values can be given:
  287. nil ... show in *svn-process* buffer
  288. t ... show in dedicated *svn-info* buffer
  289. invisible ... don't show the buffer (eventually useful for update)
  290. a string ... show in a buffer named string"
  291. :type '(svn-alist
  292. :key-type symbol
  293. :value-type (group
  294. (choice
  295. (const :tag "Show in *svn-process* buffer" nil)
  296. (const :tag "Show in dedicated *svn-info* buffer" t)
  297. (const :tag "Don't show the output" invisible)
  298. (string :tag "Show in a buffer named"))))
  299. :options '(diff log info blame proplist update)
  300. :group 'psvn)
  301. (defcustom svn-status-short-mod-flag-p t
  302. "*Whether the mark for out of date files is short or long.
  303. If this variable is is t, and a file is out of date (i.e., there is a newer
  304. version in the repository than the working copy), then the file will
  305. be marked by \"**\"
  306. If this variable is nil, and the file is out of date then the longer phrase
  307. \"(Update Available)\" is used.
  308. In either case the mark gets the face
  309. `svn-status-update-available-face', and will only be visible if
  310. `\\[svn-status-update]' is run with a prefix argument"
  311. :type '(choice (const :tag "Short \"**\"" t)
  312. (const :tag "Long \"(Update Available)\"" nil))
  313. :group 'psvn)
  314. (defvar svn-status-debug-level 0 "The psvn.el debugging verbosity level.
  315. The higher the number, the more debug messages are shown.
  316. See `svn-status-message' for the meaning of values for that variable.")
  317. (defvar svn-status-buffer-name "*svn-status*" "Name for the svn status buffer")
  318. (defcustom svn-status-use-header-line
  319. (if (boundp 'header-line-format) t 'inline)
  320. "*Whether a header line should be used.
  321. When t: Use the emacs header line
  322. When 'inline: Insert the header line in the `svn-status-buffer-name' buffer
  323. Otherwise: Don't display a header line"
  324. :type '(choice (const :tag "Show column titles as a header line" t)
  325. (const :tag "Insert column titles as text in the buffer" inline)
  326. (other :tag "No column titles" nil))
  327. :group 'psvn)
  328. ;;; default arguments to pass to svn commands
  329. ;; TODO: When customizing, an option menu or completion might be nice....
  330. (defcustom svn-status-default-log-arguments '()
  331. "*List of arguments to pass to svn log.
  332. \(used in `svn-status-show-svn-log'; override these by giving prefixes\)."
  333. :type '(repeat string)
  334. :group 'psvn)
  335. (put 'svn-status-default-log-arguments 'risky-local-variable t)
  336. (defcustom svn-status-default-commit-arguments '()
  337. "*List of arguments to pass to svn commit.
  338. If you don't like recursive commits, set this value to (\"-N\")
  339. or mark the directory before committing it.
  340. Do not put an empty string here, except as an argument of an option:
  341. Subversion and the operating system may treat that as a file name
  342. equivalent to \".\", so you would commit more than you intended."
  343. :type '(repeat string)
  344. :group 'psvn)
  345. (put 'svn-status-default-commit-arguments 'risky-local-variable t)
  346. (defcustom svn-status-default-diff-arguments '()
  347. "*A list of arguments that is passed to the svn diff command.
  348. If you'd like to suppress whitespace changes use the following value:
  349. '(\"--diff-cmd\" \"diff\" \"-x\" \"-wbBu\")"
  350. :type '(repeat string)
  351. :group 'psvn)
  352. (put 'svn-status-default-diff-arguments 'risky-local-variable t)
  353. (defvar svn-trac-project-root nil
  354. "Path for an eventual existing trac issue tracker.
  355. This can be set with \\[svn-status-set-trac-project-root].")
  356. (defvar svn-status-module-name nil
  357. "*A short name for the actual project.
  358. This can be set with \\[svn-status-set-module-name].")
  359. (defvar svn-status-load-state-before-svn-status t
  360. "*Whether to automatically restore state from ++psvn.state file before running svn-status.")
  361. ;;; hooks
  362. (defvar svn-log-edit-mode-hook nil "Hook run when entering `svn-log-edit-mode'.")
  363. (defvar svn-log-edit-done-hook nil "Hook run after commiting files via svn.")
  364. ;; (put 'svn-log-edit-mode-hook 'risky-local-variable t)
  365. ;; (put 'svn-log-edit-done-hook 'risky-local-variable t)
  366. ;; already implied by "-hook" suffix
  367. (defvar svn-status-coding-system nil
  368. "A special coding system is needed for the output of svn.
  369. svn-status-coding-system is used in svn-run, if it is not nil.")
  370. (defcustom svn-status-wash-control-M-in-process-buffers
  371. (eq system-type 'windows-nt)
  372. "*Remove any trailing ^M from the *svn-process* buffer."
  373. :type 'boolean
  374. :group 'psvn)
  375. ;;; experimental features
  376. (defvar svn-status-track-user-input nil "Track user/password queries.
  377. This feature is implemented via a process filter.
  378. It is an experimental feature.")
  379. ;;; Customize group
  380. (defgroup psvn nil
  381. "Subversion interface for Emacs."
  382. :group 'tools)
  383. (defgroup psvn-faces nil
  384. "psvn faces."
  385. :group 'psvn)
  386. (eval-and-compile
  387. (require 'cl)
  388. (defconst svn-xemacsp (featurep 'xemacs))
  389. (if svn-xemacsp
  390. (require 'overlay)
  391. (require 'overlay nil t)))
  392. (defcustom svn-status-display-full-path nil
  393. "Specifies how the filenames look like in the listing.
  394. If t, their full path name will be displayed, else only the filename."
  395. :type 'boolean
  396. :group 'psvn)
  397. (defcustom svn-status-prefix-key [(control x) (meta s)]
  398. "Prefix key for the psvn commands in the global keymap."
  399. :type '(choice (const [(control x) ?v ?S])
  400. (const [(super s)])
  401. (const [(hyper s)])
  402. (const [(control x) ?v])
  403. (const [(control x) ?V])
  404. (sexp))
  405. :group 'psvn
  406. :set (lambda (var value)
  407. (if (boundp var)
  408. (global-unset-key (symbol-value var)))
  409. (set var value)
  410. (global-set-key (symbol-value var) 'svn-global-keymap)))
  411. ;; Use the normally used mode for files ending in .~HEAD~, .~BASE~, ...
  412. (add-to-list 'auto-mode-alist '("\\.~?\\(HEAD\\|BASE\\|PREV\\)~?\\'" ignore t))
  413. ;;; internal variables
  414. (defvar svn-status-directory-history nil "List of visited svn working directories.")
  415. (defvar svn-process-cmd nil)
  416. (defvar svn-status-info nil)
  417. (defvar svn-status-filename-to-buffer-position-cache (make-hash-table :test 'equal :weakness t))
  418. (defvar svn-status-base-info nil "The parsed result from the svn info command.")
  419. (defvar svn-status-initial-window-configuration nil)
  420. (defvar svn-status-default-column 23)
  421. (defvar svn-status-default-revision-width 4)
  422. (defvar svn-status-default-author-width 9)
  423. (defvar svn-status-line-format " %c%c%c %4s %4s %-9s")
  424. (defvar svn-start-of-file-list-line-number 0)
  425. (defvar svn-status-files-to-commit nil
  426. "List of files to commit at `svn-log-edit-done'.
  427. This is always set together with `svn-status-recursive-commit'.")
  428. (defvar svn-status-recursive-commit nil
  429. "Non-nil if the next commit should be recursive.
  430. This is always set together with `svn-status-files-to-commit'.")
  431. (defvar svn-log-edit-update-log-entry nil
  432. "Revision number whose log entry is being edited.
  433. This is nil if the log entry is for a new commit.")
  434. (defvar svn-status-pre-commit-window-configuration nil)
  435. (defvar svn-status-pre-propedit-window-configuration nil)
  436. (defvar svn-status-head-revision nil)
  437. (defvar svn-status-root-return-info nil)
  438. (defvar svn-status-property-edit-must-match-flag nil)
  439. (defvar svn-status-propedit-property-name nil)
  440. (defvar svn-status-propedit-file-list nil)
  441. (defvar svn-status-mode-line-process "")
  442. (defvar svn-status-mode-line-process-status "")
  443. (defvar svn-status-mode-line-process-edit-flag "")
  444. (defvar svn-status-edit-svn-command nil)
  445. (defvar svn-status-update-previous-process-output nil)
  446. (defvar svn-pre-run-asynch-recent-keys nil)
  447. (defvar svn-status-temp-dir
  448. (expand-file-name
  449. (or
  450. (when (boundp 'temporary-file-directory) temporary-file-directory) ;emacs
  451. ;; XEmacs 21.4.17 can return "/tmp/kalle" from (temp-directory).
  452. ;; `file-name-as-directory' adds a slash so we can append a file name.
  453. (when (fboundp 'temp-directory) (file-name-as-directory (temp-directory)))
  454. "/tmp/")) "The directory that is used to store temporary files for psvn.")
  455. ;; Because `temporary-file-directory' is not a risky local variable in
  456. ;; GNU Emacs 22.0.51, we don't mark `svn-status-temp-dir' as such either.
  457. (defvar svn-temp-suffix (make-temp-name "."))
  458. (put 'svn-temp-suffix 'risky-local-variable t)
  459. (defvar svn-status-temp-file-to-remove nil)
  460. (put 'svn-status-temp-file-to-remove 'risky-local-variable t)
  461. (defvar svn-status-temp-arg-file (concat svn-status-temp-dir "svn.arg" svn-temp-suffix))
  462. (put 'svn-status-temp-arg-file 'risky-local-variable t)
  463. (defvar svn-status-options nil)
  464. (defvar svn-status-remote)
  465. (defvar svn-status-commit-rev-number nil)
  466. (defvar svn-status-operated-on-dot nil)
  467. (defvar svn-status-elided-list nil)
  468. (defvar svn-status-custom-hide-function nil)
  469. ;; (put 'svn-status-custom-hide-function 'risky-local-variable t)
  470. ;; already implied by "-function" suffix
  471. (defvar svn-status-get-specific-revision-file-info)
  472. (defvar svn-status-last-output-buffer-name)
  473. (defvar svn-status-pre-run-svn-buffer nil)
  474. (defvar svn-status-update-list nil)
  475. (defvar svn-transient-buffers)
  476. (defvar svn-ediff-windows)
  477. (defvar svn-ediff-result)
  478. ;; Emacs 21 defines these in ediff-init.el but it seems more robust
  479. ;; to just declare the variables here than try to load that file.
  480. ;; It is Ediff's job to declare these as risky-local-variable if needed.
  481. (defvar ediff-buffer-A)
  482. (defvar ediff-buffer-B)
  483. (defvar ediff-buffer-C)
  484. (defvar ediff-quit-hook)
  485. ;; Ditto for log-edit.el.
  486. (defvar log-edit-initial-files)
  487. (defvar log-edit-callback)
  488. (defvar log-edit-listfun)
  489. ;; Ediff does not use this variable in GNU Emacs 20.7, GNU Emacs 21.4,
  490. ;; nor XEmacs 21.4.17. However, pcl-cvs (a.k.a. pcvs) does.
  491. ;; TODO: Check if this should be moved into the "svn-" namespace.
  492. (defvar ediff-after-quit-destination-buffer)
  493. ;; That is an example for the svn-status-custom-hide-function:
  494. ;; (setq svn-status-custom-hide-function 'svn-status-hide-pyc-files)
  495. ;; (defun svn-status-hide-pyc-files (info)
  496. ;; "Hide all pyc files in the `svn-status-buffer-name' buffer."
  497. ;; (let* ((fname (svn-status-line-info->filename-nondirectory info))
  498. ;; (fname-len (length fname)))
  499. ;; (and (> fname-len 4) (string= (substring fname (- fname-len 4)) ".pyc"))))
  500. ;;; faces
  501. (defface svn-status-marked-face
  502. '((((type tty) (class color)) (:foreground "green" :weight light))
  503. (((class color) (background light)) (:foreground "green3"))
  504. (((class color) (background dark)) (:foreground "palegreen2"))
  505. (t (:weight bold)))
  506. "Face to highlight the mark for user marked files in svn status buffers."
  507. :group 'psvn-faces)
  508. (defface svn-status-marked-popup-face
  509. '((((type tty) (class color)) (:foreground "green" :weight light))
  510. (((class color) (background light)) (:foreground "green3"))
  511. (((class color) (background dark)) (:foreground "palegreen2"))
  512. (t (:weight bold)))
  513. "Face to highlight the actual file, if a popup menu is activated."
  514. :group 'psvn-faces)
  515. (defface svn-status-update-available-face
  516. '((((type tty) (class color)) (:foreground "magenta" :weight light))
  517. (((class color) (background light)) (:foreground "magenta"))
  518. (((class color) (background dark)) (:foreground "yellow"))
  519. (t (:weight bold)))
  520. "Face used to highlight the 'out of date' mark.
  521. \(i.e., the mark used when there is a newer version in the repository
  522. than the working copy.\)
  523. See also `svn-status-short-mod-flag-p'."
  524. :group 'psvn-faces)
  525. ;based on cvs-filename-face
  526. (defface svn-status-directory-face
  527. '((((type tty) (class color)) (:foreground "lightblue" :weight light))
  528. (((class color) (background light)) (:foreground "blue4"))
  529. (((class color) (background dark)) (:foreground "lightskyblue1"))
  530. (t (:weight bold)))
  531. "Face for directories in *svn-status* buffers.
  532. See `svn-status--line-info->directory-p' for what counts as a directory."
  533. :group 'psvn-faces)
  534. ;based on font-lock-comment-face
  535. (defface svn-status-filename-face
  536. '((((class color) (background light)) (:foreground "chocolate"))
  537. (((class color) (background dark)) (:foreground "beige")))
  538. "Face for non-directories in *svn-status* buffers.
  539. See `svn-status--line-info->directory-p' for what counts as a directory."
  540. :group 'psvn-faces)
  541. ;based on font-lock-warning-face
  542. (defface svn-status-locked-face
  543. '((t
  544. (:weight bold :foreground "Red")))
  545. "Face for the phrase \"[ LOCKED ]\" `svn-status-buffer-name' buffers."
  546. :group 'psvn-faces)
  547. ;based on vhdl-font-lock-directive-face
  548. (defface svn-status-switched-face
  549. '((((class color)
  550. (background light))
  551. (:foreground "CadetBlue"))
  552. (((class color)
  553. (background dark))
  554. (:foreground "Aquamarine"))
  555. (t
  556. (:bold t :italic t)))
  557. "Face for the phrase \"(switched)\" non-directories in svn status buffers."
  558. :group 'psvn-faces)
  559. (defvar svn-highlight t)
  560. ;; stolen from PCL-CVS
  561. (defun svn-add-face (str face &optional keymap)
  562. "Return string STR decorated with the specified FACE.
  563. If `svn-highlight' is nil then just return STR."
  564. (when svn-highlight
  565. ;; Do not use `list*'; cl.el might not have been loaded. We could
  566. ;; put (require 'cl) at the top but let's try to manage without.
  567. (add-text-properties 0 (length str)
  568. `(face ,face
  569. mouse-face highlight)
  570. ;; 18.10.2004: the keymap parameter is not used (yet) in psvn.el
  571. ;; ,@(when keymap
  572. ;; `(mouse-face highlight
  573. ;; local-map ,keymap)))
  574. str))
  575. str)
  576. (defun svn-status-maybe-add-face (condition text face)
  577. "If CONDITION then add FACE to TEXT.
  578. Else return TEXT unchanged."
  579. (if condition
  580. (svn-add-face text face)
  581. text))
  582. (defun svn-status-choose-face-to-add (condition text face1 face2)
  583. "If CONDITION then add FACE1 to TEXT, else add FACE2 to TEXT."
  584. (if condition
  585. (svn-add-face text face1)
  586. (svn-add-face text face2)))
  587. (defun svn-status-maybe-add-string (condition string face)
  588. "If CONDITION then return STRING decorated with FACE.
  589. Otherwise, return \"\"."
  590. (if condition
  591. (svn-add-face string face)
  592. ""))
  593. ; compatibility
  594. ; emacs 20
  595. (defalias 'svn-point-at-eol
  596. (if (fboundp 'point-at-eol) 'point-at-eol 'line-end-position))
  597. (defalias 'svn-point-at-bol
  598. (if (fboundp 'point-at-bol) 'point-at-bol 'line-beginning-position))
  599. (defalias 'svn-read-directory-name
  600. (if (fboundp 'read-directory-name) 'read-directory-name 'read-file-name))
  601. (eval-when-compile
  602. (if (not (fboundp 'gethash))
  603. (require 'cl-macs)))
  604. (defalias 'svn-puthash (if (fboundp 'puthash) 'puthash 'cl-puthash))
  605. ; xemacs
  606. ;; Evaluate the defsubst at compile time, so that the byte compiler
  607. ;; knows the definition and can inline calls. It cannot detect the
  608. ;; defsubst automatically from within the if form.
  609. (eval-and-compile
  610. (if (fboundp 'match-string-no-properties)
  611. (defalias 'svn-match-string-no-properties 'match-string-no-properties)
  612. (defsubst svn-match-string-no-properties (match)
  613. (buffer-substring-no-properties (match-beginning match) (match-end match)))))
  614. ;; XEmacs 21.4.17 does not have an `alist' widget. Define a replacement.
  615. ;; To find out whether the `alist' widget exists, we cannot check just
  616. ;; (get 'alist 'widget-type), because GNU Emacs 21.4 defines it in
  617. ;; "wid-edit.el", which is not preloaded; it will be autoloaded when
  618. ;; `widget-create' is called. Instead, we call `widgetp', which is
  619. ;; also autoloaded from "wid-edit.el". XEmacs 21.4.17 does not have
  620. ;; `widgetp' either, so we check that first.
  621. (if (and (fboundp 'widgetp) (widgetp 'alist))
  622. (define-widget 'svn-alist 'alist
  623. "An association list.
  624. Use this instead of `alist', for XEmacs 21.4 compatibility.")
  625. (define-widget 'svn-alist 'list
  626. "An association list.
  627. Use this instead of `alist', for XEmacs 21.4 compatibility."
  628. :convert-widget 'svn-alist-convert-widget
  629. :tag "Association List"
  630. :key-type 'sexp
  631. :value-type 'sexp)
  632. (defun svn-alist-convert-widget (widget)
  633. (let* ((value-type (widget-get widget :value-type))
  634. (option-widgets (loop for option in (widget-get widget :options)
  635. collect `(cons :format "%v"
  636. (const :format "%t: %v\n"
  637. :tag "Key"
  638. ,option)
  639. ,value-type))))
  640. (widget-put widget :args
  641. `(,@(when option-widgets
  642. `((set :inline t :format "%v"
  643. ,@option-widgets)))
  644. (editable-list :inline t
  645. (cons :format "%v"
  646. ,(widget-get widget :key-type)
  647. ,value-type)))))
  648. widget))
  649. ;;; keymaps
  650. (defvar svn-global-keymap nil "Global keymap for psvn.el.
  651. To bind this to a different key, customize `svn-status-prefix-key'.")
  652. (put 'svn-global-keymap 'risky-local-variable t)
  653. (when (not svn-global-keymap)
  654. (setq svn-global-keymap (make-sparse-keymap))
  655. (define-key svn-global-keymap (kbd "s") 'svn-status-this-directory)
  656. (define-key svn-global-keymap (kbd "l") 'svn-status-show-svn-log)
  657. (define-key svn-global-keymap (kbd "u") 'svn-status-update-cmd)
  658. (define-key svn-global-keymap (kbd "=") 'svn-status-show-svn-diff)
  659. (define-key svn-global-keymap (kbd "b") 'svn-status-blame)
  660. (define-key svn-global-keymap (kbd "c") 'svn-status-commit)
  661. (define-key svn-global-keymap (kbd "S") 'svn-status-switch-to-status-buffer)
  662. (define-key svn-global-keymap (kbd "o") 'svn-status-pop-to-status-buffer))
  663. (defvar svn-status-diff-mode-map ()
  664. "Keymap used in `svn-status-diff-mode' for additional commands that are not defined in diff-mode.")
  665. (put 'svn-status-diff-mode-map 'risky-local-variable t) ;for Emacs 20.7
  666. (when (not svn-status-diff-mode-map)
  667. (setq svn-status-diff-mode-map (copy-keymap diff-mode-shared-map))
  668. (define-key svn-status-diff-mode-map [?w] 'svn-status-diff-save-current-defun-as-kill))
  669. (defvar svn-global-trac-map ()
  670. "Subkeymap used in `svn-global-keymap' for trac issue tracker commands.")
  671. (put 'svn-global-trac-map 'risky-local-variable t) ;for Emacs 20.7
  672. (when (not svn-global-trac-map)
  673. (setq svn-global-trac-map (make-sparse-keymap))
  674. (define-key svn-global-trac-map (kbd "t") 'svn-trac-browse-timeline)
  675. (define-key svn-global-trac-map (kbd "i") 'svn-trac-browse-ticket)
  676. (define-key svn-global-trac-map (kbd "c") 'svn-trac-browse-changeset)
  677. (define-key svn-global-keymap (kbd "t") svn-global-trac-map))
  678. ;; The setter of `svn-status-prefix-key' makes a binding in the global
  679. ;; map refer to the `svn-global-keymap' symbol, rather than directly
  680. ;; to the keymap. Emacs then implicitly uses the symbol-function.
  681. ;; This has the advantage that `describe-bindings' (C-h b) can show
  682. ;; the name of the keymap and link to its documentation.
  683. (defalias 'svn-global-keymap svn-global-keymap)
  684. ;; `defalias' of GNU Emacs 21.4 doesn't allow a docstring argument.
  685. (put 'svn-global-keymap 'function-documentation
  686. '(documentation-property 'svn-global-keymap 'variable-documentation t))
  687. ;; named after SVN_WC_ADM_DIR_NAME in svn_wc.h
  688. (defun svn-wc-adm-dir-name ()
  689. "Return the name of the \".svn\" subdirectory or equivalent."
  690. (if (and (eq system-type 'windows-nt)
  691. (getenv "SVN_ASP_DOT_NET_HACK"))
  692. "_svn"
  693. ".svn"))
  694. (defun svn-status-message (level &rest args)
  695. "If LEVEL is lower than `svn-status-debug-level' print ARGS using `message'.
  696. Guideline for numbers:
  697. 1 - error messages, 3 - non-serious error messages, 5 - messages for things
  698. that take a long time, 7 - not very important messages on stuff, 9 - messages
  699. inside loops."
  700. (if (<= level svn-status-debug-level)
  701. (apply 'message args)))
  702. (defun svn-status-flatten-list (list)
  703. "Flatten any lists within ARGS, so that there are no sublists."
  704. (loop for item in list
  705. if (listp item) nconc (svn-status-flatten-list item)
  706. else collect item))
  707. ;;;###autoload (defalias 'svn-examine 'svn-status)
  708. (defalias 'svn-examine 'svn-status)
  709. ;;;###autoload
  710. (defun svn-status (dir &optional arg)
  711. "Examine the status of Subversion working copy in directory DIR.
  712. If ARG is -, allow editing of the parameters. One could add -N to
  713. run svn status non recursively to make it faster.
  714. For every other non nil ARG pass the -u argument to `svn status'.
  715. If there is no .svn directory, examine if there is SVN and run
  716. `cvs-examine'. Otherwise ask if to run `dired'."
  717. (interactive (list (svn-read-directory-name "SVN status directory: "
  718. nil default-directory nil)
  719. current-prefix-arg))
  720. (let ((svn-dir (format "%s%s"
  721. (file-name-as-directory dir)
  722. (svn-wc-adm-dir-name)))
  723. (cvs-dir (format "%sCVS" (file-name-as-directory dir))))
  724. (cond
  725. ((file-directory-p svn-dir)
  726. (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
  727. (svn-status-1 dir arg))
  728. ((and (file-directory-p cvs-dir)
  729. (fboundp 'cvs-examine))
  730. (cvs-examine dir nil))
  731. (t
  732. (when (y-or-n-p
  733. (format
  734. (concat
  735. "%s "
  736. "is not Subversion controlled (missing %s "
  737. "directory). "
  738. "Run dired instead? ")
  739. dir
  740. (svn-wc-adm-dir-name)))
  741. (dired dir))))))
  742. (defvar svn-status-display-new-status-buffer nil)
  743. (defun svn-status-1 (dir &optional arg)
  744. "Examine DIR. See `svn-status' for more information."
  745. (unless (file-directory-p dir)
  746. (error "%s is not a directory" dir))
  747. (setq dir (file-name-as-directory dir))
  748. (when svn-status-load-state-before-svn-status
  749. (unless (string= dir (car svn-status-directory-history))
  750. (svn-status-load-state t)))
  751. (setq svn-status-directory-history (delete dir svn-status-directory-history))
  752. (add-to-list 'svn-status-directory-history dir)
  753. (if (string= (buffer-name) svn-status-buffer-name)
  754. (setq svn-status-display-new-status-buffer nil)
  755. (setq svn-status-display-new-status-buffer t)
  756. ;;(message "psvn: Saving initial window configuration")
  757. (setq svn-status-initial-window-configuration
  758. (current-window-configuration)))
  759. (let* ((status-buf (get-buffer-create svn-status-buffer-name))
  760. (proc-buf (get-buffer-create "*svn-process*"))
  761. (want-edit (eq arg '-))
  762. (status-option (if want-edit
  763. (if svn-status-verbose "-v" "")
  764. (if svn-status-verbose
  765. (if arg "-uv" "-v")
  766. (if arg "-u" ""))))
  767. (svn-status-edit-svn-command
  768. (or want-edit svn-status-edit-svn-command)))
  769. (save-excursion
  770. (set-buffer status-buf)
  771. (setq default-directory dir)
  772. (set-buffer proc-buf)
  773. (setq default-directory dir
  774. svn-status-remote (when arg t))
  775. (svn-run t t 'status "status" status-option))))
  776. (defun svn-status-this-directory (arg)
  777. "Run `svn-status' for the `default-directory'"
  778. (interactive "P")
  779. (svn-status default-directory arg))
  780. (defun svn-status-use-history ()
  781. (interactive)
  782. (let* ((hist svn-status-directory-history)
  783. (dir (read-from-minibuffer "svn-status on directory: "
  784. (cadr svn-status-directory-history)
  785. nil nil 'hist)))
  786. (if (file-directory-p dir)
  787. (svn-status dir)
  788. (error "%s is not a directory" dir))))
  789. (defun svn-had-user-input-since-asynch-run ()
  790. (not (equal (recent-keys) svn-pre-run-asynch-recent-keys)))
  791. (defun svn-process-environment ()
  792. "Construct the environment for the svn process.
  793. It is a combination of `svn-status-svn-environment-var-list' and
  794. the usual `process-environment'."
  795. ;; If there are duplicate elements in `process-environment', then GNU
  796. ;; Emacs 21.4 guarantees that the first one wins; but GNU Emacs 20.7
  797. ;; and XEmacs 21.4.17 don't document what happens. We'll just remove
  798. ;; any duplicates ourselves, then. This also gives us an opportunity
  799. ;; to handle the "VARIABLE" syntax that none of them supports.
  800. (loop with found = '()
  801. for elt in (append svn-status-svn-environment-var-list
  802. process-environment)
  803. for has-value = (string-match "=" elt)
  804. for name = (substring elt 0 has-value)
  805. unless (member name found)
  806. do (push name found)
  807. and when has-value
  808. collect elt))
  809. (defun svn-run (run-asynchron clear-process-buffer cmdtype &rest arglist)
  810. "Run svn with arguments ARGLIST.
  811. If RUN-ASYNCHRON is t then run svn asynchronously.
  812. If CLEAR-PROCESS-BUFFER is t then erase the contents of the
  813. *svn-process* buffer before commencing.
  814. CMDTYPE is a symbol such as 'mv, 'revert, or 'add, representing the
  815. command to run.
  816. ARGLIST is a list of arguments \(which must include the command name,
  817. for example: '(\"revert\" \"file1\"\)
  818. ARGLIST is flattened and any every nil value is discarded.
  819. If the variable `svn-status-edit-svn-command' is non-nil then the user
  820. can edit ARGLIST before running svn."
  821. (setq arglist (svn-status-flatten-list arglist))
  822. (if (eq (process-status "svn") nil)
  823. (progn
  824. (when svn-status-edit-svn-command
  825. (setq arglist (append
  826. (list (car arglist))
  827. (split-string
  828. (read-from-minibuffer
  829. (format "svn %s flags: " (car arglist))
  830. (mapconcat 'identity (cdr arglist) " ")))))
  831. (when (eq svn-status-edit-svn-command t)
  832. (svn-status-toggle-edit-cmd-flag t))
  833. (message "svn-run %s: %S" cmdtype arglist))
  834. (let* ((proc-buf (get-buffer-create "*svn-process*"))
  835. (svn-exe svn-status-svn-executable)
  836. (svn-proc))
  837. (when (listp (car arglist))
  838. (setq arglist (car arglist)))
  839. (save-excursion
  840. (set-buffer proc-buf)
  841. (when svn-status-coding-system
  842. (setq buffer-file-coding-system svn-status-coding-system))
  843. (setq buffer-read-only nil)
  844. (fundamental-mode)
  845. (if clear-process-buffer
  846. (delete-region (point-min) (point-max))
  847. (goto-char (point-max)))
  848. (setq svn-process-cmd cmdtype)
  849. (setq svn-status-mode-line-process-status (format " running %s" cmdtype))
  850. (svn-status-update-mode-line)
  851. (sit-for 0.1)
  852. (if run-asynchron
  853. (progn
  854. ;;(message "running asynchron: %s %S" svn-exe arglist)
  855. (setq svn-pre-run-asynch-recent-keys (recent-keys))
  856. (let ((process-environment (svn-process-environment))
  857. (process-connection-type nil))
  858. ;; Communicate with the subprocess via pipes rather
  859. ;; than via a pseudoterminal, so that if the svn+ssh
  860. ;; scheme is being used, SSH will not ask for a
  861. ;; passphrase via stdio; psvn.el is currently unable
  862. ;; to answer such prompts. Instead, SSH will run
  863. ;; x11-ssh-askpass if possible. If Emacs is being
  864. ;; run on a TTY without $DISPLAY, this will fail; in
  865. ;; such cases, the user should start ssh-agent and
  866. ;; then run ssh-add explicitly.
  867. (setq svn-proc (apply 'start-process "svn" proc-buf svn-exe arglist)))
  868. (set-process-sentinel svn-proc 'svn-process-sentinel)
  869. (when svn-status-track-user-input
  870. (set-process-filter svn-proc 'svn-process-filter)))
  871. ;;(message "running synchron: %s %S" svn-exe arglist)
  872. (let ((process-environment (svn-process-environment)))
  873. ;; `call-process' ignores `process-connection-type' and
  874. ;; never opens a pseudoterminal.
  875. (apply 'call-process svn-exe nil proc-buf nil arglist))
  876. (setq svn-status-mode-line-process-status "")
  877. (svn-status-update-mode-line)))
  878. (setq svn-status-pre-run-svn-buffer (current-buffer))))
  879. (error "You can only run one svn process at once!")))
  880. (defun svn-process-sentinel-fixup-path-seperators ()
  881. "Convert all path separators to UNIX style.
  882. \(This is a no-op unless `system-type' is windows-nt\)"
  883. (when (eq system-type 'windows-nt)
  884. (save-excursion
  885. (goto-char (point-min))
  886. (while (search-forward "\\" nil t)
  887. (replace-match "/")))))
  888. (defun svn-process-sentinel (process event)
  889. ;;(princ (format "Process: %s had the event `%s'" process event)))
  890. ;;(save-excursion
  891. (let ((act-buf (current-buffer)))
  892. (set-buffer (process-buffer process))
  893. (setq svn-status-mode-line-process-status "")
  894. (svn-status-update-mode-line)
  895. (cond ((string= event "finished\n")
  896. (cond ((eq svn-process-cmd 'status)
  897. ;;(message "svn status finished")
  898. (svn-process-sentinel-fixup-path-seperators)
  899. (svn-parse-status-result)
  900. (set-buffer act-buf)
  901. (svn-status-update-buffer)
  902. (when svn-status-update-previous-process-output
  903. (set-buffer (process-buffer process))
  904. (delete-region (point-min) (point-max))
  905. (insert "Output from svn command:\n")
  906. (insert svn-status-update-previous-process-output)
  907. (goto-char (point-min))
  908. (setq svn-status-update-previous-process-output nil))
  909. (when svn-status-update-list
  910. ;; (message "Using svn-status-update-list: %S" svn-status-update-list)
  911. (save-excursion
  912. (svn-status-update-with-command-list svn-status-update-list))
  913. (setq svn-status-update-list nil))
  914. (when svn-status-display-new-status-buffer
  915. (set-window-configuration svn-status-initial-window-configuration)
  916. (if (svn-had-user-input-since-asynch-run)
  917. (message "svn status finished")
  918. (switch-to-buffer svn-status-buffer-name))))
  919. ((eq svn-process-cmd 'log)
  920. (svn-status-show-process-output 'log t)
  921. (pop-to-buffer svn-status-last-output-buffer-name)
  922. (svn-log-view-mode)
  923. (forward-line 3)
  924. (font-lock-fontify-buffer)
  925. (message "svn log finished"))
  926. ((eq svn-process-cmd 'info)
  927. (svn-status-show-process-output 'info t)
  928. (message "svn info finished"))
  929. ((eq svn-process-cmd 'ls)
  930. (svn-status-show-process-output 'info t)
  931. (message "svn ls finished"))
  932. ((eq svn-process-cmd 'parse-info)
  933. (svn-status-parse-info-result))
  934. ((eq svn-process-cmd 'blame)
  935. (svn-status-show-process-output 'blame t)
  936. (when svn-status-pre-run-svn-buffer
  937. (with-current-buffer svn-status-pre-run-svn-buffer
  938. (unless (eq major-mode 'svn-status-mode)
  939. (goto-line (line-number-at-pos) (get-buffer svn-status-last-output-buffer-name)))))
  940. (message "svn blame finished"))
  941. ((eq svn-process-cmd 'commit)
  942. (svn-process-sentinel-fixup-path-seperators)
  943. (svn-status-remove-temp-file-maybe)
  944. (when (member 'commit svn-status-unmark-files-after-list)
  945. (svn-status-unset-all-usermarks))
  946. (svn-status-update-with-command-list (svn-status-parse-commit-output))
  947. (run-hooks 'svn-log-edit-done-hook)
  948. (setq svn-status-files-to-commit nil
  949. svn-status-recursive-commit nil)
  950. (message "svn commit finished"))
  951. ((eq svn-process-cmd 'update)
  952. (svn-status-show-process-output 'update t)
  953. (setq svn-status-update-list (svn-status-parse-update-output))
  954. (svn-status-update)
  955. (message "svn update finished"))
  956. ((eq svn-process-cmd 'add)
  957. (svn-status-update-with-command-list (svn-status-parse-ar-output))
  958. (message "svn add finished"))
  959. ((eq svn-process-cmd 'mkdir)
  960. (svn-status-update)
  961. (message "svn mkdir finished"))
  962. ((eq svn-process-cmd 'revert)
  963. (when (member 'revert svn-status-unmark-files-after-list)
  964. (svn-status-unset-all-usermarks))
  965. (svn-status-update)
  966. (message "svn revert finished"))
  967. ((eq svn-process-cmd 'resolved)
  968. (svn-status-update)
  969. (message "svn resolved finished"))
  970. ((eq svn-process-cmd 'mv)
  971. (svn-status-update)
  972. (message "svn mv finished"))
  973. ((eq svn-process-cmd 'rm)
  974. (svn-status-update-with-command-list (svn-status-parse-ar-output))
  975. (message "svn rm finished"))
  976. ((eq svn-process-cmd 'cleanup)
  977. (message "svn cleanup finished"))
  978. ((eq svn-process-cmd 'proplist)
  979. (svn-status-show-process-output 'proplist t)
  980. (message "svn proplist finished"))
  981. ((eq svn-process-cmd 'proplist-parse)
  982. (svn-status-property-parse-property-names))
  983. ((eq svn-process-cmd 'propset)
  984. (svn-status-remove-temp-file-maybe)
  985. (if (member svn-status-propedit-property-name '("svn:keywords"))
  986. (svn-status-update-with-command-list (svn-status-parse-property-output))
  987. (svn-status-update)))
  988. ((eq svn-process-cmd 'propdel)
  989. (svn-status-update))))
  990. ((string= event "killed\n")
  991. (message "svn process killed"))
  992. ((string-match "exited abnormally" event)
  993. (while (accept-process-output process 0 100))
  994. ;; find last error message and show it.
  995. (goto-char (point-max))
  996. (message "svn failed: %s"
  997. (if (re-search-backward "^svn: \\(.*\\)" nil t)
  998. (match-string 1)
  999. event)))
  1000. (t
  1001. (message "svn process had unknown event: %s" event))
  1002. (svn-status-show-process-output nil t))))
  1003. (defun svn-process-filter (process str)
  1004. (save-window-excursion
  1005. (set-buffer "*svn-process*")
  1006. ;;(message "svn-process-filter: %s" str)
  1007. (goto-char (point-max))
  1008. (insert str)
  1009. (save-excursion
  1010. (goto-char (svn-point-at-bol))
  1011. (when (looking-at "Password for '\\(.+\\)': ")
  1012. ;(svn-status-show-process-buffer)
  1013. (let ((passwd (read-passwd
  1014. (format "Enter svn password for %s: " (match-string 1)))))
  1015. (svn-process-send-string (concat passwd "\n") t)))
  1016. (when (looking-at "Username: ")
  1017. (let ((user-name (read-string "Username for svn operation: ")))
  1018. (svn-process-send-string (concat user-name "\n")))))))
  1019. (defun svn-parse-rev-num (str)
  1020. (if (and str (stringp str)
  1021. (save-match-data (string-match "^[0-9]+" str)))
  1022. (string-to-number str)
  1023. -1))
  1024. (defsubst svn-status-make-ui-status ()
  1025. "Make a ui-status structure for a file in a svn working copy.
  1026. The initial values in the structure returned by this function
  1027. are good for a file or directory that the user hasn't seen before.
  1028. The ui-status structure keeps track of how the file or directory
  1029. should be displayed in svn-status mode. Updating the svn-status
  1030. buffer from the working copy preserves the ui-status if possible.
  1031. User commands modify this structure; each file or directory must
  1032. thus have its own copy.
  1033. Currently, the ui-status is a list (USER-MARK USER-ELIDE).
  1034. USER-MARK is non-nil iff the user has marked the file or directory,
  1035. typically with `svn-status-set-user-mark'. To read USER-MARK,
  1036. call `svn-status-line-info->has-usermark'.
  1037. USER-ELIDE is non-nil iff the user has elided the file or directory
  1038. from the svn-status buffer, typically with `svn-status-toggle-elide'.
  1039. To read USER-ELIDE, call `svn-status-line-inf

Large files files are truncated, but you can click here to view the full file