emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* OT: Question concerning vc-working-revision in git versus svn
@ 2010-11-25 13:38 Rainer M Krug
  2010-11-28 20:38 ` David Maus
  0 siblings, 1 reply; 2+ messages in thread
From: Rainer M Krug @ 2010-11-25 13:38 UTC (permalink / raw)
  To: emacs-orgmode

-----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?

Thanks,

Rainer




- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzuZtUACgkQoYgNqgF2egoa/ACfWnus5RHcIUq45FJns2xZI7mj
ixsAn2r+/vQaahvbcEex8s93iR9QcP47
=MmZf
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: OT: Question concerning vc-working-revision in git versus svn
  2010-11-25 13:38 OT: Question concerning vc-working-revision in git versus svn Rainer M Krug
@ 2010-11-28 20:38 ` David Maus
  0 siblings, 0 replies; 2+ messages in thread
From: David Maus @ 2010-11-28 20:38 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1748 bytes --]

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

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-28 20:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-25 13:38 OT: Question concerning vc-working-revision in git versus svn Rainer M Krug
2010-11-28 20:38 ` David Maus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).