Added a description for my extensions (README-my-extensions.html).
[parsecvs/imz-RCS2git-use-cases.git] / RCS2git-use-cases / parseRCS-indep
blob248e9b2a785f4f3bf89a128bbf309e23280c4541
1 #!/bin/bash
3 # $Id$
4 # Description:
5 # It translates RCS histories for individual files into Git as independent histories.
6 # I will manually merge the results of parseRCS-indep to form a good Git history of the tree
7 # (manual merging can give more sensible results than parsecvs in cases when CVS hasn't been used, but there are merely RCS histories).
8 #
9 # For example, as the first thing, I want to merge all the initial commits of each of the file in order to populate the tree initially,
10 # and only then, above the populated tree, I will merge further changes.
12 # Note: you can't use octopus merge for commits without a common ancestor
13 # (the RCS histories are like this), so you'll have to successively merge them;
14 # for example, to merge the tips of the RCS histories (to get approximately the
15 # same result as a plain parsecvs gives), you should do (after parseRCS-indep):
17 # for h in $(git heads-for-merge); do git merge "$h"; done
19 # Also have a look at what parseRCS-merging-init does; it does a merge without touching
20 # the working tree.
21 # In its tuen, it uses the helper script git-mread-and-commit.
22 # (So, by using it, you could do the same for the tips of the RCS histories if you want.)
24 # Author: Ivan Zakharyaschev imz at altlinux dot org, March 2009.
25 # I publish it under GPLv2 or later (as parsecvs is published).
27 # In the usage hints, it refers to the helpers from my "git-shortcuts" collection
28 # (http://gitorious.org/projects/git-shortcuts
29 # or http://repo.or.cz/w/git-shortcuts.git ).
32 usage() {
33 printf $"Usage: %s [ ... ]\n" "$0"
34 echo $"Creates independent branches for RCS/* histories and saves their IDs in .git/FETCH_HEAD."
35 echo $"You can then list them with 'git heads-for-merge'."
36 echo $"You can merge them and commit with an old date with:
37 echo 'Merged RCS histories.' | git mread-and-commit TAG \$(git heads-for-merge)"
38 echo $"Passes through the options to parsecvs."
41 case "$1" in
42 -h|--help|--usage)
43 usage
44 exit 1
46 esac
50 # Passes through the options to parsecvs.
52 # Fail on errors:
53 set -e
55 git init
57 for f in RCS/*; do
58 parsecvs-as-sidehist refs/remotes/"${f%%,v}" "$@" "$f"
59 done