From b4a43406f61b7ff9ab77d242edf4d59369ac8596 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 23 Jun 2010 16:05:49 -0400 Subject: [PATCH] API: rcs_commit and rcs_commit_staged are passed a new parameter that may contain the username component of the email address of the user making the commit. --- IkiWiki/Plugin/bzr.pm | 8 ++++---- IkiWiki/Plugin/cvs.pm | 7 ++++--- IkiWiki/Plugin/darcs.pm | 8 ++++---- IkiWiki/Plugin/git.pm | 8 ++++---- IkiWiki/Plugin/mercurial.pm | 8 ++++---- IkiWiki/Plugin/monotone.pm | 7 ++++--- IkiWiki/Plugin/norcs.pm | 8 ++++---- IkiWiki/Plugin/svn.pm | 7 ++++--- IkiWiki/Plugin/tla.pm | 7 ++++--- debian/changelog | 5 ++++- doc/plugins/write.mdwn | 10 ++++++---- 11 files changed, 46 insertions(+), 37 deletions(-) diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 9bee0c4b2..44ab9a86a 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -137,8 +137,8 @@ sub bzr_author ($$) { } } -sub rcs_commit ($$$;$$) { - my ($file, $message, $rcstoken, $user, $ipaddr) = @_; +sub rcs_commit ($$$;$$$) { + my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_; $user = bzr_author($user, $ipaddr); @@ -156,10 +156,10 @@ sub rcs_commit ($$$;$$) { return undef; # success } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; $user = bzr_author($user, $ipaddr); diff --git a/IkiWiki/Plugin/cvs.pm b/IkiWiki/Plugin/cvs.pm index 18491d517..a9fe162a1 100644 --- a/IkiWiki/Plugin/cvs.pm +++ b/IkiWiki/Plugin/cvs.pm @@ -183,7 +183,7 @@ sub rcs_prepedit ($) { return defined $rev ? $rev : ""; } -sub rcs_commit ($$$;$$) { +sub rcs_commit ($$$;$$$) { # Tries to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on failure. # The file is relative to the srcdir. @@ -192,6 +192,7 @@ sub rcs_commit ($$$;$$) { my $rcstoken=shift; my $user=shift; my $ipaddr=shift; + my $emailuser=shift; return unless cvs_is_controlling; @@ -224,10 +225,10 @@ sub rcs_commit ($$$;$$) { return undef # success } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; if (defined $user) { $message="web commit by $user".(length $message ? ": $message" : ""); diff --git a/IkiWiki/Plugin/darcs.pm b/IkiWiki/Plugin/darcs.pm index f17fadcb1..345456c01 100644 --- a/IkiWiki/Plugin/darcs.pm +++ b/IkiWiki/Plugin/darcs.pm @@ -140,11 +140,11 @@ sub rcs_prepedit ($) { return $rev; } -sub rcs_commit ($$$;$$) { +sub rcs_commit ($$$;$$$) { # Commit the page. Returns 'undef' on success and a version of the page # with conflict markers on failure. - my ($file, $message, $rcstoken, $user, $ipaddr) = @_; + my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_; # Compute if the "revision" of $file changed. my $changed = darcs_rev($file) ne $rcstoken; @@ -239,8 +239,8 @@ sub rcs_commit ($$$;$$) { } } -sub rcs_commit_staged ($$$) { - my ($message, $user, $ipaddr) = @_; +sub rcs_commit_staged ($$$;$) { + my ($message, $user, $ipaddr, $emailuser) = @_; my $author; if (defined $user) { diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index a43b85920..b56f229d7 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -464,12 +464,12 @@ sub rcs_prepedit ($) { return git_sha1($file); } -sub rcs_commit ($$$;$$) { +sub rcs_commit ($$$;$$$) { # Try to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on # failure. - my ($file, $message, $rcstoken, $user, $ipaddr) = @_; + my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_; # Check to see if the page has been changed by someone else since # rcs_prepedit was called. @@ -485,10 +485,10 @@ sub rcs_commit ($$$;$$) { return rcs_commit_staged($message, $user, $ipaddr); } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; # Set the commit author and email to the web committer. my %env=%ENV; diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index a80bb2da5..1793ab4bb 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -126,8 +126,8 @@ sub rcs_prepedit ($) { return ""; } -sub rcs_commit ($$$;$$) { - my ($file, $message, $rcstoken, $user, $ipaddr) = @_; +sub rcs_commit ($$$;$$$) { + my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_; if (defined $user) { $user = IkiWiki::possibly_foolish_untaint($user); @@ -153,10 +153,10 @@ sub rcs_commit ($$$;$$) { return undef; # success } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; error("rcs_commit_staged not implemented for mercurial"); # TODO } diff --git a/IkiWiki/Plugin/monotone.pm b/IkiWiki/Plugin/monotone.pm index 67d4abbaa..55d8039e0 100644 --- a/IkiWiki/Plugin/monotone.pm +++ b/IkiWiki/Plugin/monotone.pm @@ -293,7 +293,7 @@ sub rcs_prepedit ($) { return get_rev(); } -sub rcs_commit ($$$;$$) { +sub rcs_commit ($$$;$$$) { # Tries to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on failure. # The file is relative to the srcdir. @@ -302,6 +302,7 @@ sub rcs_commit ($$$;$$) { my $rcstoken=shift; my $user=shift; my $ipaddr=shift; + my $emailuser=shift; my $author; if (defined $user) { @@ -438,10 +439,10 @@ sub rcs_commit ($$$;$$) { return undef # success } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; # Note - this will also commit any spurious changes that happen to be # lying around in the working copy. There shouldn't be any, but... diff --git a/IkiWiki/Plugin/norcs.pm b/IkiWiki/Plugin/norcs.pm index 053652a5f..5131a1502 100644 --- a/IkiWiki/Plugin/norcs.pm +++ b/IkiWiki/Plugin/norcs.pm @@ -38,13 +38,13 @@ sub rcs_prepedit ($) { return "" } -sub rcs_commit ($$$;$$) { - my ($file, $message, $rcstoken, $user, $ipaddr) = @_; +sub rcs_commit ($$$;$$$) { + my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_; return undef # success } -sub rcs_commit_staged ($$$) { - my ($message, $user, $ipaddr)=@_; +sub rcs_commit_staged ($$$;$) { + my ($message, $user, $ipaddr, $emailuser)=@_; return undef # success } diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index d10b4888d..ffacb8cf9 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -144,7 +144,7 @@ sub rcs_prepedit ($) { } } -sub rcs_commit ($$$;$$) { +sub rcs_commit ($$$;$$$) { # Tries to commit the page; returns undef on _success_ and # a version of the page with the rcs's conflict markers on failure. # The file is relative to the srcdir. @@ -153,6 +153,7 @@ sub rcs_commit ($$$;$$) { my $rcstoken=shift; my $user=shift; my $ipaddr=shift; + my $emailuser=shift; if (defined $user) { $message="web commit by $user".(length $message ? ": $message" : ""); @@ -189,10 +190,10 @@ sub rcs_commit ($$$;$$) { return undef # success } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; if (defined $user) { $message="web commit by $user".(length $message ? ": $message" : ""); diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index f5ad0cc96..80c015e3c 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -98,12 +98,13 @@ sub rcs_prepedit ($) { } } -sub rcs_commit ($$$;$$) { +sub rcs_commit ($$$;$$$) { my $file=shift; my $message=shift; my $rcstoken=shift; my $user=shift; my $ipaddr=shift; + my $emailuser=shift; if (defined $user) { $message="web commit by $user".(length $message ? ": $message" : ""); @@ -139,10 +140,10 @@ sub rcs_commit ($$$;$$) { return undef # success } -sub rcs_commit_staged ($$$) { +sub rcs_commit_staged ($$$;$) { # Commits all staged changes. Changes can be staged using rcs_add, # rcs_remove, and rcs_rename. - my ($message, $user, $ipaddr)=@_; + my ($message, $user, $ipaddr, $emailuser)=@_; error("rcs_commit_staged not implemented for tla"); # TODO } diff --git a/debian/changelog b/debian/changelog index 01d0abb47..2dfebd0b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ ikiwiki (3.20100624) UNRELEASED; urgency=low - * Add new optional field usershort to rcs_recentchanges. + * API: Add new optional field usershort to rcs_recentchanges. + * API: rcs_commit and rcs_commit_staged are passed a new parameter + that may contain the username component of the email address of + the user making the commit. -- Joey Hess Wed, 23 Jun 2010 15:30:04 -0400 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 5f0e95a9f..ab2934bf1 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -1051,15 +1051,17 @@ token, that will be passed into `rcs_commit` when committing. For example, it might return the current revision ID of the file, and use that information later when merging changes. -#### `rcs_commit($$$;$$)` +#### `rcs_commit($$$;$$$)` -Passed a file, message, token (from `rcs_prepedit`), user, and ip address. +Passed a file, message, token (from `rcs_prepedit`), user, ip address, +and optionally the username component of the committer's email address. Should try to commit the file. Returns `undef` on *success* and a version of the page with the rcs's conflict markers on failure. -#### `rcs_commit_staged($$$)` +#### `rcs_commit_staged($$$;$)` -Passed a message, user, and ip address. Should commit all staged changes. +Passed a message, user, ip address, and optionally the username component of +the committer's email address. Should commit all staged changes. Returns undef on success, and an error message on failure. Changes can be staged by calls to `rcs_add`, `rcs_remove`, and -- 2.45.0