[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: bringing psvn.el up to 1.7+ working copies

From: Joseph Schaefer <joe_schaefer_at_yahoo.com>
Date: Sun, 24 Feb 2013 19:37:44 -0500

Ok here's my latest stab at it. So far everything seems to work as
expected, even when you have unsaved edits in the same working
copy but are working in a subdir that doesn't contain unsaved edits.

I will keep testing but am really just looking for some support from
a full committer so I can commit these changes as I work on them.

Index: CHANGES
===================================================================
--- CHANGES (revision 1449428)
+++ CHANGES (working copy)
@@ -47,6 +47,7 @@
 
   - Other tool improvements and bugfixes:
     * 'svnmucc' promoted to first-class supported utility (issue #3308)
+ * 'psvn.el' now supports 1.7+ working copies
   
  Developer-visible changes:
   - General:
Index: contrib/client-side/emacs/psvn.el
===================================================================
--- contrib/client-side/emacs/psvn.el (revision 1449428)
+++ contrib/client-side/emacs/psvn.el (working copy)
@@ -1127,33 +1127,13 @@
 asks svn to connect to the repository and check to see if there are updates
 there.
 
-If there is no .svn directory, examine if there is CVS and run
-`cvs-examine'. Otherwise ask if to run `dired'."
+ Note: psvn.el no longer supports dispatch to cvs nor dired."
+
   (interactive (list (svn-read-directory-name "SVN status directory: "
                                               nil default-directory nil)
                      current-prefix-arg))
- (let ((svn-dir (format "%s%s"
- (file-name-as-directory dir)
- (svn-wc-adm-dir-name)))
- (cvs-dir (format "%sCVS" (file-name-as-directory dir))))
- (cond
- ((file-directory-p svn-dir)
- (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
- (svn-status-1 dir arg))
- ((and (file-directory-p cvs-dir)
- (fboundp 'cvs-examine))
- (cvs-examine dir nil))
- (t
- (when (y-or-n-p
- (format
- (concat
- "%s "
- "is not Subversion controlled (missing %s "
- "directory). "
- "Run dired instead? ")
- dir
- (svn-wc-adm-dir-name)))
- (dired dir))))))
+ (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
+ (svn-status-1 dir arg))
 
 (defvar svn-status-display-new-status-buffer nil)
 (defun svn-status-1 (dir &optional arg)
@@ -6039,20 +6019,32 @@
              (in-tree (and repository-root (file-exists-p dot-svn-dir)))
              (dir-below (expand-file-name base-dir)))
         ;; (message "repository-root: %s start-dir: %s" repository-root start-dir)
- (if (and (<= (car svn-client-version) 1) (< (cadr svn-client-version) 3))
- (setq base-dir (svn-status-base-dir-for-ancient-svn-client start-dir)) ;; svn version < 1.3
- (while (when (and dir-below (file-exists-p dot-svn-dir))
- (setq base-dir (file-name-directory dot-svn-dir))
- (string-match "\\(.+/\\).+/" dir-below)
- (setq dir-below
- (and (string-match "\\(.*/\\)[^/]+/" dir-below)
- (match-string 1 dir-below)))
- ;; (message "base-dir: %s, dir-below: %s, dot-svn-dir: %s in-tree: %s" base-dir dir-below dot-svn-dir in-tree)
- (when dir-below
- (if (string= (svn-status-repo-for-path dir-below) repository-root)
- (setq dot-svn-dir (concat dir-below (svn-wc-adm-dir-name)))
- (setq dir-below nil)))))
- (setq base-dir (and in-tree base-dir)))
+ (if (or (> (car svn-client-version) 1) (and (= (car svn-client-version) 1) (>= (cadr svn-client-version) 7)))
+ (while (when (and dir-below (not (file-exists-p dot-svn-dir)))
+ (string-match "\\(.+/\\).+/" dir-below)
+ (setq dir-below
+ (and (string-match "\\(.*/\\)[^/]+/" dir-below)
+ (match-string 1 dir-below)))
+ ;;(message "base-dir: %s, dir-below: %s, dot-svn-dir: %s in-tree: %s" base-dir dir-below dot-svn-dir in-tree)
+ (when dir-below
+ (if (string= (svn-status-repo-for-path dir-below) repository-root)
+ (setq dot-svn-dir (concat dir-below (svn-wc-adm-dir-name)))
+ (setq dir-below nil)))
+ (setq base-dir (file-name-directory dot-svn-dir))))
+ (if (and (<= (car svn-client-version) 1) (< (cadr svn-client-version) 3))
+ (setq base-dir (svn-status-base-dir-for-ancient-svn-client start-dir)) ;; svn version < 1.3
+ (while (when (and dir-below (file-exists-p dot-svn-dir))
+ (setq base-dir (file-name-directory dot-svn-dir))
+ (string-match "\\(.+/\\).+/" dir-below)
+ (setq dir-below
+ (and (string-match "\\(.*/\\)[^/]+/" dir-below)
+ (match-string 1 dir-below)))
+ ;;(message "base-dir: %s, dir-below: %s, dot-svn-dir: %s in-tree: %s" base-dir dir-below dot-svn-dir in-tree)
+ (when dir-below
+ (if (string= (svn-status-repo-for-path dir-below) repository-root)
+ (setq dot-svn-dir (concat dir-below (svn-wc-adm-dir-name)))
+ (setq dir-below nil)))))
+ (setq base-dir (and in-tree base-dir))))
         (svn-puthash start-dir base-dir svn-status-base-dir-cache)
         (svn-status-message 7 "svn-status-base-dir %s => %s" start-dir base-dir)
         base-dir))))

