From Fedora Project Wiki

(Add category)
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
Get the script found here: http://pfrields.fedorapeople.org/scripts/authors-from-fas2-group.py
Get the script found here: http://pfrields.fedorapeople.org/scripts/authors-from-fas2-group.py


Run the script: <pre>python authors-from-fas2-group.py</pre>
Make sure you have the <code>python-fedora</code> package installed:
<pre>su -c 'yum install python-fedora'</pre>
 
Run the script:
<pre>python authors-from-fas2-group.py</pre>


Provide your FAS username and password, and the group name <code>docs</code>.  You will also need to run it again with the group name <code>cvsl10n</code>.  Use the <code>cat</code> command to copy both sets of results (in any order) to a single file <code>authors.txt</code>.
Provide your FAS username and password, and the group name <code>docs</code>.  You will also need to run it again with the group name <code>cvsl10n</code>.  Use the <code>cat</code> command to copy both sets of results (in any order) to a single file <code>authors.txt</code>.


NOTE:  When you're finished with importing Docs CVS modules, don't bother to retain the <code>authors.txt</code> file, as the results are expected to change over time.
{{Admon/note | The authors.txt file | When you're finished with importing Docs CVS modules, don't bother to retain the <code>authors.txt</code> file, as the results are expected to change over time.}}
 
 
== Getting started ==
 
Whether you're working with branched or non-branched CVS modules, you obviously need to install <code>git</code>:
<pre>su -c 'yum install git-all'</pre>
 
Then make a directory for your new git repository:
<pre>mkdir -p &lt;GITREPODIR&gt;</pre>
 
 
== Converting modules ==
 
=== Non-branched CVS modules ===
 
Run <code>git-cvsimport</code> for the module.  Substitute the directory you just made for &lt;GITREPODIR&gt;, and the module name (like "foo-guide") for &lt;MODULE&gt;.<br/>
 
{{Admon/note | Keep in mind | The <code>\</code> character indicates a line wrap, so this command is one line.}}
 
<pre>git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs  \
-S docs-common -v -C &lt;GITREPODIR&gt; -u -p x -a -A ~/authors.txt &lt;MODULE&gt;</pre>
 
This could take quite a while, depending on the size of the repository and the speed of your network connection.
 
 
=== Branched CVS modules ===


== Import CVS to git ==
Branched CVS modules have a directory for each release of Fedora (i.e. F-7, F-8, and so on).  To convert them, do this:


<!-- use OL and LI elements, which is the only way to preserve multi-line PRE in MediaWiki -->
<!-- use OL and LI elements, which is the only way to preserve multi-line PRE in MediaWiki -->
<!-- Q.v.:  http://marc.info/?l=mediawiki-l&m=119489994314561&w=2 -->
<!-- Q.v.:  http://marc.info/?l=mediawiki-l&m=119489994314561&w=2 -->
<ol>
<ol>
<li>Install <code>git</code> if you haven't already: <pre>su -c 'yum install git-all'</pre></li>
<li>Create the ''master'' branch from the contents of the ''devel'' CVS module directory:
<li>Make a directory for your new git repository: <pre>mkdir -p &lt;GITREPODIR&gt;</pre></li>
<pre>git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs  \
<li>Run <code>git-cvsimport</code> for the moduleSubstitute the directory you just made for &lt;GITREPODIR&gt;, and the module name (like "foo-guide") for &lt;MODULE&gt;.<br/>
-S docs-common -v -C &lt;GITREPODIR&gt; -u -p x -a -A ~/authors.txt &lt;MODULE&gt;/devel</pre></li>
{{Admon/note | Keep in mind | <ol><li>If the module is branched for each Fedora release, you probably want to use "foo-guide/devel" for &lt;MODULE&gt;.</li>
 
<li>The <code>\</code> character is a line wrap, so this command is one line.</li></ol>}}
<li>Look for tags that reveal where versions were branched.  If you're lucky, you'll see tags like <code>&lt;MODULE&gt;-8.0</code>, or something to that effect.
<pre>git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs   \
<pre>git tag</pre>
-S docs-common -v -C &lt;GITREPODIR&gt; -u -p x -a -A ~/authors.txt &lt;MODULE&gt;</pre></li>
 
If you don't, that means no one tagged the source at the appropriate pointUnfortunately, Docs CVS never had any enforcing build system like the Package CVS.  However, you can do a little sleuthing in a document's content, or in the CVS history, to find out the date when it was branched.  Then find the git commit message for that branching, or the last one ''before'' that date, and use that as your branch point.</li>
 
