git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Finnerty,
	James M Mr CTR USA USASOC-SOAR"  <jim.finnerty.ctr@soar.army.mil>
Cc: git@vger.kernel.org, "Hawkins,
	Lisa M Mrs CTR USA USASOC-SOAR" 
	<lisa.hawkins1.ctr@soar.army.mil>
Subject: Re: rcs
Date: Tue, 29 Oct 2013 14:16:14 -0400	[thread overview]
Message-ID: <20131029181614.GA13601@sigill.intra.peff.net> (raw)
In-Reply-To: <B49EE6A27F1B0642B4D12AD9C064E8C7B072E3@SOARCPRVSBEU000.regnet2.soar.ns>

On Tue, Oct 29, 2013 at 11:35:21AM -0500, Finnerty, James M Mr CTR USA USASOC-SOAR wrote:

> Hi. I'm going to attempt to import a git database into Razor which is
> linux rcs based. Does the linux version of git use rcs ?

No, the formats are completely different, and you will have to
translate.  We don't usually get requests to go from git to rcs; it
usually goes the other way. :)

I don't know offhand of a tool that does it out of the box.  It should
be possible to generate the RCS files directly from the "git log" data
(though RCS does not use unified diff for storage, but rather "ed"
commands, so you'd have to translate there). A slower simpler way would
be to just "replay" the git history, committing to rcs at each step.
That might look something like the hacky, largely untested script below:

-- >8 --
#!/bin/sh

# note that this does not handle filenames which need quoting.
changed_files() {
  git diff-tree -r --name-only "$1" | tail -n +2
}

# Look at each commit in chronological order; note
# that this will linearize your history, as this
# script does not know about branches at all.
git rev-list --reverse HEAD |
while read rev; do

  # take a lock on each file we are about to update
  rcs -l $(changed_files $rev)

  # update the working tree to this revision
  git checkout -fq $rev

  # get commit date in iso8601
  date=$(git log -1 --format=%ai)

  # get author "login". This just pulls the username from
  # the email address; you may also want to map email
  # addresses to logins via a file.
  login=$(git log -1 --format=%ae | cut -d@ -f1)

  # original commit message
  msg=$(git log -1 --format=%B)

  # now we're ready to checkin
  ci -w"$login" -d"$date" -m"$msg" $(changed_files $rev) </dev/null
done
-- 8< --

There are lots of ways it can go wrong (and I tried to note them above),
but it may be enough for a simple history.

-Peff

  parent reply	other threads:[~2013-10-29 18:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 16:35 rcs Finnerty, James M Mr CTR USA USASOC-SOAR
2013-10-29 17:12 ` rcs Keshav Kini
2013-10-29 18:16 ` Jeff King [this message]
2013-10-29 19:17   ` rcs Finnerty, James M Mr CTR USA USASOC-SOAR
2013-11-05 14:56     ` rcs Jakub Narębski
2013-11-06 17:28       ` rcs Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20131029181614.GA13601@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jim.finnerty.ctr@soar.army.mil \
    --cc=lisa.hawkins1.ctr@soar.army.mil \
    /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.
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 NNTP newsgroup(s).