{"thread":{"id":"5684","subject":"[PATCH] Allow 'svn fetch' on '(no date)' revisions in Subversion.","startedAt":"2006-09-25T02:50:15Z","lastAt":"2006-09-25T02:50:15Z","messageCount":1,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27606","messageId":"20060925025015.GB15603@spearce.org","threadId":"5684","inReplyTo":null,"subject":"[PATCH] Allow 'svn fetch' on '(no date)' revisions in Subversion.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-09-25T02:50:15Z","receivedAt":"2006-09-25T02:50:15Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Added --ignore-nodate to allow 'git svn fetch' to import revisions\nfrom Subversion which have '(no date)' listed as the date of the\nrevision.  By default 'git svn fetch' will crash with an error\nwhen encountering such a revision.  The user may restart the fetch\noperation by adding --ignore-nodate if they want to continue tracking\nthat repository.\n\nI'm not entirely sure why a centralized version control system such\nas Subversion permits revisions to be created with absolutely no\ndate/time associated with it but it apparently is possible as one\nof the Subversion repositories that I'm tracking with 'git svn'\ncreated such a revision on '(no date)' and by '(no user)'.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n Uhhh.  Riiiiight.  Getting garbage from a version control system\n is always a good feature for it to have.  Especially a centralized\n one where nobody should be able to subvert the server's concept\n of what time it is.  *sigh*\n\n Documentation/git-svn.txt |   12 ++++++++++++\n git-svn.perl              |    5 ++++-\n 2 files changed, 16 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex b7b63f7..1cfa3e3 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -244,6 +244,18 @@ doing.\n \n repo-config key: svn.noignoreexternals\n \n+--ignore-nodate::\n+Only used with the 'fetch' command.\n+\n+By default git-svn will crash if it tries to import a revision\n+from SVN which has '(no date)' listed as the date of the revision.\n+This is repository corruption on SVN's part, plain and simple.\n+But sometimes you really need those revisions anyway.\n+\n+If supplied git-svn will convert '(no date)' entries to the UNIX\n+epoch (midnight on Jan. 1, 1970).  Yes, that's probably very wrong.\n+SVN was very wrong.\n+\n --\n \n Basic Examples\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 0290850..8a2ef99 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -52,7 +52,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$\n \t$_template, $_shared, $_no_default_regex, $_no_graft_copy,\n \t$_limit, $_verbose, $_incremental, $_oneline, $_l_fmt, $_show_commit,\n \t$_version, $_upgrade, $_authors, $_branch_all_refs, @_opt_m,\n-\t$_merge, $_strategy, $_dry_run);\n+\t$_merge, $_strategy, $_dry_run, $_ignore_nodate);\n my (@_branch_from, %tree_map, %users, %rusers, %equiv);\n my ($_svn_co_url_revs, $_svn_pg_peg_revs);\n my @repo_path_split_cache;\n@@ -65,6 +65,7 @@ my %fc_opts = ( 'no-ignore-externals' =>\n \t\t'repack:i' => \\$_repack,\n \t\t'no-metadata' => \\$_no_metadata,\n \t\t'quiet|q' => \\$_q,\n+\t\t'ignore-nodate' => \\$_ignore_nodate,\n \t\t'repack-flags|repack-args|repack-opts=s' => \\$_repack_flags);\n \n my ($_trunk, $_tags, $_branches);\n@@ -1734,6 +1735,8 @@ sub next_log_entry {\n \t\t\tmy $rev = $1;\n \t\t\tmy ($author, $date, $lines) = split(/\\s*\\|\\s*/, $_, 3);\n \t\t\t($lines) = ($lines =~ /(\\d+)/);\n+\t\t\t$date = '1970-01-01 00:00:00 +0000'\n+\t\t\t\tif ($_ignore_nodate && $date eq '(no date)');\n \t\t\tmy ($Y,$m,$d,$H,$M,$S,$tz) = ($date =~\n \t\t\t\t\t/(\\d{4})\\-(\\d\\d)\\-(\\d\\d)\\s\n \t\t\t\t\t (\\d\\d)\\:(\\d\\d)\\:(\\d\\d)\\s([\\-\\+]\\d+)/x)\n-- \n1.4.2.1.ga6af-dirty\n"}]}