emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Rainer M Krug <r.m.krug@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: OT: Question concerning vc-working-revision in git versus	svn
Date: Sun, 28 Nov 2010 21:38:19 +0100	[thread overview]
Message-ID: <87pqtpmbes.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <4CEE66D5.2030909@gmail.com>


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

      reply	other threads:[~2010-11-28 20:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pqtpmbes.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=r.m.krug@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).