On Feb 23, 2013, at 9:17 PM, Joseph Schaefer <joe_schaefer_at_yahoo.com> wrote:

> Drat, I need to figure out what to do with the svn-status-base-dir function
> in order to commit from a subdirectory of a full working copy. Right now
> I hacked it to just return the start-dir for 1.7+, but I need to play a bit more
> to see if that's really the right thing to do.
>
>
>
> On Feb 22, 2013, at 3:24 PM, Joseph Schaefer <joe_schaefer_at_yahoo.com> wrote:
>
>> Here's a better patch that doesn't break the docstring.
>>
>> Index: contrib/client-side/emacs/psvn.el
>> ===================================================================
>> --- contrib/client-side/emacs/psvn.el (revision 1449112)
>> +++ contrib/client-side/emacs/psvn.el (working copy)
>> @@ -1127,33 +1127,13 @@
>> asks svn to connect to the repository and check to see if there are updates
>> there.
>>
>> -If there is no .svn directory, examine if there is CVS and run
>> -`cvs-examine'. Otherwise ask if to run `dired'."
>> + Note: psvn.el no longer supports dispatch to cvs nor dired."
>> +
>> (interactive (list (svn-read-directory-name "SVN status directory: "
>> nil default-directory nil)
>> current-prefix-arg))
>> - (let ((svn-dir (format "%s%s"
>> - (file-name-as-directory dir)
>> - (svn-wc-adm-dir-name)))
>> - (cvs-dir (format "%sCVS" (file-name-as-directory dir))))
>> - (cond
>> - ((file-directory-p svn-dir)
>> - (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
>> - (svn-status-1 dir arg))
>> - ((and (file-directory-p cvs-dir)
>> - (fboundp 'cvs-examine))
>> - (cvs-examine dir nil))
>> - (t
>> - (when (y-or-n-p
>> - (format
>> - (concat
>> - "%s "
>> - "is not Subversion controlled (missing %s "
>> - "directory). "
>> - "Run dired instead? ")
>> - dir
>> - (svn-wc-adm-dir-name)))
>> - (dired dir))))))
>> + (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
>> + (svn-status-1 dir arg))
>>
>> (defvar svn-status-display-new-status-buffer nil)
>> (defun svn-status-1 (dir &optional arg)
>>
>>
>>
>>
>>
>> On Feb 22, 2013, at 12:15 PM, Joseph Schaefer <joe_schaefer_at_yahoo.com> wrote:
>>
>>> Here's a fugly patch that I'd like to apply to trunk that lets
>>> psvn.el work properly with 1.7+ working copies that consolidate
>>> .svn dirs to the top-level of the working copy. For the most part
>>> psvn.el doesn't need to know where this directory lives, so just
>>> removing the check for it seems to work fine.
>>>
>>> Index: psvn.el
>>> ===================================================================
>>> --- psvn.el (revision 1449112)
>>> +++ psvn.el (working copy)
>>> @@ -1127,33 +1127,11 @@
>>> asks svn to connect to the repository and check to see if there are updates
>>> there.
>>>
>>> -If there is no .svn directory, examine if there is CVS and run
>>> -`cvs-examine'. Otherwise ask if to run `dired'."
>>> (interactive (list (svn-read-directory-name "SVN status directory: "
>>> nil default-directory nil)
>>> current-prefix-arg))
>>> - (let ((svn-dir (format "%s%s"
>>> - (file-name-as-directory dir)
>>> - (svn-wc-adm-dir-name)))
>>> - (cvs-dir (format "%sCVS" (file-name-as-directory dir))))
>>> - (cond
>>> - ((file-directory-p svn-dir)
>>> - (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
>>> - (svn-status-1 dir arg))
>>> - ((and (file-directory-p cvs-dir)
>>> - (fboundp 'cvs-examine))
>>> - (cvs-examine dir nil))
>>> - (t
>>> - (when (y-or-n-p
>>> - (format
>>> - (concat
>>> - "%s "
>>> - "is not Subversion controlled (missing %s "
>>> - "directory). "
>>> - "Run dired instead? ")
>>> - dir
>>> - (svn-wc-adm-dir-name)))
>>> - (dired dir))))))
>>> + (setq arg (svn-status-possibly-negate-meaning-of-arg arg 'svn-status))
>>> + (svn-status-1 dir arg))
>>>
>>> (defvar svn-status-display-new-status-buffer nil)
>>> (defun svn-status-1 (dir &optional arg)
>>>
>>
>
Received on 2013-02-25 01:38:31 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.