1 |
#!/usr/bin/perl |
2 |
|
3 |
use warnings; |
4 |
use strict; |
5 |
|
6 |
# svn2git.pl |
7 |
# |
8 |
# 09/12/2009 09:27:10 PM CEST Dobrica Pavlinusic <dpavlin@rot13.org> |
9 |
|
10 |
use File::Slurp; |
11 |
|
12 |
my ( $repo, $rev ) = split(/\s+/, read_file '.svn2git' ); |
13 |
|
14 |
warn "# $repo $rev\n"; |
15 |
|
16 |
system("svn export -r $rev --force $repo .") == 0 |
17 |
or die "can't checkout revision $rev: $?"; |
18 |
|
19 |
my $log = `svn log $repo -r $rev`; |
20 |
$log =~ s/^-{72}$//gm; |
21 |
|
22 |
write_file '/tmp/log', $log; |
23 |
|
24 |
system "git diff > /tmp/$rev.diff"; |
25 |
|
26 |
die "no changes in revision $rev" if -z "/tmp/$rev.diff"; |
27 |
|
28 |
system "vi -R -o /tmp/log /tmp/$rev.diff"; |
29 |
|
30 |
print "\nenter to commit changes or CTRL+C to abort\n"; |
31 |
<STDIN>; |
32 |
|
33 |
$rev++; |
34 |
write_file '/tmp/.svn2git', "$repo $rev"; |
35 |
system "git commit -F /tmp/log -a && mv /tmp/.svn2git .svn2git"; |
36 |
|