From d963809f5c2c825a42d02ac77d4761dfa1e42c61 Mon Sep 17 00:00:00 2001 From: Kevin Rosenberg Date: Thu, 20 Aug 2009 16:50:36 -0600 Subject: [PATCH] support git repositories --- debian/changelog | 8 ++++++++ debian/compat | 2 +- debian/control | 6 +++--- debian/rules | 43 ++++++++----------------------------------- main.lisp | 29 +++++++++++++++++++++++++---- 5 files changed, 45 insertions(+), 43 deletions(-) diff --git a/debian/changelog b/debian/changelog index 49abb2f..9e5c38f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +vcs-tree (0.4.0-1) unstable; urgency=low + + * New upstream: support git + * Convert to Debhelper 7 + * Simplify debian/rules + + -- Kevin M. Rosenberg Thu, 20 Aug 2009 16:47:28 -0600 + vcs-tree (0.3.2-4) unstable; urgency=low * Add Vcs-Browser field diff --git a/debian/compat b/debian/compat index 7ed6ff8..7f8f011 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -5 +7 diff --git a/debian/control b/debian/control index ad24202..30678c0 100644 --- a/debian/control +++ b/debian/control @@ -2,14 +2,14 @@ Source: vcs-tree Section: vcs Priority: optional Maintainer: Kevin M. Rosenberg -Build-Depends: debhelper (>> 5.0.0), sbcl (>= 0.9.4) -Standards-Version: 3.8.2.0 +Build-Depends: debhelper (>> 7.0.0), sbcl (>= 0.9.4) +Standards-Version: 3.8.3.0 Vcs-Git: git://git.b9.com/vcs-tree.git Vcs-Browser: http://git.b9.com/?p=vcs-tree.git Package: vcs-tree Architecture: any -Depends: ${shlibs:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} Description: Version Control System Tree Walker vcs-tree walks through a directory tree and performs actions on CVS or Subversion directories. vcs-tree works differently than just using diff --git a/debian/rules b/debian/rules index 0b220c5..3585ac8 100755 --- a/debian/rules +++ b/debian/rules @@ -2,23 +2,12 @@ pkg := vcs-tree debpkg := vcs-tree - - -bin-dir := usr/bin -doc-dir := usr/share/doc/$(debpkg) - -configure: configure-stamp -configure-stamp: - dh_testdir - # Add here commands to configure the package. - touch configure-stamp - +bin-dir := usr/bin build: build-stamp -build-stamp: configure-stamp +build-stamp: dh_testdir - # Add here commands to compile the package. $(MAKE) _${pkg} touch build-stamp @@ -26,7 +15,6 @@ clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp - # Add here commands to clean up after the build process. $(MAKE) clean rm -f debian/${debpkg}.postinst.* debian/${debpkg}.prerm.* dh_clean @@ -34,47 +22,32 @@ clean: install: build dh_testdir dh_testroot - dh_clean -k - # Add here commands to install the package into debian/xlunit. + dh_prep dh_installdirs $(bin-dir) dh_install $(pkg) $(bin-dir) dh_install _$(pkg) $(bin-dir) -# Build architecture-independent files here. -binary-indep: build install - +binary-indep: -# Build architecture-dependent files here. -binary-arch: build install +binary-arch: install dh_testdir dh_testroot -# dh_installdebconf dh_installdocs dh_installexamples -# dh_installmenu -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit -# dh_installcron dh_installman $(pkg).1 dh_link usr/share/man/man1/$(pkg).1 usr/share/man/man1/_$(pkg).1 -# dh_installinfo -# dh_undocumented dh_installchangelogs # don't strip sbcl binary or will remove vcs-tree code dh_strip -X_$(pkg) dh_compress dh_fixperms -# dh_makeshlibs dh_installdeb -# dh_perl dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure +binary: binary-arch + +.PHONY: build clean binary-indep binary-arch binary install diff --git a/main.lisp b/main.lisp index 1490525..861fcd2 100644 --- a/main.lisp +++ b/main.lisp @@ -21,6 +21,8 @@ (string= "CVS" (car (last (pathname-directory x)))) (string= ".svn" + (car (last (pathname-directory x)))) + (string= ".git" (car (last (pathname-directory x))))))) (defun is-cvs-managed (dir) @@ -33,9 +35,14 @@ (make-pathname :directory '(:relative ".svn")) dir))) +(defun is-git-managed (dir) + (probe-directory (merge-pathnames + (make-pathname :directory '(:relative ".git")) + dir))) + (defun filter-tree (tree) "Called for a directory tree. First argument is name of current tree. -Returns a list of directories managed by CVS or SVN." +Returns a list of directories managed by CVS, SVN, or GIT." (when (and (listp tree) (not (is-vcs-directory (car tree)))) (let* ((managed-pair (cond @@ -44,6 +51,11 @@ Returns a list of directories managed by CVS or SVN." (car (last (pathname-directory (car x)))))) :test 'equal) (cons (car tree) :svn)) + ((find ".git" (cdr tree) + :key (lambda (x) (when (pathnamep (car x)) + (car (last (pathname-directory (car x)))))) + :test 'equal) + (cons (car tree) :git)) ((find "CVS" (cdr tree) :key (lambda (x) (when (pathnamep (car x)) (car (last (pathname-directory (car x)))))) @@ -76,6 +88,9 @@ Returns a list of directories managed by CVS or SVN." (:svn (make-pathname :name "entries" :type nil :directory '(:relative ".svn"))) + (:git + (make-pathname :name "HEAD" :type nil + :directory '(:relative ".git"))) (:cvs (make-pathname :name "Entries" :type nil :directory '(:relative "CVS")))) @@ -83,12 +98,12 @@ Returns a list of directories managed by CVS or SVN." (entries (read-file-to-strings entries-path)) (dir-name (car (last (pathname-directory subdir)))) (match (case type - (:svn + ((:svn :git) (concatenate 'string "name=\"" dir-name "\"")) (:cvs (concatenate 'string "D/" dir-name "////"))))) (case type - (:svn + ((:svn :git) (some (lambda (line) (string= match (string-trim-whitespace line))) entries)) (:cvs @@ -103,7 +118,11 @@ Returns a list of directories managed by CVS or SVN." (let* ((vcs-cmd (ecase action (:update - (format nil "~A update" type-name)) + (cond + ((equal type-name "git") + (format nil "~A pull" type-name)) + (t + (format nil "~A update" type-name)))) (:status (format nil "~A status" type-name)) (:commit @@ -123,6 +142,8 @@ Returns a list of directories managed by CVS or SVN." (process dir "cvs")) ((is-svn-managed dir) (process dir "svn")) + ((is-git-managed dir) + (process dir "git")) (t (format *error-output* "INTERAL ERROR: not a version control system directory ~A" dir) -- 2.34.1