Skip to contentSkip to conversation

cvstrack: work on imported cvs and other git branches

PATCH In review Steffen Prohaska 2 participants 7 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cvstrack: work on imported cvs and other git branches

The idea is to import a cvs repository using git cvsimport; build a perfect history in git by cherry picking commits that are only in cvs but not in git; and export only summaries back to cvs. Cvs imports are organized on a separate git branch. git is used for merging. The differences can be sent back to cvs as a squashed commit together with a shortlog. Sent git commits are noted in the cvs commit message and will be ignored in subsequent cvs imports.

To get the idea you can run t/t9250-git-cvstrack.sh and explore the git repository created in t/trash/gitwork.

---
 .gitignore                     |    4 +
 Documentation/git-cvstrack.txt |  128 +++++++++++++++++++
 Makefile                       |    1 +
 git-cvstrack-fetch.sh          |   52 ++++++++
 git-cvstrack-init.sh           |   20 +++
 git-cvstrack-pull.sh           |   10 ++
 git-cvstrack-pushcvs.sh        |   60 +++++++++
 t/t9250-git-cvstrack.sh        |  270 ++++++++++++++++++++++++++++++++++++++++
 8 files changed, 545 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/git-cvstrack.txt
 create mode 100755 git-cvstrack-fetch.sh
 create mode 100755 git-cvstrack-init.sh
 create mode 100755 git-cvstrack-pull.sh
 create mode 100755 git-cvstrack-pushcvs.sh
 create mode 100755 t/t9250-git-cvstrack.sh

I am using these scripts successfully for some time.

What do you think?
- Is the general concept useful?
- Comments on the coding style?
- Is using branches and tags to maintain the state a bad idea?

.gitignore +4 -0
index e8b060c..9924d07 100644
@@ -30,6 +30,10 @@ git-count-objects
 git-cvsexportcommit
 git-cvsimport
 git-cvsserver
+git-cvstrack-fetch
+git-cvstrack-init
+git-cvstrack-pull
+git-cvstrack-pushcvs
 git-daemon
 git-diff
 git-diff-files
Documentation/git-cvstrack.txt new file +128 -0

128 lines not on this page · raw message

Makefile +1 -0
index 5d60dc8..8026e38 100644
@@ -212,6 +212,7 @@ SCRIPT_SH = \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
 	git-merge-resolve.sh git-merge-ours.sh \
 	git-lost-found.sh git-quiltimport.sh git-submodule.sh \
+	git-cvstrack-fetch.sh git-cvstrack-init.sh git-cvstrack-pull.sh git-cvstrack-pushcvs.sh \
 	git-filter-branch.sh
 
 SCRIPT_PERL = \
git-cvstrack-fetch.sh new file +52 -0

52 lines not on this page · raw message

