From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: Re: OT: Question concerning vc-working-revision in git versus svn Date: Sun, 28 Nov 2010 21:38:19 +0100 Message-ID: <87pqtpmbes.wl%dmaus@ictsoc.de> References: <4CEE66D5.2030909@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============0091603359==" Return-path: Received: from [140.186.70.92] (port=55953 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PMo14-0005HZ-44 for emacs-orgmode@gnu.org; Sun, 28 Nov 2010 15:38:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PMo12-0001vM-RM for emacs-orgmode@gnu.org; Sun, 28 Nov 2010 15:38:34 -0500 Received: from mailout110.xlhost.de ([213.202.242.110]:33007 helo=mysql1.xlhost.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PMo12-0001vG-L5 for emacs-orgmode@gnu.org; Sun, 28 Nov 2010 15:38:32 -0500 In-Reply-To: <4CEE66D5.2030909@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug Cc: emacs-orgmode --===============0091603359== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Sun_Nov_28_21:38:19_2010-1"; micalg=pgp-sha256; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Sun_Nov_28_21:38:19_2010-1 Content-Type: text/plain; charset=US-ASCII At Thu, 25 Nov 2010 14:38:29 +0100, Rainer M Krug wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi > > I migrated from svn to git, but I have one problem: in some documents, I > used > src_emacs-lisp[:exports results]{(vc-working-revision (or > (buffer-file-name) org-current-export-file))} > to insert the revision of the document. In svn, this resulted in a > number, through which I could identify the revision and retrieve it from > svn when needed in the future. > Under git, it simply tells me "master" - is there anything I can do to > get something similar then the revision number in svn, which I can use > to retrieve the version from git? The problem is, that Git does not track revision of single files, but only the entire work dir. So from Git's point of view there is no such thing like a revision number of a particular file. You might use this function (defun my/git-last-commit-id () "Return last commit in current workdir." (let ((commit (shell-command-to-string "git log -1 --pretty=oneline"))) (when (stringp commit) (message (substring commit 0 40))))) To insert the ID of the last commit in the src_emacs_lisp[:exports results] line. Depending of the exact use of Git (e.g. explicitly committing changes vs. auto-commits via cron) using rcs (which supports file revision numbers) on top of Git. I do this for some files and have this in my .emacs.d/init.el: (setq vc-handled-backends (append (list 'RCS 'Git) (delq 'Git (delq 'RCS vc-handled-backends)))) What makes vc prefer RCS over Git, and Git over all other VCSs. So C-x v v by default uses RCS. HTH, -- David -- OpenPGP... 0x99ADB83B5A4478E6 Jabber.... dmjena@jabber.org Email..... dmaus@ictsoc.de --pgp-sign-Multipart_Sun_Nov_28_21:38:19_2010-1 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAkzyvbsACgkQma24O1pEeOa4lAD+NjJgKtp7CAtjPUDjbv16HBSz hZtZ0Qf7hjRL/7utqHwBANMsL4G30PiD6ROgK+m6dY1g3beZIAujzP5aZg4Wa8xm =X8yV -----END PGP SIGNATURE----- --pgp-sign-Multipart_Sun_Nov_28_21:38:19_2010-1-- --===============0091603359== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0091603359==--