<li>Use the tag or the date to create a new branch in your local git repository.  Use a branch name like ''f{{FedoraVersion}}'' for the &lt;BRANCH&gt;.
<pre>git checkout -b &lt;BRANCH&gt; &lt;TAG_NAME_or_COMMIT&gt;</pre></li>
 
<li>You are now on the new branch automatically.  Do a <code>git-cvsimport</code> from the appropriate CVS branch directory -- &lt;CVS_BRANCH&gt; might be F-8 for instance. Don't forget the <code>-o &lt;BRANCH&gt;</code> option in this command!
<pre>git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs \
-S docs-common -v -C &lt;GITREPODIR&gt; -u -p x -a -A ~/authors.txt \
-o &lt;BRANCH&gt; &lt;MODULE&gt;/&lt;CVS_BRANCH&gt;</pre>
 
Repeat the above steps for each Fedora release that has a branch directory in CVS.  Make a new git branch for each!</li>
</ol>
</ol>


This step could take quite a while, depending on the size of the repository and the speed of your network connection.
Now you're ready to use this content for your new repository.
 
==== Pushing a new branch ====
 
If you need to push the results of the previous procedure to an existing repo, make sure you are still on the new branch with the <code>git branch</code> command.  You must have commit rights to the repository in question, which you should have if you used a <code>git+ssh://</code> protocol to check out the repository. Then push with this command, substituting the branch name for &lt;BRANCH&gt;:
<pre>git push origin &lt;BRANCH&gt;</pre>
 
[[Category:Docs Project how to]]

Latest revision as of 12:34, 11 June 2009

This document demonstrates how to turn a Docs CVS module into a git repo.

Create author file

Get the script found here: http://pfrields.fedorapeople.org/scripts/authors-from-fas2-group.py

Make sure you have the python-fedora package installed:

su -c 'yum install python-fedora'

Run the script:

python authors-from-fas2-group.py

Provide your FAS username and password, and the group name docs. You will also need to run it again with the group name cvsl10n. Use the cat command to copy both sets of results (in any order) to a single file authors.txt.

The authors.txt file
When you're finished with importing Docs CVS modules, don't bother to retain the authors.txt file, as the results are expected to change over time.


Getting started

Whether you're working with branched or non-branched CVS modules, you obviously need to install git:

su -c 'yum install git-all'

Then make a directory for your new git repository:

mkdir -p <GITREPODIR>


Converting modules

Non-branched CVS modules

Run git-cvsimport for the module. Substitute the directory you just made for <GITREPODIR>, and the module name (like "foo-guide") for <MODULE>.

Keep in mind
The \ character indicates a line wrap, so this command is one line.
git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs  \
-S docs-common -v -C <GITREPODIR> -u -p x -a -A ~/authors.txt <MODULE>

This could take quite a while, depending on the size of the repository and the speed of your network connection.


Branched CVS modules

Branched CVS modules have a directory for each release of Fedora (i.e. F-7, F-8, and so on). To convert them, do this:

  1. Create the master branch from the contents of the devel CVS module directory:
    git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs  \
    -S docs-common -v -C <GITREPODIR> -u -p x -a -A ~/authors.txt <MODULE>/devel
  2. Look for tags that reveal where versions were branched. If you're lucky, you'll see tags like <MODULE>-8.0, or something to that effect.
    git tag
    If you don't, that means no one tagged the source at the appropriate point. Unfortunately, Docs CVS never had any enforcing build system like the Package CVS. However, you can do a little sleuthing in a document's content, or in the CVS history, to find out the date when it was branched. Then find the git commit message for that branching, or the last one before that date, and use that as your branch point.
  3. Use the tag or the date to create a new branch in your local git repository. Use a branch name like f41 for the <BRANCH>.
    git checkout -b <BRANCH> <TAG_NAME_or_COMMIT>
  4. You are now on the new branch automatically. Do a git-cvsimport from the appropriate CVS branch directory -- <CVS_BRANCH> might be F-8 for instance. Don't forget the -o <BRANCH> option in this command!
    git-cvsimport -d :pserver:anonymous@cvs.fedoraproject.org:/cvs/docs  \
    -S docs-common -v -C <GITREPODIR> -u -p x -a -A ~/authors.txt  \
    -o <BRANCH> <MODULE>/<CVS_BRANCH>
    Repeat the above steps for each Fedora release that has a branch directory in CVS. Make a new git branch for each!

Now you're ready to use this content for your new repository.

Pushing a new branch

If you need to push the results of the previous procedure to an existing repo, make sure you are still on the new branch with the git branch command. You must have commit rights to the repository in question, which you should have if you used a git+ssh:// protocol to check out the repository. Then push with this command, substituting the branch name for <BRANCH>:

git push origin <BRANCH>