unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* vc-svn.el  and newer subversion format
@ 2011-02-07 20:22 Karl Pflästerer
  2011-02-12  1:13 ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Pflästerer @ 2011-02-07 20:22 UTC (permalink / raw)
  To: emacs-devel

Hi,
the devel version of Subversion no longer has one .svn directory in each
directory in the working tree, but just one .svn directory (like e.g Hg
or Git).

Therefore vc can't see that a file is under Subversion version control.
I tried to change the relevant parts in vc-svn.el (I looked how it's
done in vc-hg and vc-git).

Here is a diff against trunk.  For `vc-svn-repository-hostname' I used
svn info --xml since I don't know how the info message might be formated
in different languages; I hope the XML format will everywhere be the same.


  KP

=== modified file 'lisp/vc/vc-svn.el'
--- lisp/vc/vc-svn.el	2011-01-26 08:36:39 +0000
+++ lisp/vc/vc-svn.el	2011-02-07 19:58:05 +0000
@@ -117,17 +117,13 @@
 ;;;###autoload                                (getenv "SVN_ASP_DOT_NET_HACK"))
 ;;;###autoload                           "_svn")
 ;;;###autoload                          (t ".svn"))))
-;;;###autoload     (when (file-readable-p (expand-file-name
-;;;###autoload                             (concat admin-dir "/entries")
-;;;###autoload                             (file-name-directory f)))
+;;;###autoload     (when (vc-find-root f admin-dir)
 ;;;###autoload       (load "vc-svn")
 ;;;###autoload       (vc-svn-registered f))))
 
 (defun vc-svn-registered (file)
   "Check if FILE is SVN registered."
-  (when (file-readable-p (expand-file-name (concat vc-svn-admin-directory
-						   "/entries")
-					   (file-name-directory file)))
+  (when (vc-svn-root file)
     (with-temp-buffer
       (cd (file-name-directory file))
       (let* (process-file-side-effects
@@ -275,12 +271,10 @@
 to the SVN command."
   (apply 'vc-svn-command nil 0 files "add" (vc-switches 'SVN 'register)))
 
-(defun vc-svn-responsible-p (file)
-  "Return non-nil if SVN thinks it is responsible for FILE."
-  (file-directory-p (expand-file-name vc-svn-admin-directory
-				      (if (file-directory-p file)
-					  file
-					(file-name-directory file)))))
+(defun vc-svn-root (file)
+  (vc-find-root file vc-svn-admin-directory))
+
+(defalias 'vc-svn-responsible-p 'vc-svn-root)
 
 (defalias 'vc-svn-could-register 'vc-svn-responsible-p
   "Return non-nil if FILE could be registered in SVN.
@@ -594,20 +588,10 @@
 
 (defun vc-svn-repository-hostname (dirname)
   (with-temp-buffer
-    (let ((coding-system-for-read
-	   (or file-name-coding-system
-	       default-file-name-coding-system)))
-      (vc-insert-file (expand-file-name (concat vc-svn-admin-directory
-						"/entries")
-					dirname)))
+    (let (process-file-side-effects)
+      (vc-svn-command t t dirname "info" "--xml"))
     (goto-char (point-min))
-    (when (re-search-forward
-	   ;; Old `svn' used name="svn:this_dir", newer use just name="".
-	   (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*"
-		   "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
-		   "url=\"\\(?1:[^\"]+\\)\""
-                   ;; Yet newer ones don't use XML any more.
-                   "\\|^\ndir\n[0-9]+\n\\(?1:.*\\)") nil t)
+    (when (re-search-forward "<url>\\(.*\\)</url>" nil t)
       ;; This is not a hostname but a URL.  This may actually be considered
       ;; as a feature since it allows vc-svn-stay-local to specify different
       ;; behavior for different modules on the same server.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* vc-svn.el and newer subversion format
@ 2011-02-08 10:06 Karl Pflästerer
  2011-02-08 19:08 ` Glenn Morris
  2011-02-09 16:29 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Karl Pflästerer @ 2011-02-08 10:06 UTC (permalink / raw)
  To: emacs-devel

Hi,
(sorry if you read this posting twice; but it seems the first posting
through gmane seems got lost, so here it is again).

the devel version of Subversion no longer has one .svn directory in each
directory in the working tree, but just one .svn directory (like e.g Hg
or Git).

Therefore vc can't see that a file is under Subversion version control.
I tried to change the relevant parts in vc-svn.el (I looked how it's
done in vc-hg and vc-git).

Here is a diff against trunk.  For `vc-svn-repository-hostname' I used
svn info --xml since I don't know how the info message might be formated
in different languages; I hope the XML format will everywhere be the same.


  KP

=== modified file 'lisp/vc/vc-svn.el'
--- lisp/vc/vc-svn.el	2011-01-26 08:36:39 +0000
+++ lisp/vc/vc-svn.el	2011-02-07 19:58:05 +0000
@@ -117,17 +117,13 @@
 ;;;###autoload                                (getenv "SVN_ASP_DOT_NET_HACK"))
 ;;;###autoload                           "_svn")
 ;;;###autoload                          (t ".svn"))))
-;;;###autoload     (when (file-readable-p (expand-file-name
-;;;###autoload                             (concat admin-dir "/entries")
-;;;###autoload                             (file-name-directory f)))
+;;;###autoload     (when (vc-find-root f admin-dir)
 ;;;###autoload       (load "vc-svn")
 ;;;###autoload       (vc-svn-registered f))))
 
 (defun vc-svn-registered (file)
   "Check if FILE is SVN registered."
-  (when (file-readable-p (expand-file-name (concat vc-svn-admin-directory
-						   "/entries")
-					   (file-name-directory file)))
+  (when (vc-svn-root file)
     (with-temp-buffer
       (cd (file-name-directory file))
       (let* (process-file-side-effects
@@ -275,12 +271,10 @@
 to the SVN command."
   (apply 'vc-svn-command nil 0 files "add" (vc-switches 'SVN 'register)))
 
-(defun vc-svn-responsible-p (file)
-  "Return non-nil if SVN thinks it is responsible for FILE."
-  (file-directory-p (expand-file-name vc-svn-admin-directory
-				      (if (file-directory-p file)
-					  file
-					(file-name-directory file)))))
+(defun vc-svn-root (file)
+  (vc-find-root file vc-svn-admin-directory))
+
+(defalias 'vc-svn-responsible-p 'vc-svn-root)
 
 (defalias 'vc-svn-could-register 'vc-svn-responsible-p
   "Return non-nil if FILE could be registered in SVN.
@@ -594,20 +588,10 @@
 
 (defun vc-svn-repository-hostname (dirname)
   (with-temp-buffer
-    (let ((coding-system-for-read
-	   (or file-name-coding-system
-	       default-file-name-coding-system)))
-      (vc-insert-file (expand-file-name (concat vc-svn-admin-directory
-						"/entries")
-					dirname)))
+    (let (process-file-side-effects)
+      (vc-svn-command t t dirname "info" "--xml"))
     (goto-char (point-min))
-    (when (re-search-forward
-	   ;; Old `svn' used name="svn:this_dir", newer use just name="".
-	   (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*"
-		   "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
-		   "url=\"\\(?1:[^\"]+\\)\""
-                   ;; Yet newer ones don't use XML any more.
-                   "\\|^\ndir\n[0-9]+\n\\(?1:.*\\)") nil t)
+    (when (re-search-forward "<url>\\(.*\\)</url>" nil t)
       ;; This is not a hostname but a URL.  This may actually be considered
       ;; as a feature since it allows vc-svn-stay-local to specify different
       ;; behavior for different modules on the same server.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vc-svn.el and newer subversion format
  2011-02-08 10:06 vc-svn.el and newer subversion format Karl Pflästerer
@ 2011-02-08 19:08 ` Glenn Morris
  2011-02-09 16:29 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Glenn Morris @ 2011-02-08 19:08 UTC (permalink / raw)
  To: k; +Cc: emacs-devel


> (sorry if you read this posting twice; but it seems the first posting
> through gmane seems got lost, so here it is again).

Check the real list archives:

http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg00308.html
http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg00357.html

BTW I strongly recommend patches for bugs and/or features to be sent to
the bug list, since they get tracked that way and are less likely to get
overlooked. (But no need for a third copy in this case.)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vc-svn.el and newer subversion format
  2011-02-08 10:06 vc-svn.el and newer subversion format Karl Pflästerer
  2011-02-08 19:08 ` Glenn Morris
@ 2011-02-09 16:29 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-02-09 16:29 UTC (permalink / raw)
  To: Karl Pflästerer; +Cc: emacs-devel

> the devel version of Subversion no longer has one .svn directory in each
> directory in the working tree, but just one .svn directory (like e.g Hg
> or Git).

Interesting.

> Here is a diff against trunk.  For `vc-svn-repository-hostname' I used
> svn info --xml since I don't know how the info message might be formated
> in different languages; I hope the XML format will everywhere be the same.

It's too bad we have to fork `svn' again just to get the
repository hostname.  OTOH using the XML output sounds like the right
thing to do.

The patch looks good.  Could someone install it, please?


        Stefan



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: vc-svn.el  and newer subversion format
  2011-02-07 20:22 Karl Pflästerer
@ 2011-02-12  1:13 ` Chong Yidong
  0 siblings, 0 replies; 5+ messages in thread
From: Chong Yidong @ 2011-02-12  1:13 UTC (permalink / raw)
  To: Karl Pflästerer; +Cc: emacs-devel

k@rl.pflaesterer.de (Karl Pflästerer) writes:

> the devel version of Subversion no longer has one .svn directory in each
> directory in the working tree, but just one .svn directory (like e.g Hg
> or Git).
>
> Therefore vc can't see that a file is under Subversion version control.
> I tried to change the relevant parts in vc-svn.el (I looked how it's
> done in vc-hg and vc-git).
>
> Here is a diff against trunk.  For `vc-svn-repository-hostname' I used
> svn info --xml since I don't know how the info message might be formated
> in different languages; I hope the XML format will everywhere be the same.

Thanks.  Committed to the trunk.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-12  1:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-08 10:06 vc-svn.el and newer subversion format Karl Pflästerer
2011-02-08 19:08 ` Glenn Morris
2011-02-09 16:29 ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2011-02-07 20:22 Karl Pflästerer
2011-02-12  1:13 ` Chong Yidong

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).