Skip to content

Commit

Permalink
cleanup svn remote handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
bogolisk committed Dec 10, 2012
1 parent aafe45c commit be7325d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 31 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ clean : doc.clean

loaddeps : $(LOAD_DEPS)

egg-reload.el : $(LOAD_DEPS)
egg-reload.el : Makefile $(LOAD_DEPS)
@echo Generating $@
@cat $^ | tsort | sed -nre 's/^(.+)$$/\(load "\1"\)/p' > $@
@cat $(filter-out $<, $^) | tsort | sed -nre 's/^(.+)$$/\(load "\1"\)/p' > $@
@echo "(defun egg-reload ()\n (interactive)" >> $@
@echo " (load \"egg-reload\"))\n" >> $@

-include $(DEPS)
31 changes: 14 additions & 17 deletions egg-git.el
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ as repo state instead of re-read from disc."
(and (egg-git-dir)
(cadr (assoc attr (egg-config-section type name)))))

(defvar egg-speciall-remote-handlers nil)
(defvar egg-special-remote-handlers nil)

(defun egg-tracking-target (branch &optional mode)
(let ((remote (egg-config-get "branch" "remote" branch))
Expand All @@ -800,7 +800,8 @@ as repo state instead of re-read from disc."
(setq rbranch (egg-rbranch-name rbranch-full))
(cond ((null mode) (concat remote "/" rbranch))
((eq :name-only mode) rbranch)
(t (or (run-hook-with-args-until-success 'egg-speciall-remote-handlers rbranch-full remote)
(t (if (setq remote (run-hook-with-args-until-success 'egg-special-remote-handlers
remote rbranch-full))
(list rbranch remote)))))))

(defun egg-complete-get-all-refs (prefix &optional matches)
Expand Down Expand Up @@ -901,7 +902,7 @@ REMOTE-REF-PROPERTIES and REMOTE-SITE-PROPERTIES."
;; 8: is annotated tag
'(1 2 3 4 5 6 7) "show-ref" "-d"))
(symbolic-HEAD (egg-get-symbolic-HEAD))
annotated-tags refs special-names r-remote r-branch)
annotated-tags refs)
;; remove the annotated tags from the list
(setq refs-desc-list
(delq nil
Expand All @@ -919,7 +920,8 @@ REMOTE-REF-PROPERTIES and REMOTE-SITE-PROPERTIES."
(mapcar (lambda (desc)
(let ((full-name (cdr (assq 1 desc)))
(name (cdr (or (assq 5 desc) (assq 7 desc))))
(remote (cdr (assq 6 desc))))
(remote (cdr (assq 6 desc)))
short-name)
(cond ((assq 2 desc)
;; head
(cons full-name
Expand All @@ -941,26 +943,21 @@ REMOTE-REF-PROPERTIES and REMOTE-SITE-PROPERTIES."
tag-properties))))
((assq 4 desc)
;; remote
(setq short-name (substring name (length remote)))
(setq remote (or (run-hook-with-args-until-success
'egg-special-remote-handlers remote full-name short-name)
remote))
(cons full-name
(progn
(setq special-names
(or (cdr (run-hook-with-args-until-success
'egg-speciall-remote-handlers full-name remote
(substring name (length remote))))
(list remote (substring name (length remote)))))
(setq r-remote (nth 0 special-names)
r-branch (nth 1 special-names))
(concat (if (stringp r-remote)
(apply 'propertize r-remote
(concat (if (stringp remote)
(apply 'propertize remote
:ref (cons name :remote)
remote-site-properties)
;; svn has no remote namee
"")
(apply 'propertize r-branch
(apply 'propertize short-name
:full-name full-name
:ref (cons name :remote)
remote-ref-properties))
)))
remote-ref-properties))))
((assq 7 desc)
;; stash
(cons full-name
Expand Down
31 changes: 19 additions & 12 deletions egg-svn.el
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,25 @@ output processing function for `egg--do-handle-exit'."
(defsubst egg-svn-full-to-remote (full-ref)
(file-name-nondirectory (directory-file-name (file-name-directory full-ref))))

(defun egg-svn-handle-svn-remote (branch remote &rest names)
(if (or (egg-git-to-string "config" "--get" (concat "svn-remote." remote ".url"))
(and (member branch (egg-svn-all-full-refs))
(setq remote (egg-svn-full-to-remote branch))))
(cons branch (mapcar (lambda (name)
(propertize name
:svn-remote (egg-git-svn-remote-name)
:push #'egg-push-to-svn
:fetch #'egg-fetch-from-svn))
(cons remote names)))))

(add-hook 'egg-speciall-remote-handlers #'egg-svn-handle-svn-remote)
(defun egg-svn-handle-svn-remote (remote branch &rest names)
(when (or (egg-git-to-string "config" "--get" (concat "svn-remote." remote ".url"))
(and (stringp branch)
(member branch (egg-svn-all-full-refs))
(setq remote (egg-svn-full-to-remote branch))))
(setq remote (propertize remote
:svn-remote (egg-git-svn-remote-name)
:push #'egg-push-to-svn
:fetch #'egg-fetch-from-svn))
(mapc (lambda (name)
(add-text-properties 0 (length name)
(list :svn-remote (egg-git-svn-remote-name)
:push #'egg-push-to-svn
:fetch #'egg-fetch-from-svn)
name))
names)
remote))

(add-hook 'egg-special-remote-handlers #'egg-svn-handle-svn-remote)



Expand Down

0 comments on commit be7325d

Please sign in to comment.