]> sipb.mit.edu Git - ikiwiki.git/commitdiff
--gettime revamp
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 16 Apr 2010 21:02:29 +0000 (17:02 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 16 Apr 2010 21:02:29 +0000 (17:02 -0400)
* Rename --getctime to --gettime. (The old name still works for
  backwards compatability.)
* --gettime now also looks up last modification time.
* Add rcs_getmtime to plugin API; currently only implemented
  for git.

22 files changed:
IkiWiki.pm
IkiWiki/Plugin/bzr.pm
IkiWiki/Plugin/cvs.pm
IkiWiki/Plugin/darcs.pm
IkiWiki/Plugin/git.pm
IkiWiki/Plugin/mercurial.pm
IkiWiki/Plugin/monotone.pm
IkiWiki/Plugin/norcs.pm
IkiWiki/Plugin/svn.pm
IkiWiki/Plugin/tla.pm
IkiWiki/Render.pm
debian/changelog
doc/forum/How_does_ikiwiki_remember_times__63__.mdwn
doc/forum/Migrating_old_repository_to_new_ikiwiki_system__63__.mdwn
doc/plugins/write.mdwn
doc/rcs.mdwn
doc/tips/Importing_posts_from_Wordpress.mdwn
doc/tips/inside_dot_ikiwiki/discussion.mdwn
doc/todo/auto_getctime_on_fresh_build.mdwn
doc/usage.mdwn
ikiwiki.in
mtime-to-git [deleted file]

index 1730e476ae039ee2ff26241b810393184d648654..7655dada5705b16583fe1412eabfd5e2a5413e05 100644 (file)
@@ -440,10 +440,10 @@ sub getsetup () {
                safe => 0,
                rebuild => 0,
        },
                safe => 0,
                rebuild => 0,
        },
-       getctime => {
+       gettime => {
                type => "internal",
                default => 0,
                type => "internal",
                default => 0,
-               description => "running in getctime mode",
+               description => "running in gettime mode",
                safe => 0,
                rebuild => 0,
        },
                safe => 0,
                rebuild => 0,
        },
@@ -1790,6 +1790,10 @@ sub rcs_getctime ($) {
        $hooks{rcs}{rcs_getctime}{call}->(@_);
 }
 
        $hooks{rcs}{rcs_getctime}{call}->(@_);
 }
 
+sub rcs_getmtime ($) {
+       $hooks{rcs}{rcs_getmtime}{call}->(@_);
+}
+
 sub rcs_receive () {
        $hooks{rcs}{rcs_receive}{call}->();
 }
 sub rcs_receive () {
        $hooks{rcs}{rcs_receive}{call}->();
 }
index 0efc26b4990ee1d2c7f83912c41bc23bdd085677..f79ca7c8f52e53831414d7f327d44664a4bf67b2 100644 (file)
@@ -20,6 +20,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub checkconfig () {
 }
 
 sub checkconfig () {
@@ -306,4 +307,8 @@ sub rcs_getctime ($) {
        return $ctime;
 }
 
        return $ctime;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for bzr\n"; # TODO
+}
+
 1
 1
index 26a3e9dd291edf8e74c1aa6fdfbb91617f4bfd2d..360d9724950c866c7cd4e5e6ca99053124d45b99 100644 (file)
@@ -49,6 +49,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub genwrapper () {
 }
 
 sub genwrapper () {
@@ -485,4 +486,8 @@ sub rcs_getctime ($) {
        return $date;
 }
 
        return $date;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for cvs\n"; # TODO
+}
+
 1
 1
index bc8394b904c3e774773b3eb6b0ce2883ffdc886d..c1d6661d3a503840c419be55dadff6d16fdf6d03 100644 (file)
@@ -18,6 +18,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub silentsystem (@) {
 }
 
 sub silentsystem (@) {
@@ -427,4 +428,8 @@ sub rcs_getctime ($) {
        return $date;
 }
 
        return $date;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for darcs\n"; # TODO
+}
+
 1
 1
index b02f4a5ed5750145fe711095c3f7afa085c38732..86d80186f3f8671140dc01a00706e2d265545779 100644 (file)
@@ -25,6 +25,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
        hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive);
 }
 
        hook(type => "rcs", id => "rcs_receive", call => \&rcs_receive);
 }
 
