(fset 'my-format-changelog
[?\M-x ?s ?e ?a ?r ?c ?h ?- ?f ?o ?r ?w ?a ?r ?d ?\C-m ?- ?- ?- ?-
?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?-
?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?-
?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?- ?-
?- ?- ?\C-m ?\C-a ?\C-k ?\C-k ?\M-d ?\M-d ?\C-d ?\C-d ?\C-d ?\M-f
?\M-f ?\M-f ?\C-k ? ? ?\M-: ?( ?i ?n ?s ?e ?r ?t ? ?u ?s ?e ?r
?- ?f ?u ?l ?l ?- ?n ?a ?m ?e ?) ?\C-m ? ? ?< ?\M-: ?( ?i ?n
?s ?e ?r ?t ? ?u ?s ?e ?r ?- ?m ?a ?i ?l ?- ?a ?d ?d ?r ?e ?s ?s
?) ?\C-m ?> ?\C-n ?\C-a ?\C-k])
(defun my-svn-commit-with-diff ()
(interactive)
(vc-diff nil)
(let ((diff-buffer (current-buffer)))
(other-window 1)
(vc-next-action nil)
(other-window 1)
(switch-to-buffer diff-buffer)
(other-window 1)))
(defun my-update-svn-changelog ()
"Gets all the revisions since the last time the ChangeLog was updated,
formats them, then inserts them into the ChangeLog."
(interactive)
(setq temp-buffer "*my*"
dashes "------------------------------------------------------------------------")
(if (file-exists-p change-log-default-name)
(progn
(switch-to-buffer (get-buffer-create temp-buffer))
(erase-buffer)
(call-process "svn" nil temp-buffer nil "info" change-log-default-name)
(beginning-of-buffer)
(let ((regexp "\\(.\\|\n\\)+Revision: \\([0-9]+\\)\\(.\\|\n\\)+Last Changed Rev: \\([0-9]+\\)")
(current-revision-regexp 2)
(last-revision-regexp 4))
(if (looking-at regexp)
(let ((current-revision (match-string current-revision-regexp))
(last-revision (match-string last-revision-regexp)))
(if (> (string-to-number current-revision) (string-to-number last-revision))
(progn
(erase-buffer)
(shell-command (concat "svn log -v --revision "
current-revision ":" last-revision)
temp-buffer)
(end-of-buffer)
(search-backward dashes)
(kill-whole-line 1)
(let ((changes (count-matches dashes (point-min) (point-max))))
(beginning-of-buffer)
(while (>= (setq changes (1- changes)) 0)
(execute-kbd-macro (symbol-function 'my-format-changelog)))
(let ((changelog-string (buffer-string)))
(find-file change-log-default-name)
(beginning-of-buffer)
(insert changelog-string)
(message "Done."))))
(message "No changes needed.")))
(message "Regexp didn't match.")))
(kill-buffer temp-buffer))
(message "No %s found." change-log-default-name)))
(defun my-svn-release (version)
"Copies all the files needed for a release via a Manifest file to the tags
directory of the project in the subversion repository."
(interactive "sVersion: ")
(setq directories '(("Giftsfor" . "/docs/svn/www/Giftsfor")
("Madinah" . "/docs/svn/www/Madinah")
("Metaware" . "/docs/svn/www/Metaware")
("Paramount" . "/docs/svn/www/Paramount")
("MERCS" . "/docs/svn/www/MERCS")
("Authentication" . "/docs/svn/www/Authentication")
("Cache" . "/docs/svn/www/Cache")
("DB" . "/docs/svn/www/DB")
("Mail" . "/docs/svn/www/Mail")
("Page" . "/docs/svn/www/Page")
("Text" . "/docs/svn/www/Text"))
manifest-file "Manifest"
repository "svn+ssh://shodan/var/svn/www"
temp-buffer "*my-svn-release*"
svn-command "svn"
command-stack nil)
(dolist (directory directories)
(let ((current-key (car directory))
(current-value (cdr directory)))
(if (string-match current-value default-directory)
(if (file-exists-p manifest-file)
(progn
(find-file manifest-file)
(beginning-of-buffer)
(setq command-stack
(cons
(list svn-command "mkdir" version)
command-stack))
(let ((regexp "^\\(copy\\|mkdir\\)\s+\\(.+\\)$")
(manifest-action-regexp 1)
(manifest-file-regexp 2))
(while (< (point) (point-max))
(if (looking-at regexp)
(let ((manifest-action (match-string manifest-action-regexp))
(manifest-file (match-string manifest-file-regexp)))
(if (string-match manifest-action "copy")
(setq command-stack
(cons
(list svn-command "copy"
manifest-file
(concat version "/" manifest-file))
command-stack)))
(if (string-match manifest-action "mkdir")
(setq command-stack
(cons
(list svn-command "mkdir"
(concat version "/" manifest-file))
command-stack)))))
(next-line 1)))
(kill-buffer (current-buffer))
(setq command-stack
(cons
(list svn-command "copy" version
(concat repository "/" current-key "/tags")
"-m" "Copied release dir to tag dir")
command-stack))
(setq command-stack
(cons
(list svn-command "delete" "--force" version)
command-stack))
(switch-to-buffer-other-window (get-buffer-create temp-buffer))
(erase-buffer)
(dolist (command-string (reverse command-stack))
(let ((command (car command-string))
(arglist (cdr command-string)))
(apply 'call-process command nil temp-buffer t arglist)))
(kill-buffer-and-window)
(message "Version %s commited." version))
(progn
(if (y-or-n-p "No Manifest file, copy trunk? ")
(progn
(setq command-stack
(cons
(list svn-command "cp" (concat repository "/" current-key "/trunk")
(concat repository "/" current-key "/tags/" version)
"-m" "Copied release dir to tag dir")
command-stack))
(dolist (command-string (reverse command-stack))
(let ((command (car command-string))
(arglist (cdr command-string)))
(apply 'call-process command nil temp-buffer t arglist)))
(message "Version %s commited." version))))))))
(if (not command-stack)
(message "Directory not set up for release.")))
(provide 'my-subversion)
:-- my-subversion.el All (1,0) (Emacs-Lisp/lah)