* cvsimport woes
@ 2006-03-04 7:47 Rajkumar S
2006-03-06 9:24 ` Martin Langhoff
0 siblings, 1 reply; 8+ messages in thread
From: Rajkumar S @ 2006-03-04 7:47 UTC (permalink / raw)
To: git
Hi,
I am trying to track a cvs project using git. The idea is to use cvsimport to update my
local git copy and make my changes in a separate branch. But for some reason after
cvsimport the last update of cvs repository is not reflected in git. I have made a small
script to test this behavior and am able to reproduce is consistently. I am working on
FreeBSD 6.0-RELEASE, git version 1.2.4 and cvsps version 2.1
The first script is to init a cvs repository, add 3 files and cvsimport it into git
repository, before which I remove the all directories and .cvsps
raj@beastie:~$ cat git_init.sh
export CVSROOT=/home/raj/cvsroot
rm -rf cvsroot/ git/ src/ /home/raj/.cvsps
mkdir cvsroot git src
cvs init
cd src/
echo "Line one" > file.txt
echo "Line one" > file1.txt
echo "Line one" > file2.txt
cvs import -m "Imported sources" src start realstart
cd ..
rm -rf src/
cvs co src
git cvsimport -v -d /home/raj/cvsroot -C git/ src
on executing:
N src/file.txt
N src/file1.txt
N src/file2.txt
No conflicts created by this import
cvs checkout: Updating src
U src/file.txt
U src/file1.txt
U src/file2.txt
cvs_direct initialized to CVSROOT /home/raj/cvsroot
cvs rlog: Logging src
Fetching file.txt v 1.1
New file.txt: 9 bytes
Fetching file1.txt v 1.1
New file1.txt: 9 bytes
Fetching file2.txt v 1.1
New file2.txt: 9 bytes
Tree ID b75643d0deaa77018b4dbaa2ff81756c4c1bebc1
Committed patch 1 (origin 2006-03-04 07:37:59)
Committing initial tree b75643d0deaa77018b4dbaa2ff81756c4c1bebc1
Commit ID e800fd633e319b9a0b4c351f2964a03abf96b6e2
Fetching file.txt v 1.1.1.1
Update file.txt: 9 bytes
Fetching file1.txt v 1.1.1.1
Update file1.txt: 9 bytes
Fetching file2.txt v 1.1.1.1
Update file2.txt: 9 bytes
Tree ID b75643d0deaa77018b4dbaa2ff81756c4c1bebc1
Parent ID e800fd633e319b9a0b4c351f2964a03abf96b6e2
Committed patch 2 (start 2006-03-04 07:37:59)
Commit ID 21bd067b19310d11790e99ad421de6611b942fbd
Created tag 'realstart' on 'start'
DONE; creating master branch
Now edit two files, commit cvs and cvsupdate again.
raj@beastie:~$ cat git_test.sh
export CVSROOT=/home/raj/cvsroot
cd src/
echo "Line two" >> file.txt
echo "Line two" >> file1.txt
cvs commit -m "v2.0"
cd ..
git cvsimport -v -d /home/raj/cvsroot -C git/ src
cd git
git status
cd ..
echo cat git/file.txt
cat git/file.txt
echo cat src/file.txt
cat src/file.txt
on executing:
cvs commit: Examining .
Checking in file.txt;
/home/raj/cvsroot/src/file.txt,v <-- file.txt
new revision: 1.2; previous revision: 1.1
done
Checking in file1.txt;
/home/raj/cvsroot/src/file1.txt,v <-- file1.txt
new revision: 1.2; previous revision: 1.1
done
cvs_direct initialized to CVSROOT /home/raj/cvsroot
cvs rlog: Logging src
skip patchset 1: 1141457879 before 1141457879
skip patchset 2: 1141457879 before 1141457879
Switching from master to origin
Fetching file.txt v 1.2
Update file.txt: 18 bytes
Fetching file1.txt v 1.2
Update file1.txt: 18 bytes
Tree ID 18d855d5b825ef1c0ecb9d26591e654cbe5c21df
Parent ID e800fd633e319b9a0b4c351f2964a03abf96b6e2
Committed patch 3 (origin 2006-03-04 07:39:35)
Commit ID 6e7129d186834d5b2941e78c1c67c5255f868e12
DONE
#
# Updated but not checked in:
# (will commit)
#
# modified: file.txt
# modified: file1.txt
#
cat git/file.txt
Line one
cat src/file.txt
Line one
Line two
As you can see the git/file.txt and src/file.txt are different. I have tried my best to
read all documentation and follow them faithfully and I hope I am not making any obviously
stupid mistake.
raj
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: cvsimport woes
2006-03-04 7:47 cvsimport woes Rajkumar S
@ 2006-03-06 9:24 ` Martin Langhoff
2006-03-06 9:37 ` Martin Langhoff
0 siblings, 1 reply; 8+ messages in thread
From: Martin Langhoff @ 2006-03-06 9:24 UTC (permalink / raw)
To: Rajkumar S; +Cc: git
Hi Raj,
you don't seem to be making any silly mistake. Make sure you are using
a recent git, and a recent cvsps. Actually you want the _latest_ cvsps
(2.1 I think).
A good thing to check is what cvsps is telling cvsimport.
Now, here you are not showing us your cvsimport commandline:
> cvs_direct initialized to CVSROOT /home/raj/cvsroot
> cvs rlog: Logging src
> skip patchset 1: 1141457879 before 1141457879
> skip patchset 2: 1141457879 before 1141457879
Ahhh... ok, you are doing it all very fast. Is this a script you are
running? add sleep 1 before you call cvsimport.
cheers,
martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: cvsimport woes
2006-03-06 9:24 ` Martin Langhoff
@ 2006-03-06 9:37 ` Martin Langhoff
2006-03-06 16:52 ` Rajkumar S
0 siblings, 1 reply; 8+ messages in thread
From: Martin Langhoff @ 2006-03-06 9:37 UTC (permalink / raw)
To: Rajkumar S; +Cc: git
On 3/6/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> you don't seem to be making any silly mistake. Make sure you are using
> a recent git, and a recent cvsps. Actually you want the _latest_ cvsps
> (2.1 I think).
Scratch this bit, naturally. I wasn't 100% paying attention. Still,
the rest of the answer should kinda/sorta make sense.
sorry!
martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: cvsimport woes
2006-03-06 9:37 ` Martin Langhoff
@ 2006-03-06 16:52 ` Rajkumar S
2006-03-07 3:06 ` Martin Langhoff
2006-03-07 5:34 ` Junio C Hamano
0 siblings, 2 replies; 8+ messages in thread
From: Rajkumar S @ 2006-03-06 16:52 UTC (permalink / raw)
To: git
Martin Langhoff wrote:
> On 3/6/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
>> you don't seem to be making any silly mistake. Make sure you are using
>> a recent git, and a recent cvsps. Actually you want the _latest_ cvsps
>> (2.1 I think).
>
> Scratch this bit, naturally. I wasn't 100% paying attention. Still,
> the rest of the answer should kinda/sorta make sense.
Thanks for your kind replies.
I was also talking to Matthias Urlichs (the author of cvsimport) What he
says is that the first version is still checked out because
the import does not do the fast-forward/merge by itself.
I am wondering how can I do the fast-forward. I had a long chat in irc
but did not find any solution to this particular issue. I tried git
merge, but that does not work as the command needs more arguments. (I am
a git newbie and git concepts are still bit fuzzy for me)
I would appreciate a lot if some one can point me in the right direction.
If you are not following this thread, the problem I am talking about is
that when I do a cvsimport for a second time (ie do a git cvsimport;
update the cvs; do a cvsimport again) the second updates are not visible
in the current directory, though they are present in the git database.
You can use this script to reproduce this problem.
export CVSROOT=/home/raj/cvsroot
rm -rf cvsroot/ git/ src/ /home/raj/.cvsps
mkdir cvsroot git src
cvs init
cd src/
echo "Line one" > file.txt
echo "Line one" > file1.txt
echo "Line one" > file2.txt
cvs import -m "Imported sources" src start realstart
cd ..
rm -rf src/
cvs co src
git cvsimport -v -k -u -m -d $CVSROOT -C git/ src
cd git
git status
cd ..
cd src/
echo "Line two" >> file.txt
echo "Line two" >> file1.txt
cvs commit -m "v2.0"
cd ..
git cvsimport -v -k -u -m -d $CVSROOT -C git/ src
cd git
git status
cd ..
Now the cvs version of file.txt and git version are different.
Thanks and regards,
raj
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: cvsimport woes
2006-03-06 16:52 ` Rajkumar S
@ 2006-03-07 3:06 ` Martin Langhoff
2006-03-07 5:34 ` Junio C Hamano
1 sibling, 0 replies; 8+ messages in thread
From: Martin Langhoff @ 2006-03-07 3:06 UTC (permalink / raw)
To: Rajkumar S; +Cc: git
On 3/7/06, Rajkumar S <rajkumars@asianetindia.com> wrote:
> You can use this script to reproduce this problem.
Rajkumar, does it work better if you add "sleep 10" before each
invocation of git-cvsimport?
cheers,
martin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: cvsimport woes
2006-03-06 16:52 ` Rajkumar S
2006-03-07 3:06 ` Martin Langhoff
@ 2006-03-07 5:34 ` Junio C Hamano
2006-03-07 9:08 ` [PATCH] cvsimport: Remove master-updating code smurf
1 sibling, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-03-07 5:34 UTC (permalink / raw)
To: Rajkumar S; +Cc: git, Matthias Urlichs
I've run your reproduction recipe and also looked at #git log
from yesterday.
Here is what I see immediately after the initial cvs import:
$ git show-branch
* [master] Initial revision
! [origin] Initial revision
! [start] Imported sources
---
+ [start] Imported sources
*++ [master] Initial revision
And here is what I get immediately after the second one:
$ git show-branch
* [master] v2.0
! [origin] v2.0
! [start] Imported sources
---
*+ [master] v2.0
+ [start] Imported sources
*++ [master^] Initial revision
$ git diff --cached --abbrev -r
:100644 100644 b8b933b... e251870... M file.txt
:100644 100644 b8b933b... e251870... M file1.txt
I think what is happening is that cvsimport updates origin and
master branch HEAD without updating the working tree. I am not
sure what the cvsimport command line you used is intended to do:
git cvsimport -v -k -u -m -d $CVSROOT -C git/ src
Specifically, what branch, if any, is used as the "tracking
branch" (i.e. stores the unmodified copy from CVS)? I presume
it is "origin", in which case, I would have expected to see
something like this instead.
$ git show-branch
* [master] Initial revision
! [origin] v2.0
! [start] Imported sources
---
+ [origin] v2.0
+ [start] Imported sources
*++ [master^] Initial revision
$ git diff --cached --abbrev -r
(empty)
Then I would understand what cvsimport author means by "it does
not do fast forward, you have to do it yourself". What it means
is that the import only updates the tracking branch but does not
update your working tree; merging the updates to the tracking
branch made from the foreign SCM into your working branch is
left for you to perform whenever it is convenient for you to do
(meaning, you may have some intermediate change in your master
branch in which case you would first commit them first and then
merge from CVS). And if that is they way cvsimport is intended
to be used, then you would at this point do:
$ git pull . origin
to do the fast forward.
I do not understand what cvsimport is trying to do here; I
_suspect_ the part that updates the "master" branch head might
be a bug.
Smurf, mind clarifying what is happening here for me please?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] cvsimport: Remove master-updating code
2006-03-07 5:34 ` Junio C Hamano
@ 2006-03-07 9:08 ` smurf
2006-03-07 13:42 ` Rajkumar S
0 siblings, 1 reply; 8+ messages in thread
From: smurf @ 2006-03-07 9:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Rajkumar S, git
[-- Attachment #1: Type: text/plain, Size: 3454 bytes --]
The code which tried to update the master branch was somewhat broken.
=> People should do that manually, with "git merge".
Signed-off-by: Matthias Urlichs <smurf@smurf.noris.de>
---
Junio C Hamano:
> I do not understand what cvsimport is trying to do here; I
> _suspect_ the part that updates the "master" branch head might
> be a bug.
>
This should fix it.
---
Documentation/git-cvsimport.txt | 6 ++++++
git-cvsimport.perl | 27 ++-------------------------
2 files changed, 8 insertions(+), 25 deletions(-)
4c28ef8000d68a0736084022a047019dca96c823
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index dfe86ce..57027b4 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -22,6 +22,12 @@ repository, or incrementally import into
Splitting the CVS log into patch sets is done by 'cvsps'.
At least version 2.1 is required.
+You should *never* do any work of your own on the branches that are
+created by git-cvsimport. The initial import will create and populate a
+"master" branch from the CVS repository's main branch which you're free
+to work with; after that, you need to 'git merge' incremental imports, or
+any CVS branches, yourself.
+
OPTIONS
-------
-d <CVSROOT>::
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index b46469a..02d1928 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -452,7 +452,6 @@ chdir($git_tree);
my $last_branch = "";
my $orig_branch = "";
-my $forward_master = 0;
my %branch_date;
my $git_dir = $ENV{"GIT_DIR"} || ".git";
@@ -488,21 +487,6 @@ unless(-d $git_dir) {
$last_branch = "master";
}
$orig_branch = $last_branch;
- if (-f "$git_dir/CVS2GIT_HEAD") {
- die <<EOM;
-CVS2GIT_HEAD exists.
-Make sure your working directory corresponds to HEAD and remove CVS2GIT_HEAD.
-You may need to run
-
- git read-tree -m -u CVS2GIT_HEAD HEAD
-EOM
- }
- system('cp', "$git_dir/HEAD", "$git_dir/CVS2GIT_HEAD");
-
- $forward_master =
- $opt_o ne 'master' && -f "$git_dir/refs/heads/master" &&
- system('cmp', '-s', "$git_dir/refs/heads/master",
- "$git_dir/refs/heads/$opt_o") == 0;
# populate index
system('git-read-tree', $last_branch);
@@ -889,17 +873,11 @@ if (defined $orig_git_index) {
# Now switch back to the branch we were in before all of this happened
if($orig_branch) {
- print "DONE\n" if $opt_v;
- system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
- if $forward_master;
- unless ($opt_i) {
- system('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD');
- die "read-tree failed: $?\n" if $?;
- }
+ print "DONE; you may need to merge manually.\n" if $opt_v;
} else {
$orig_branch = "master";
print "DONE; creating $orig_branch branch\n" if $opt_v;
- system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
+ system("git-update-ref", "refs/heads/master", "refs/heads/$opt_o")
unless -f "$git_dir/refs/heads/master";
system('git-update-ref', 'HEAD', "$orig_branch");
unless ($opt_i) {
@@ -907,4 +885,3 @@ if($orig_branch) {
die "checkout failed: $?\n" if $?;
}
}
-unlink("$git_dir/CVS2GIT_HEAD");
--
1.2.GIT
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
You will be run over by a bus.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] cvsimport: Remove master-updating code
2006-03-07 9:08 ` [PATCH] cvsimport: Remove master-updating code smurf
@ 2006-03-07 13:42 ` Rajkumar S
0 siblings, 0 replies; 8+ messages in thread
From: Rajkumar S @ 2006-03-07 13:42 UTC (permalink / raw)
To: smurf; +Cc: Junio C Hamano, git
smurf@smurf.noris.de wrote:
> Junio C Hamano:
>
>>I do not understand what cvsimport is trying to do here; I
>>_suspect_ the part that updates the "master" branch head might
>>be a bug.
>>
>
> This should fix it.
It's working fine for me. Thanks!
raj
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-03-07 13:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-04 7:47 cvsimport woes Rajkumar S
2006-03-06 9:24 ` Martin Langhoff
2006-03-06 9:37 ` Martin Langhoff
2006-03-06 16:52 ` Rajkumar S
2006-03-07 3:06 ` Martin Langhoff
2006-03-07 5:34 ` Junio C Hamano
2006-03-07 9:08 ` [PATCH] cvsimport: Remove master-updating code smurf
2006-03-07 13:42 ` Rajkumar S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox