]> git.donarmstrong.com Git - bin.git/commitdiff
handle type 8 svn entries
authorDon Armstrong <don@donarmstrong.com>
Sat, 4 Nov 2006 09:45:56 +0000 (09:45 +0000)
committerDon Armstrong <don@donarmstrong.com>
Sat, 4 Nov 2006 09:45:56 +0000 (09:45 +0000)
stodo

diff --git a/stodo b/stodo
index 25824636f5908c0a4232ec0d8fe64cef28b952a6..7a3c87c7bbbb50e8facbaf621b849d87237dcd22 100755 (executable)
--- a/stodo
+++ b/stodo
@@ -118,13 +118,18 @@ if (not -e "$base_dir/.svn") {
      exit 0;
 }
 
+if (not -e "$base_dir/.svn/text-base/${tododb_name}.svn-base") {
+     print "$base_dir/.svn/text-base/${tododb_name}.svn-base doesn't exist, not committing\n" unless $options{quiet};
+     exit 0;
+}
+
 # Make sure that we can ping the subversion server
 my $svn_entries_fh = new IO::File "$base_dir/.svn/entries",'r'
      or die "unable to open $base_dir/.svn/entries: $!";
 my $url_type;
 my $svn_host;
 while (<$svn_entries_fh>) {
-     next unless m#^\s+url=\"(http|svn\+ssh|file):///?([^\/]+)#;
+     next unless m#^(?:\s+url=\")?(http|svn\+ssh|file):///?([^\/]+)#;
      $url_type = $1;
      last if $url_type eq 'file';
      $svn_host = $2;
@@ -134,7 +139,7 @@ if ($ENV{STODO_NO_COMMIT}) {
      print "Exiting because of STODO_NO_COMMIT env variable\n" unless $options{quiet};
      exit 0;
 }
-if (not defined $svn_host and $url_type ne 'file') {
+if (not defined $svn_host and (not defined $url_type or $url_type ne 'file')) {
      die "Was unable to find which host the svn repository is located on";
 }
 if ($url_type ne 'file') {
@@ -252,6 +257,9 @@ else {
 
 sub fix_content {
      my ($s) = @_;
+     if (not ref(${[values %{$s}]}[0]) eq 'HASH') {
+         $s = {$s->{time} => $s};
+     }
      foreach my $entry (values %{$s}) {
          if (exists $entry->{content}) {
               $entry->{content} =~ s/^\s*|\s*$//g;