git-cvstrack-init.sh new file +20 -0
new file mode 100755
index 0000000..cb60fe9
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# need exactly one argument
+USAGE="<branch>"
+. git-sh-setup
+[[ $# == 1 ]] || usage
+
+branch=$1
+
+# which must be a remote branch
+git branch -r | grep -q "/$branch\$" || die "Error: $branch must be a remote branch" 
+
+# safety nets
+git tag -l "cvspicked/$branch" | grep -q "cvspicked/$branch" && die "Error: tag cvspicked/$branch already exists" 
+git branch | grep -q "cvspending/$branch" && die "Error: branch cvspending/$branch already exists" 
+
+
+# setup tracking
+git tag -f -m "cherry-picked cvs $branch up to here" cvspicked/$branch origin/$branch || exit 1 
+git branch --no-track "cvspending/$branch" "origin/$branch" || exit 1
git-cvstrack-pull.sh new file +10 -0
new file mode 100755
index 0000000..3fd61c3
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+USAGE="<branch>"
+. git-sh-setup
+[[ $# == 1 ]] || usage
+
+. git-cvstrack-fetch
+
+echo "Pulling new cvs commits"
+git pull . "cvspending/$branch"
git-cvstrack-pushcvs.sh new file +60 -0

60 lines not on this page · raw message

t/t9250-git-cvstrack.sh new file +270 -0

270 lines not on this page · raw message

Signature · 1 line
1.5.2.2.660.gc5eb3
#1 lore raw

Hi,

Quoted 7 lines · Steffen Prohaska

The idea is to import a cvs repository using git cvsimport; build a perfect history in git by cherry picking commits that are only in cvs but not in git; and export only summaries back to cvs. Cvs imports are organized on a separate git branch. git is used for merging. The differences can be sent back to cvs as a squashed commit together with a shortlog. Sent git commits are noted in the cvs commit message and will be ignored in subsequent cvs imports.

Wouldn't it be more intuitive to add a --squash option to git-cvsexportcommit?

Quoted 2 lines

To get the idea you can run t/t9250-git-cvstrack.sh and explore the git repository created in t/trash/gitwork.

Hmm. I would have expected such a non-descriptive description _after_ the commit message, not _in_ it.

Ciao,
Dscho

#2 lore raw
Quoted 10 lines · Johannes Schindelin
Quoted 7 lines · Steffen Prohaska

The idea is to import a cvs repository using git cvsimport; build a perfect history in git by cherry picking commits that are only in cvs but not in git; and export only summaries back to cvs. Cvs imports are organized on a separate git branch. git is used for merging. The differences can be sent back to cvs as a squashed commit together with a shortlog. Sent git commits are noted in the cvs commit message and will be ignored in subsequent cvs imports.

Quoted 2 lines

Wouldn't it be more intuitive to add a --squash option to git-cvsexportcommit?

Maybe.

But how to handle commits that are sent to cvs and come back through git-cvsimport?

How can they be handled with git-cvsexportcommit/git-cvsimport?

Quoted 5 lines
Quoted 2 lines

To get the idea you can run t/t9250-git-cvstrack.sh and explore the git repository created in t/trash/gitwork.

Hmm. I would have expected such a non-descriptive description _after_ the commit message, not _in_ it.

thanks, I'll remember this for future patches.

Steffen

#3 lore raw

Hi,

Quoted 12 lines · Steffen Prohaska
Quoted 10 lines · Johannes Schindelin
Quoted 7 lines · Steffen Prohaska

The idea is to import a cvs repository using git cvsimport; build a perfect history in git by cherry picking commits that are only in cvs but not in git; and export only summaries back to cvs. Cvs imports are organized on a separate git branch. git is used for merging. The differences can be sent back to cvs as a squashed commit together with a shortlog. Sent git commits are noted in the cvs commit message and will be ignored in subsequent cvs imports.

Quoted 7 lines
Quoted 2 lines

Wouldn't it be more intuitive to add a --squash option to git-cvsexportcommit?

Maybe.

But how to handle commits that are sent to cvs and come back through git-cvsimport?

Probably I do not really understand what you are doing... If the commits come from cvs, then they are already there, no? So where do you want to commit the squashed commits?

Ciao,
Dscho

#4 lore raw
Quoted 17 lines · Johannes Schindelin
Quoted 15 lines · Steffen Prohaska
Quoted 12 lines · Johannes Schindelin
Quoted 7 lines · Steffen Prohaska

The idea is to import a cvs repository using git cvsimport; build a perfect history in git by cherry picking commits that are only in cvs but not in git; and export only summaries back to cvs. Cvs imports are organized on a separate git branch. git is used for merging. The differences can be sent back to cvs as a squashed commit together with a shortlog. Sent git commits are noted in the cvs commit message and will be ignored in subsequent cvs imports.

Wouldn't it be more intuitive to add a --squash option to git-cvsexportcommit?

Quoted 8 lines
Quoted 4 lines

Maybe.

But how to handle commits that are sent to cvs and come back through git-cvsimport?

Probably I do not really understand what you are doing... If the commits come from cvs, then they are already there, no? So where do you want to commit the squashed commits?

I do some work in git and want to send this work to cvs. I squash all _git_ commits into a single _cvs_ commit. In the next incremental import from cvs the squashed commit comes back to git (at least after cvsps time fuzz passed). If I just merged from the cvsimport branch I'd build a history in git that contains the changes twice; once in a sane way from the original git history and a second time because it was sent to cvs and came back through git-cvsimport.

What I try to achieve is to build a history in git that has
- every commit that was initially committed to cvs only once.
- every commit that was initially committed to git only once.
- provides a stable git branch that can be cloned by others. In addition I need a way to send changes from git to cvs such that cvs has all changes that are available in git.

Some examples of what I may want to do in git:
- just work as if cvs wasn't there and create topic branches. Only after work is finished the change should be sent to cvs. But changes from cvs should be continuously integrated.
- track cvs topic branches for a longer period of time and merge them several times using git and after a final merge, send the
changes
back to cvs.

The background is, I plan to convince approximately 60 developers to migrate from CVS to git and I'm searching for a way to start the transition with some beta testers, while maintaining full cvs infrastructure in place for the remaining users.

Currently, I think that I can handle this with the scripts I sent in the patch.

Steffen

#5 lore raw

Hi,

Quoted 4 lines · Steffen Prohaska

The background is, I plan to convince approximately 60 developers to migrate from CVS to git and I'm searching for a way to start the transition with some beta testers, while maintaining full cvs infrastructure in place for the remaining users.

Why not just cvsimporting into git, and then replace the CVS server with git-cvsserver? That's what I did.

Ciao,
Dscho

#6 lore raw
Quoted 9 lines · Johannes Schindelin
Quoted 4 lines · Steffen Prohaska

The background is, I plan to convince approximately 60 developers to migrate from CVS to git and I'm searching for a way to start the transition with some beta testers, while maintaining full cvs infrastructure in place for the remaining users.

Why not just cvsimporting into git, and then replace the CVS server with git-cvsserver? That's what I did.

I thought about that but I don't know yet how to slice our existing CVS repository. Most developers use partial checkouts.

But maybe I should reconsider and evaluate git-cvsserver in more detail.

Steffen