From: Antony Stubbs <antony.stubbs@gmail.com>
To: gitster@pobox.com
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH] cvs import and internal plumbing commands
Date: Mon, 20 Jul 2009 11:57:23 +1200 [thread overview]
Message-ID: <DFEDA2D4-4D22-4CC7-A149-595CAADD4F37@gmail.com> (raw)
In-Reply-To: <FA5A96AF-5EC1-47B0-AF53-7163C804AE3D@gmail.com>
Signed-off patch, post discussion with Jeff King.
From: Antony Stubbs <antony.stubbs@gmail.com>
Date: Sun, 5 Jul 2009 18:09:32 +1200
migrate cvs-import to internal git * commands
Signed-off-by: Antony Stubbs <antony.stubbs@gmail.com>
---
git-cvsimport.perl | 64 +++++++++++++++++++++++++
+--------------------------
1 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index e439202..80c9710 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -560,16 +560,16 @@ $orig_git_index = $ENV{GIT_INDEX_FILE} if exists
$ENV{GIT_INDEX_FILE};
my %index; # holds filenames of one index per branch
unless (-d $git_dir) {
- system("git-init");
+ system("git", "init");
die "Cannot init the GIT db at $git_tree: $?\n" if $?;
- system("git-read-tree");
+ system("git", "read-tree");
die "Cannot init an empty tree: $?\n" if $?;
$last_branch = $opt_o;
$orig_branch = "";
} else {
- open(F, "git-symbolic-ref HEAD |") or
- die "Cannot run git-symbolic-ref: $!\n";
+ open(F, "git symbolic-ref HEAD |") or
+ die "Cannot run git symbolic-ref: $!\n";
chomp ($last_branch = <F>);
$last_branch = basename($last_branch);
close(F);
@@ -578,12 +578,12 @@ unless (-d $git_dir) {
$last_branch = "master";
}
$orig_branch = $last_branch;
- $tip_at_start = `git-rev-parse --verify HEAD`;
+ $tip_at_start = `git rev-parse --verify HEAD`;
# Get the last import timestamps
my $fmt = '($ref, $author) = (%(refname), %(author));';
- open(H, "git-for-each-ref --perl --format='$fmt' $remote |") or
- die "Cannot run git-for-each-ref: $!\n";
+ open(H, "git for-each-ref --perl --format='$fmt' $remote |") or
+ die "Cannot run git for-each-ref: $!\n";
while (defined(my $entry = <H>)) {
my ($ref, $author);
eval($entry) || die "cannot eval refs list: $@";
@@ -638,7 +638,7 @@ unless ($opt_P) {
print $cvspsfh $_;
}
close CVSPS;
- $? == 0 or die "git-cvsimport: fatal: cvsps reported error\n";
+ $? == 0 or die "git cvsimport: fatal: cvsps reported error\n";
close $cvspsfh;
} else {
$cvspsfile = $opt_P;
@@ -667,27 +667,27 @@ my $state = 0;
sub update_index (\@\@) {
my $old = shift;
my $new = shift;
- open(my $fh, '|-', qw(git-update-index -z --index-info))
- or die "unable to open git-update-index: $!";
+ open(my $fh, '|-', qw(git update-index -z --index-info))
+ or die "unable to open git update-index: $!";
print $fh
(map { "0 0000000000000000000000000000000000000000\t$_\0" }
@$old),
(map { '100' . sprintf('%o', $_->[0]) . " $_->[1]\t$_->[2]\0" }
@$new)
- or die "unable to write to git-update-index: $!";
+ or die "unable to write to git update-index: $!";
close $fh
- or die "unable to write to git-update-index: $!";
- $? and die "git-update-index reported error: $?";
+ or die "unable to write to git update-index: $!";
+ $? and die "git update-index reported error: $?";
}
sub write_tree () {
- open(my $fh, '-|', qw(git-write-tree))
- or die "unable to open git-write-tree: $!";
+ open(my $fh, '-|', qw(git write-tree))
+ or die "unable to open git write-tree: $!";
chomp(my $tree = <$fh>);
is_sha1($tree)
or die "Cannot get tree id ($tree): $!";
close($fh)
- or die "Error running git-write-tree: $?\n";
+ or die "Error running git write-tree: $?\n";
print "Tree ID $tree\n" if $opt_v;
return $tree;
}
@@ -702,7 +702,7 @@ sub commit {
if ($branch eq $opt_o && !$index{branch} &&
!get_headref("$remote/$branch")) {
# looks like an initial commit
- # use the index primed by git-init
+ # use the index primed by git init
$ENV{GIT_INDEX_FILE} = "$git_dir/index";
$index{$branch} = "$git_dir/index";
} else {
@@ -712,9 +712,9 @@ sub commit {
$index{$branch} = tmpnam();
$ENV{GIT_INDEX_FILE} = $index{$branch};
if ($ancestor) {
- system("git-read-tree", "$remote/$ancestor");
+ system("git", "read-tree", "$remote/$ancestor");
} else {
- system("git-read-tree", "$remote/$branch");
+ system("git", "read-tree", "$remote/$branch");
}
die "read-tree failed: $?\n" if $?;
}
@@ -749,7 +749,7 @@ sub commit {
$ENV{GIT_COMMITTER_EMAIL} = $author_email;
$ENV{GIT_COMMITTER_DATE} = $commit_date;
my $pid = open2(my $commit_read, my $commit_write,
- 'git-commit-tree', $tree, @commit_args);
+ 'git', 'commit-tree', $tree, @commit_args);
# compatibility with git2cvs
substr($logmsg,32767) = "" if length($logmsg) > 32767;
@@ -762,7 +762,7 @@ sub commit {
}
print($commit_write "$logmsg\n") && close($commit_write)
- or die "Error writing to git-commit-tree: $!\n";
+ or die "Error writing to git commit-tree: $!\n";
print "Committed patch $patchset ($branch $commit_date)\n" if $opt_v;
chomp(my $cid = <$commit_read>);
@@ -771,9 +771,9 @@ sub commit {
close($commit_read);
waitpid($pid,0);
- die "Error running git-commit-tree: $?\n" if $?;
+ die "Error running git commit-tree: $?\n" if $?;
- system('git-update-ref', "$remote/$branch", $cid) == 0
+ system('git', 'update-ref', "$remote/$branch", $cid) == 0
or die "Cannot write branch $branch for update: $!\n";
if ($tag) {
@@ -783,7 +783,7 @@ sub commit {
$xtag =~ s/[\/]/$opt_s/g;
$xtag =~ s/\[//g;
- system('git-tag', '-f', $xtag, $cid) == 0
+ system('git', 'tag', '-f', $xtag, $cid) == 0
or die "Cannot create tag $xtag: $!\n";
print "Created tag '$xtag' on '$branch'\n" if $opt_v;
@@ -920,7 +920,7 @@ while (<CVS>) {
my $pid = open(my $F, '-|');
die $! unless defined $pid;
if (!$pid) {
- exec("git-hash-object", "-w", $tmpname)
+ exec("git", "hash-object", "-w", $tmpname)
or die "Cannot create object: $!\n";
}
my $sha = <$F>;
@@ -964,7 +964,7 @@ unless ($opt_P) {
# The heuristic of repacking every 1024 commits can leave a
# lot of unpacked data. If there is more than 1MB worth of
# not-packed objects, repack once more.
-my $line = `git-count-objects`;
+my $line = `git count-objects`;
if ($line =~ /^(\d+) objects, (\d+) kilobytes$/) {
my ($n_objects, $kb) = ($1, $2);
1024 < $kb
@@ -989,26 +989,26 @@ if ($orig_branch) {
if ($opt_i) {
exit 0;
}
- my $tip_at_end = `git-rev-parse --verify HEAD`;
+ my $tip_at_end = `git rev-parse --verify HEAD`;
if ($tip_at_start ne $tip_at_end) {
for ($tip_at_start, $tip_at_end) { chomp; }
print "Fetched into the current branch.\n" if $opt_v;
- system(qw(git-read-tree -u -m),
+ system(qw(git read-tree -u -m),
$tip_at_start, $tip_at_end);
die "Fast-forward update failed: $?\n" if $?;
}
else {
- system(qw(git-merge cvsimport HEAD), "$remote/$opt_o");
+ system(qw(git merge cvsimport HEAD), "$remote/$opt_o");
die "Could not merge $opt_o into the current branch.\n" if $?;
}
} else {
$orig_branch = "master";
print "DONE; creating $orig_branch branch\n" if $opt_v;
- system("git-update-ref", "refs/heads/master", "$remote/$opt_o")
+ system("git", "update-ref", "refs/heads/master", "$remote/$opt_o")
unless defined get_headref('refs/heads/master');
- system("git-symbolic-ref", "$remote/HEAD", "$remote/$opt_o")
+ system("git", "symbolic-ref", "$remote/HEAD", "$remote/$opt_o")
if ($opt_r && $opt_o ne 'HEAD');
- system('git-update-ref', 'HEAD', "$orig_branch");
+ system('git', 'update-ref', 'HEAD', "$orig_branch");
unless ($opt_i) {
system('git checkout -f');
die "checkout failed: $?\n" if $?;
--
1.6.3.3
On 18/07/2009, at 9:59 AM, Antony Stubbs wrote:
> On 18/07/2009, at 9:45 AM, Jeff King <peff@peff.net> wrote:
>
>> On Sat, Jul 18, 2009 at 09:44:08AM +1200, Antony Stubbs wrote:
>>
>>>> The old style commands should be in the execdir (e.g.,
>>>> /usr/local/libexec/git-core). That directory should be placed at
>>>> the
>>>> beginning of the PATH when you run "git cvsimport".
>>>
>>> Ok cool, I'll have a look when I get home.
>>>
>>> But should we not migrate it for the future anyway? An at least that
>>> way it would work by default, in this environment?
>>
>> Yes, I think it is reasonable to migrate it in any case, if only
>> because
>> it serves as an example when people read it, and we are trying to
>> encourage the dashless form.
>
> Great - ok, is there anything else I need to do re the patch I
> wrote, in your opinion?
>
> --Antony
next prev parent reply other threads:[~2009-07-19 23:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-05 2:43 cvs import and internal plumbing commands Antony Stubbs
2009-07-05 6:28 ` Antony Stubbs
2009-07-06 12:15 ` [PATCH 1/1] " astubbs
2009-07-16 10:01 ` Jeff King
2009-07-17 21:44 ` Antony Stubbs
2009-07-17 21:45 ` Jeff King
2009-07-17 21:59 ` Antony Stubbs
2009-07-19 23:57 ` Antony Stubbs [this message]
2009-07-20 2:43 ` Junio C Hamano
2009-07-20 15:34 ` Jeff King
2009-07-21 23:24 ` Antony Stubbs
2009-07-22 0:43 ` Junio C Hamano
2009-07-22 2:59 ` Jeff King
2009-07-22 3:06 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DFEDA2D4-4D22-4CC7-A149-595CAADD4F37@gmail.com \
--to=antony.stubbs@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).