[Users] Possible Patch for GetComponents
Eric Seidel
eric at eseidel.org
Fri Jun 18 15:51:21 CDT 2010
Hi all,
There was a small bug in GetComponents when the EinsteinToolkit was released yesterday, which I would like to address with a patch. The bug occurs when you try to update a git repository; after pulling the latest changes, GetComponents tries to do a "git checkout $branch" again which errors because the branch has already been created when the repo was cloned. Note that this is really just a cosmetic error; it doesn't break anything and the repo stays on the appropriate branch.
Let me know what you think,
Eric
Index: GetComponents
===================================================================
--- GetComponents (revision 653)
+++ GetComponents (working copy)
@@ -909,7 +909,7 @@
my $git_repo = $component{"GIT_REPO"};
my $cmd = '';
my $git_repos_dir = '';
- my $branch = defined($component{REPO_BRANCH}) ? $component{REPO_BRANCH} : 'master';
+ my $branch = defined($component{REPO_BRANCH}) ? $component{REPO_BRANCH} : undef;
# find a revision from $DATE
my $date = defined $DATE ? '$'."($git rev-list --max-count=1 --before=$DATE $branch)" : $branch;
@@ -921,10 +921,12 @@
$cmd = "$git clone$shallow $url $ROOT/repos/$git_repo";
print_checkout_info($checkout, $url, $target, $name);
run_command($cmd) == 0 or push (@components_error, $checkout);
- chdir("$orig_dir/$ROOT/repos/$git_repo");
- run_command("git checkout $branch") == 0 or push (@components_error, $checkout);
- run_command("git checkout $date") == 0 or push (@components_error, $checkout);
- chdir("$orig_dir");
+ if (defined $branch) {
+ chdir("$orig_dir/$ROOT/repos/$git_repo");
+ run_command("git checkout --track -b $branch origin/$branch") == 0 or push (@components_error, $checkout);
+ #run_command("git checkout $date") == 0 or push (@components_error, $checkout);
+ chdir("$orig_dir");
+ }
$updated_git_repos{$git_repo} = 1;
}
# if git repo has already been cloned, we will pull the latest version
@@ -932,8 +934,7 @@
chdir("$orig_dir/$ROOT/repos/$git_repo");
print_checkout_info($checkout, $url, $target, $name);
run_command("$git pull -a") == 0 or push (@components_error, $checkout);
- run_command("git checkout $branch") == 0 or push (@components_error, $checkout);
- run_command("git checkout $date") == 0 or push (@components_error, $checkout);
+ #run_command("git checkout $date") == 0 or push (@components_error, $checkout);
$updated_git_repos{$git_repo} = 1;
chdir($orig_dir)
@@ -996,9 +997,6 @@
chdir("$orig_dir/$ROOT/repos/$git_repo");
print_update_info($checkout, $url, $target, $name);
run_command("$git pull -a") == 0 or push (@components_error, $checkout);
- if (defined($branch)) {
- run_command("git checkout $branch") == 0 or push (@components_error, $checkout);
- }
$updated_git_repos{$git_repo} = 1;
chdir($orig_dir)
}
@@ -1706,6 +1704,7 @@
--status run status commands for each component
--diff run diff commands for each component
--root override root directory
+ --date checkout from a specific date
--reset-
authentication delete authentication files
@@ -1750,6 +1749,11 @@
Override the root directory in the component list.
This allows checking out into an arbitrary directory.
+=item B<--date>
+
+Checkout components from a specific date. Currently only supported for cvs, svn, and mercurial.
+
+
=item B<--reset-authentication>
Delete any CRL authentication files before processing the component list.
More information about the Users
mailing list