@matheusbsbs / matheus-bagliano / commits / f7bae37f9a
Fork 0

Allow 'svn fetch' on '(no date)' revisions in Subversion.

Added --ignore-nodate to allow 'git svn fetch' to import revisions from Subversion which have '(no date)' listed as the date of the revision. By default 'git svn fetch' will crash with an error when encountering such a revision. The user may restart the fetch operation by adding --ignore-nodate if they want to continue tracking that repository. I'm not entirely sure why a centralized version control system such as Subversion permits revisions to be created with absolutely no date/time associated with it but it apparently is possible as one of the Subversion repositories that I'm tracking with 'git svn' created such a revision on '(no date)' and by '(no user)'. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Shawn Pearce committed Sep 24, 2006 at 22:50 UTC f7bae37f9ab2fdc567780d23495733c9af526e02
2 files changed +16 -1
Documentation/git-svn.txt
+12
@@ -244,6 +244,18 @@ doing.
244
245 repo-config key: svn.noignoreexternals
246
247 +--ignore-nodate::
248 +Only used with the 'fetch' command.
249 +
250 +By default git-svn will crash if it tries to import a revision
251 +from SVN which has '(no date)' listed as the date of the revision.
252 +This is repository corruption on SVN's part, plain and simple.
253 +But sometimes you really need those revisions anyway.
254 +
255 +If supplied git-svn will convert '(no date)' entries to the UNIX
256 +epoch (midnight on Jan. 1, 1970). Yes, that's probably very wrong.
257 +SVN was very wrong.
258 +
259 --
260
261 Basic Examples
git-svn.perl
+4 -1
@@ -52,7 +52,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
52 $_template, $_shared, $_no_default_regex, $_no_graft_copy,
53 $_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,
54 $_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,
55 - $_merge, $_strategy, $_dry_run);
55 + $_merge, $_strategy, $_dry_run, $_ignore_nodate);
56 my (@_branch_from, %tree_map, %users, %rusers, %equiv);
57 my ($_svn_co_url_revs, $_svn_pg_peg_revs);
58 my @repo_path_split_cache;
@@ -65,6 +65,7 @@ my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
65 'repack:i' => \$_repack,
66 'no-metadata' => \$_no_metadata,
67 'quiet|q' => \$_q,
68 + 'ignore-nodate' => \$_ignore_nodate,
69 'repack-flags|repack-args|repack-opts=s' => \$_repack_flags);
70
71 my ($_trunk, $_tags, $_branches);
@@ -1734,6 +1735,8 @@ sub next_log_entry {
1735 my $rev = $1;
1736 my ($author, $date, $lines) = split(/\s*\|\s*/, $_, 3);
1737 ($lines) = ($lines =~ /(\d+)/);
1738 + $date = '1970-01-01 00:00:00 +0000'
1739 + if ($_ignore_nodate && $date eq '(no date)');
1740 my ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~
1741 /(\d{4})\-(\d\d)\-(\d\d)\s
1742 (\d\d)\:(\d\d)\:(\d\d)\s([\-\+]\d+)/x)