@@ -634,6 +635,10 @@ sub rcs_getctime ($) {
        return $ctime;
 }
 
        return $ctime;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for git\n"; # TODO
+}
+
 sub rcs_receive () {
        # The wiki may not be the only thing in the git repo.
        # Determine if it is in a subdirectory by examining the srcdir,
 sub rcs_receive () {
        # The wiki may not be the only thing in the git repo.
        # Determine if it is in a subdirectory by examining the srcdir,
index ea00a33648431daadb94efa398e47c3c224a6f89..34e009c7a659a343f409adf4a1da1f379e469be6 100644 (file)
@@ -20,6 +20,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub checkconfig () {
 }
 
 sub checkconfig () {
@@ -254,4 +255,8 @@ sub rcs_getctime ($) {
        return $ctime;
 }
 
        return $ctime;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for mercurial\n"; # TODO
+}
+
 1
 1
index c33cf7e3a0dad0c0f052400c00da2b928f8fd289..67d4abbaaed4792a35fc405eee55506a669a4018 100644 (file)
@@ -23,6 +23,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub checkconfig () {
 }
 
 sub checkconfig () {
@@ -693,4 +694,8 @@ sub rcs_getctime ($) {
        return $date;
 }
 
        return $date;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for monotone\n"; # TODO
+}
+
 1
 1
index e6a05a3c5d855d89691414001996070c5f8f9c2c..053652a5f8f86db533f45db98c315ec8527ebe8a 100644 (file)
@@ -18,6 +18,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub getsetup () {
 }
 
 sub getsetup () {
@@ -63,7 +64,11 @@ sub rcs_diff ($) {
 }
 
 sub rcs_getctime ($) {
 }
 
 sub rcs_getctime ($) {
-       error gettext("getctime not implemented");
+       return 0;
+}
+
+sub rcs_getmtime ($) {
+       return 0;
 }
 
 1
 }
 
 1
index 7d27ec8427b1b341c1dc7e9d3d3b92f2a4e838a1..85c205f0939bd81d5f22bc7a0a19486dc4404c02 100644 (file)
@@ -19,6 +19,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub checkconfig () {
 }
 
 sub checkconfig () {
@@ -379,4 +380,8 @@ sub rcs_getctime ($) {
        return $date;
 }
 
        return $date;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for svn\n"; # TODO
+}
+
 1
 1
index 764da9b98151d1321a507c0f8a62b1eeabe495a2..f5ad0cc96bd658810492880f9c91bf87c60bdc92 100644 (file)
@@ -18,6 +18,7 @@ sub import {
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
        hook(type => "rcs", id => "rcs_recentchanges", call => \&rcs_recentchanges);
        hook(type => "rcs", id => "rcs_diff", call => \&rcs_diff);
        hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
+       hook(type => "rcs", id => "rcs_getmtime", call => \&rcs_getmtime);
 }
 
 sub checkconfig () {
 }
 
 sub checkconfig () {
@@ -284,4 +285,8 @@ sub rcs_getctime ($) {
        return $date;
 }
 
        return $date;
 }
 
+sub rcs_getmtime ($) {
+       error "rcs_getmtime is not implemented for tla\n"; # TODO
+}
+
 1
 1
index e98888d76ecd17709e054b3a7068e0c439341a8a..e1cb68462611c1107a78c4bf84ed0cb8aab33986 100644 (file)
@@ -365,14 +365,26 @@ sub find_new_files ($) {
                        }
                        else {
                                push @new, $file;
                        }
                        else {
                                push @new, $file;
-                               if ($config{getctime} && -e "$config{srcdir}/$file") {
+                               if ($config{gettime} && -e "$config{srcdir}/$file") {
                                        eval {
                                        eval {
-                                               my $time=rcs_getctime("$config{srcdir}/$file");
-                                               $pagectime{$page}=$time;
+                                               my $ctime=rcs_getctime("$config{srcdir}/$file");
+                                               if ($ctime > 0) {
+                                                       $pagectime{$page}=$ctime;
+                                               }
                                        };
                                        if ($@) {
                                                print STDERR $@;
                                        }
                                        };
                                        if ($@) {
                                                print STDERR $@;
                                        }
+                                       my $mtime;
+                                       eval {
+                                               my $mtime=rcs_getmtime("$config{srcdir}/$file");
+                                       };
+                                       if ($@) {
+                                               print STDERR $@;
+                                       }
+                                       elsif ($mtime > 0) {
+                                               utime($mtime, $mtime, "$config{srcdir}/$file");
+                                       }
                                }
                        }
                        $pagecase{lc $page}=$page;
                                }
                        }
                        $pagecase{lc $page}=$page;
index 737d736556fe718cfb41f8e2182fb9b8757b3b4b..615d5916fec4d2b0c47688f78244efcb95a61af9 100644 (file)
@@ -44,6 +44,11 @@ ikiwiki (3.20100415) UNRELEASED; urgency=low
   * conditional: Fix bug that forced "all" mode off by default.
   * calendarmonth.tmpl: The month calendar is now put in a sidebar.
   * calendar: Improved display of arrows.
   * conditional: Fix bug that forced "all" mode off by default.
   * calendarmonth.tmpl: The month calendar is now put in a sidebar.
   * calendar: Improved display of arrows.
+  * Rename --getctime to --gettime. (The old name still works for
+    backwards compatability.)
+  * --gettime now also looks up last modification time.
+  * Add rcs_getmtime to plugin API; currently only implemented
+    for git.
 
  -- Joey Hess <joeyh@debian.org>  Sun, 04 Apr 2010 12:17:11 -0400
 
 
  -- Joey Hess <joeyh@debian.org>  Sun, 04 Apr 2010 12:17:11 -0400
 
index 6ce576db118cb1153c43cce898e3ec524aeb8b02..6b7739fd005abd7443264a86162d133667864d71 100644 (file)
@@ -20,15 +20,17 @@ Do I have it right?
 > Some VCS, like git, set the file mtimes to the current time
 > when making a new checkout, so they will be lost if you do that.
 > The creation times can be retrived using the `--getctime` option.
 > Some VCS, like git, set the file mtimes to the current time
 > when making a new checkout, so they will be lost if you do that.
 > The creation times can be retrived using the `--getctime` option.
-> I suppose it might be nice if there were a `--getmtime` that pulled
-> true modification times out of the VCS, but I haven't found it a big
-> deal in practice for the last modification times to be updated to the
-> current time when rebuilding a wiki like this. --[[Joey]] 
+> --[[Joey]] 
 >
 > > Thanks for the clarification. I ran some tests of my own to make sure I understand it right, and I'm satisfied
 > > that the order of posts in my blog can be retrieved from the VCS using the `--getctime` option, at least if I
 > > choose to order my posts by creation time rather than modification time. But I now know that I can't rely on
 > > page modification times in ikiwiki as these can be lost permanently.
 >
 > > Thanks for the clarification. I ran some tests of my own to make sure I understand it right, and I'm satisfied
 > > that the order of posts in my blog can be retrieved from the VCS using the `--getctime` option, at least if I
 > > choose to order my posts by creation time rather than modification time. But I now know that I can't rely on
 > > page modification times in ikiwiki as these can be lost permanently.
+> 
+> > > Update: It's now renamed to `--gettime`, and pulls both the creation
+> > > and modification times. Also, per [[todo/auto_getctime_on_fresh_build]],
+> > > this is now done automatically the first time ikiwiki builds a
+> > > srcdir. So, no need to worry about this any more! --[[Joey]] 
 > >
 > > I would suggest that there should at least be a `--getmtime` option like you describe, and perhaps that 
 > > `--getctime` and `--getmtime` be _on by default_. In my opinion the creation times and modification times of 
 > >
 > > I would suggest that there should at least be a `--getmtime` option like you describe, and perhaps that 
 > > `--getctime` and `--getmtime` be _on by default_. In my opinion the creation times and modification times of 
@@ -91,19 +93,6 @@ Do I have it right?
 > A quick workaround for me to get modification times right is the following
 > little zsh script, which unfortunately only works for git:
 
 > A quick workaround for me to get modification times right is the following
 > little zsh script, which unfortunately only works for git:
 
-    #!/usr/bin/env zsh
-    
-    set +x
-    
-    for FILE in **/*(.); do
-      TIMES="`git log --pretty=format:%ai $FILE`"
-      MTIME="`echo $TIMES | head -n1`"
-    
-      if [ ! -z $MTIME ]; then
-        echo  touch -m -d "$MTIME" $FILE
-        touch -m -d "$MTIME" $FILE
-      fi
-    
-    done
+>> Elided; no longer needed since --gettime does that, and much faster! --[[Joey]] 
 
 > --[[David_Riebenbauer]]
 
 > --[[David_Riebenbauer]]
index fe67e6abacead20d42b1876ea534fee24d25b3f3..d7a33b526a24f1afa13c8e563e362e782b69dfe1 100644 (file)
@@ -20,10 +20,6 @@ How do I set up an ikiwiki system using a pre-existing repository (instead of cr
 >    recreate the ikiwiki srcdir
 > 3. `git clone` from the bare git repository a second time,
 >    to create a checkout you can manually edit (optional)
 >    recreate the ikiwiki srcdir
 > 3. `git clone` from the bare git repository a second time,
 >    to create a checkout you can manually edit (optional)
-> 4. run `ikiwiki --getctime --setup your.setup`
->    The getctime will ensure page creation times are accurate
->    by putting the info out of the git history,
->    and only needs to be done once.
 >
 > If you preserved your repository, but not the setup file,
 > the easiest way to make one is probably to run
 >
 > If you preserved your repository, but not the setup file,
 > the easiest way to make one is probably to run
index 707622956988b4f1b93fff55ec6d82b903a2972c..cf7044b2cbea60c63e3b85b806b7c5170017a2ab 100644 (file)
@@ -1085,6 +1085,13 @@ it up in the history.
 
 It's ok if this is not implemented, and throws an error.
 
 
 It's ok if this is not implemented, and throws an error.
 
+#### `rcs_getmtime($)`
+
+This is used to get the page modification time for a file from the RCS, by
+looking it up in the history.
+
+It's ok if this is not implemented, and throws an error.
+
 #### `rcs_receive()`
 
 This is called when ikiwiki is running as a pre-receive hook (or
 #### `rcs_receive()`
 
 This is called when ikiwiki is running as a pre-receive hook (or
index 4e7a8d2a67b0378222e6924dfc32a70d2b1c39d9..b5bfc24148fca5662fdf163a823690aaf363d5d4 100644 (file)
@@ -14,8 +14,10 @@ use, some advanced or special features are not supported in all of them.
 Lack of support in [[ikiwiki-makerepo]] or auto.setup can make it harder to
 set up a wiki using that revision control system. The `rcs_commit_staged`
 hook is needed to use [[attachments|plugins/attachment]] or
 Lack of support in [[ikiwiki-makerepo]] or auto.setup can make it harder to
 set up a wiki using that revision control system. The `rcs_commit_staged`
 hook is needed to use [[attachments|plugins/attachment]] or
-[[plugins/comments]]. And so on. The table below summarises this for each
-revision control system and links to more information about each.
+[[plugins/comments]]. `rcs_getctime` may be implemented in a fast way
+(ie, one log lookup for all files), or very slowly (one lookup per file).
+And so on. The table below summarises this for each revision control
+system and links to more information about each.
 
 [[!table data="""
 feature             |[[git]]|[[svn]]|[[bzr]]   |[[monotone]]|[[mercurial]]|[[darcs]]|[[tla]]   |[[cvs]]
 
 [[!table data="""
 feature             |[[git]]|[[svn]]|[[bzr]]   |[[monotone]]|[[mercurial]]|[[darcs]]|[[tla]]   |[[cvs]]
@@ -25,6 +27,8 @@ auto.setup          |yes    |yes    |incomplete|yes         |incomplete   |yes
 `rcs_rename`        |yes    |yes    |yes       |yes         |no           |yes      |no        |yes
 `rcs_remove`        |yes    |yes    |yes       |yes         |no           |yes      |no        |yes
 `rcs_diff`          |yes    |yes    |yes       |yes         |no           |yes      |yes       |yes
 `rcs_rename`        |yes    |yes    |yes       |yes         |no           |yes      |no        |yes
 `rcs_remove`        |yes    |yes    |yes       |yes         |no           |yes      |no        |yes
 `rcs_diff`          |yes    |yes    |yes       |yes         |no           |yes      |yes       |yes
+`rcs_getctime`      |fast   |slow   |slow      |slow        |slow         |slow     |slow      |slow
+`rcs_getmtime`      |fast   |no     |no        |no          |no           |no       |no        |no
 anonymous push      |yes    |no     |no        |no          |no           |no       |no        |no
 conflict handling   |yes    |yes    |yes       |buggy       |yes          |yes      |yes       |yes
 """]]
 anonymous push      |yes    |no     |no        |no          |no           |no       |no        |no
 conflict handling   |yes    |yes    |yes       |buggy       |yes          |yes      |yes       |yes
 """]]
index 59330caa49ab626954af203b52b816b57b036416..8774c97238ec076cde98ca4aefbbd3a592a83499 100644 (file)
@@ -1,6 +1,6 @@
 Use case: You want to move away from Wordpress to Ikiwiki as your blogging/website platform, but you want to retain your old posts.
 
 Use case: You want to move away from Wordpress to Ikiwiki as your blogging/website platform, but you want to retain your old posts.
 
-[This](http://git.chris-lamb.co.uk/?p=ikiwiki-wordpress-import.git) is a simple tool that generates [git-fast-import](http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html)-compatible data from a WordPress export XML file. It retains creation time of each post, so you can use Ikiwiki's <tt>--getctime</tt> to get the preserve creation times on checkout. 
+[This](http://git.chris-lamb.co.uk/?p=ikiwiki-wordpress-import.git) is a simple tool that generates [git-fast-import](http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html)-compatible data from a WordPress export XML file. It retains creation time of each post, so you can use Ikiwiki's <tt>--gettime</tt> to get the preserve creation times on checkout. 
 
 WordPress categories are mapped onto Ikiwiki tags. The ability to import comments is planned.
 
 
 WordPress categories are mapped onto Ikiwiki tags. The ability to import comments is planned.
 
index 34d5b92520e0c40bfccf9357769ae8f8e6e848b4..69df369ec59f7d5b7c38451c01acf7620040567a 100644 (file)
@@ -6,14 +6,15 @@ My database appears corrupted:
 No idea how this happened.  I've blown it away and recreated it but, for future reference, is there any less violent way to recover from this situation?  I miss having the correct created and last edited times.  --[[sabr]]
 > update: fixed ctimes and mtimes using [these instructions](http://u32.net/Mediawiki_Conversion/Git_Import/#Correct%20Creation%20and%20Last%20Edited%20time) --[[sabr]]
 
 No idea how this happened.  I've blown it away and recreated it but, for future reference, is there any less violent way to recover from this situation?  I miss having the correct created and last edited times.  --[[sabr]]
 > update: fixed ctimes and mtimes using [these instructions](http://u32.net/Mediawiki_Conversion/Git_Import/#Correct%20Creation%20and%20Last%20Edited%20time) --[[sabr]]
 
-> That's overly complex. Just run `ikiwiki -setup your.setup -getctime`. 
+> That's overly complex. Just run `ikiwiki -setup your.setup -gettime`. 
 > BTW, I'd be interested in examining such a corrupt storable file to try
 > to see what happened to it. --[[Joey]]
 
 > BTW, I'd be interested in examining such a corrupt storable file to try
 > to see what happened to it. --[[Joey]]
 
->> --getctime appears to only set the last edited date.  It's not supposed to set the creation date, is it?  The only place that info is stored is in the git repo.
+>> --gettime appears to only set the last edited date.  It's not supposed to set the creation date, is it?  The only place that info is stored is in the git repo.
 
 >>> Pulling the page creation date out of the git history is exactly what
 
 >>> Pulling the page creation date out of the git history is exactly what
->>> --getctime does. --[[Joey]]
+>>> --gettime does. (It used to be called --getctime, and only do that; now
+>>> it also pulls out the last modified date). --[[Joey]]
 
 >> Alas, I seem to have lost the bad index file to periodic /tmp wiping; I'll send it to you if it happens again.  --[[sabr]]
 
 
 >> Alas, I seem to have lost the bad index file to periodic /tmp wiping; I'll send it to you if it happens again.  --[[sabr]]
 
index ea95fb8c9cbec8c4c4d7698b3f39c60a551689f7..760c56fa1b9586dd78c77ecf966b0efa9eaeb772 100644 (file)
@@ -1,9 +1,13 @@
 [[!tag wishlist]]
 
 [[!tag wishlist]]
 
-It might be a good idea to enable --getctime when `.ikiwiki` does not
+It might be a good idea to enable --gettime when `.ikiwiki` does not
 exist. This way a new checkout of a `srcdir` would automatically get
 exist. This way a new checkout of a `srcdir` would automatically get
-ctimes right. (Running --getctime whenever a rebuild is done would be too
+ctimes right. (Running --gettime whenever a rebuild is done would be too
 slow.) --[[Joey]] 
 
 Could this be too annoying in some cases, eg, checking out a large wiki
 that needs to get set up right away? --[[Joey]] 
 slow.) --[[Joey]] 
 
 Could this be too annoying in some cases, eg, checking out a large wiki
 that needs to get set up right away? --[[Joey]] 
+
+> Not for git with the new, optimised --getctime. For other VCS.. well,
+> pity they're not as fast as git ;), but it is a one-time expense...
+> [[done]] --[[Joey]]
index db1e36a10b109077ac5e1f55ffd6ce0ce001f1d4..553fef01ef447fff557ca997db1871b8c8a8619c 100644 (file)
@@ -320,13 +320,11 @@ also be configured using a setup file.
   intercepted. If you enable this option then you must run at least the 
   CGI portion of ikiwiki over SSL.
 
   intercepted. If you enable this option then you must run at least the 
   CGI portion of ikiwiki over SSL.
 
-* --getctime
+* --gettime
 
 
-  Pull creation time for each new page out of the revision control
-  system. This rarely used option provides a way to get the real creation
-  times of items in weblogs, such as when building a wiki from a new
-  VCS checkout. It is unoptimised and quite slow. It is best used
-  with --rebuild, to force ikiwiki to get the ctime for all pages.
+  Extract creation and modification times for each new page from the
+  the revision control's log. This is done automatically when building a
+  wiki for the first time, so you normally do not need to use this option.
 
 * --set var=value
   
 
 * --set var=value
   
index 38e4d320164ab40aed682ece22c3bdfd1aed8d34..801ff9a0bf0ad2ea5fcc79c019dd41955e366e5e 100755 (executable)
@@ -44,7 +44,8 @@ sub getconfig () {
                        "wrappergroup=s" => \$config{wrappergroup},
                        "usedirs!" => \$config{usedirs},
                        "prefix-directives!" => \$config{prefix_directives},
                        "wrappergroup=s" => \$config{wrappergroup},
                        "usedirs!" => \$config{usedirs},
                        "prefix-directives!" => \$config{prefix_directives},
-                       "getctime" => \$config{getctime},
+                       "getctime" => \$config{gettime},
+                       "gettime" => \$config{gettime},
                        "numbacklinks=i" => \$config{numbacklinks},
                        "rcs=s" => \$config{rcs},
                        "no-rcs" => sub { $config{rcs}="" },
                        "numbacklinks=i" => \$config{numbacklinks},
                        "rcs=s" => \$config{rcs},
                        "no-rcs" => sub { $config{rcs}="" },
diff --git a/mtime-to-git b/mtime-to-git
deleted file mode 100755 (executable)
index 9875af5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-# Sets mtimes of all files in the tree their last change date
-# based on git's log. Useful to avoid too new dates after a
-# fresh checkout, which lead to ikiwiki unnecessarily rebuilding
-# basewiki files on upgrade.
-if [ -d .git ]; then
-       for file in $(git ls-files); do
-               date="$(git log -1 --date=rfc "$file" | grep ^Date: | sed -e 's/Date://')"
-               if [ -n "$date" ]; then
-                       echo "$date $file"
-                       touch -d"$date" $file
-               fi
-       done
-fi