Mercurial > emacs
comparison lisp/vc-svn.el @ 75233:e52e99fc4ca5
(vc-svn-parse-status): Trust the filename argument more
than the program's output.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 14 Jan 2007 14:49:28 +0000 |
parents | 299d3322c8be |
children | a8fd93a515a2 95d0cdf160ea |
comparison
equal
deleted
inserted
replaced
75232:037fa20cc6bd | 75233:e52e99fc4ca5 |
---|---|
1 ;;; vc-svn.el --- non-resident support for Subversion version-control | 1 ;;; vc-svn.el --- non-resident support for Subversion version-control |
2 | 2 |
3 ;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. | 3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: FSF (see vc.el for full credits) | 5 ;; Author: FSF (see vc.el for full credits) |
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org> | 6 ;; Maintainer: Stefan Monnier <monnier@gnu.org> |
7 | 7 |
8 ;; This file is part of GNU Emacs. | 8 ;; This file is part of GNU Emacs. |
493 (vc-insert-file (expand-file-name (concat vc-svn-admin-directory | 493 (vc-insert-file (expand-file-name (concat vc-svn-admin-directory |
494 "/entries") | 494 "/entries") |
495 dirname))) | 495 dirname))) |
496 (goto-char (point-min)) | 496 (goto-char (point-min)) |
497 (when (re-search-forward | 497 (when (re-search-forward |
498 ;; Old `svn' used name="svn:dir", newer use just name="". | 498 ;; Old `svn' used name="svn:this_dir", newer use just name="". |
499 (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*" | 499 (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*" |
500 "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?" | 500 "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?" |
501 "url=\"\\([^\"]+\\)\"") nil t) | 501 "url=\"\\([^\"]+\\)\"") nil t) |
502 ;; This is not a hostname but a URL. This may actually be considered | 502 ;; This is not a hostname but a URL. This may actually be considered |
503 ;; as a feature since it allows vc-svn-stay-local to specify different | 503 ;; as a feature since it allows vc-svn-stay-local to specify different |
509 Set file properties accordingly. Unless FILENAME is non-nil, parse only | 509 Set file properties accordingly. Unless FILENAME is non-nil, parse only |
510 information about FILENAME and return its status." | 510 information about FILENAME and return its status." |
511 (let (file status) | 511 (let (file status) |
512 (goto-char (point-min)) | 512 (goto-char (point-min)) |
513 (while (re-search-forward | 513 (while (re-search-forward |
514 "^[ ADMCI?!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t) | 514 ;; Ignore the files with status in [IX?]. |
515 (setq file (expand-file-name | 515 "^[ ACDGMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\) +" nil t) |
516 (buffer-substring (point) (line-end-position)))) | 516 ;; If the username contains spaces, the output format is ambiguous, |
517 ;; so don't trust the output's filename unless we have to. | |
518 (setq file (or filename | |
519 (expand-file-name | |
520 (buffer-substring (point) (line-end-position))))) | |
517 (setq status (char-after (line-beginning-position))) | 521 (setq status (char-after (line-beginning-position))) |
518 (unless (eq status ??) | 522 (unless (eq status ??) |
519 ;; `vc-BACKEND-registered' must not set vc-backend, | 523 ;; `vc-BACKEND-registered' must not set vc-backend, |
520 ;; which is instead set in vc-registered. | 524 ;; which is instead set in vc-registered. |
521 (unless filename (vc-file-setprop file 'vc-backend 'SVN)) | 525 (unless filename (vc-file-setprop file 'vc-backend 'SVN)) |