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.
master
Joey Hess 2010-06-23 16:05:49 -04:00
parent c46bcb425a
commit b4a43406f6
11 changed files with 46 additions and 37 deletions

View File

@ -137,8 +137,8 @@ sub bzr_author ($$) {
} }
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
my ($file, $message, $rcstoken, $user, $ipaddr) = @_; my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
$user = bzr_author($user, $ipaddr); $user = bzr_author($user, $ipaddr);
@ -156,10 +156,10 @@ sub rcs_commit ($$$;$$) {
return undef; # success return undef; # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
# Commits all staged changes. Changes can be staged using rcs_add, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # rcs_remove, and rcs_rename.
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
$user = bzr_author($user, $ipaddr); $user = bzr_author($user, $ipaddr);

View File

@ -183,7 +183,7 @@ sub rcs_prepedit ($) {
return defined $rev ? $rev : ""; return defined $rev ? $rev : "";
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
# Tries to commit the page; returns undef on _success_ and # Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure. # a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir. # The file is relative to the srcdir.
@ -192,6 +192,7 @@ sub rcs_commit ($$$;$$) {
my $rcstoken=shift; my $rcstoken=shift;
my $user=shift; my $user=shift;
my $ipaddr=shift; my $ipaddr=shift;
my $emailuser=shift;
return unless cvs_is_controlling; return unless cvs_is_controlling;
@ -224,10 +225,10 @@ sub rcs_commit ($$$;$$) {
return undef # success return undef # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
# Commits all staged changes. Changes can be staged using rcs_add, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # rcs_remove, and rcs_rename.
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
if (defined $user) { if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : ""); $message="web commit by $user".(length $message ? ": $message" : "");

View File

@ -140,11 +140,11 @@ sub rcs_prepedit ($) {
return $rev; return $rev;
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
# Commit the page. Returns 'undef' on success and a version of the page # Commit the page. Returns 'undef' on success and a version of the page
# with conflict markers on failure. # 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. # Compute if the "revision" of $file changed.
my $changed = darcs_rev($file) ne $rcstoken; my $changed = darcs_rev($file) ne $rcstoken;
@ -239,8 +239,8 @@ sub rcs_commit ($$$;$$) {
} }
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
my ($message, $user, $ipaddr) = @_; my ($message, $user, $ipaddr, $emailuser) = @_;
my $author; my $author;
if (defined $user) { if (defined $user) {

View File

@ -464,12 +464,12 @@ sub rcs_prepedit ($) {
return git_sha1($file); return git_sha1($file);
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
# Try to commit the page; returns undef on _success_ and # Try to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on # a version of the page with the rcs's conflict markers on
# failure. # 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 # Check to see if the page has been changed by someone else since
# rcs_prepedit was called. # rcs_prepedit was called.
@ -485,10 +485,10 @@ sub rcs_commit ($$$;$$) {
return rcs_commit_staged($message, $user, $ipaddr); 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, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # rcs_remove, and rcs_rename.
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
# Set the commit author and email to the web committer. # Set the commit author and email to the web committer.
my %env=%ENV; my %env=%ENV;

View File

@ -126,8 +126,8 @@ sub rcs_prepedit ($) {
return ""; return "";
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
my ($file, $message, $rcstoken, $user, $ipaddr) = @_; my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
if (defined $user) { if (defined $user) {
$user = IkiWiki::possibly_foolish_untaint($user); $user = IkiWiki::possibly_foolish_untaint($user);
@ -153,10 +153,10 @@ sub rcs_commit ($$$;$$) {
return undef; # success return undef; # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
# Commits all staged changes. Changes can be staged using rcs_add, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # rcs_remove, and rcs_rename.
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
error("rcs_commit_staged not implemented for mercurial"); # TODO error("rcs_commit_staged not implemented for mercurial"); # TODO
} }

View File

@ -293,7 +293,7 @@ sub rcs_prepedit ($) {
return get_rev(); return get_rev();
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
# Tries to commit the page; returns undef on _success_ and # Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure. # a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir. # The file is relative to the srcdir.
@ -302,6 +302,7 @@ sub rcs_commit ($$$;$$) {
my $rcstoken=shift; my $rcstoken=shift;
my $user=shift; my $user=shift;
my $ipaddr=shift; my $ipaddr=shift;
my $emailuser=shift;
my $author; my $author;
if (defined $user) { if (defined $user) {
@ -438,10 +439,10 @@ sub rcs_commit ($$$;$$) {
return undef # success return undef # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
# Commits all staged changes. Changes can be staged using rcs_add, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # 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 # Note - this will also commit any spurious changes that happen to be
# lying around in the working copy. There shouldn't be any, but... # lying around in the working copy. There shouldn't be any, but...

View File

@ -38,13 +38,13 @@ sub rcs_prepedit ($) {
return "" return ""
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
my ($file, $message, $rcstoken, $user, $ipaddr) = @_; my ($file, $message, $rcstoken, $user, $ipaddr, $emailuser) = @_;
return undef # success return undef # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
return undef # success return undef # success
} }

View File

@ -144,7 +144,7 @@ sub rcs_prepedit ($) {
} }
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
# Tries to commit the page; returns undef on _success_ and # Tries to commit the page; returns undef on _success_ and
# a version of the page with the rcs's conflict markers on failure. # a version of the page with the rcs's conflict markers on failure.
# The file is relative to the srcdir. # The file is relative to the srcdir.
@ -153,6 +153,7 @@ sub rcs_commit ($$$;$$) {
my $rcstoken=shift; my $rcstoken=shift;
my $user=shift; my $user=shift;
my $ipaddr=shift; my $ipaddr=shift;
my $emailuser=shift;
if (defined $user) { if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : ""); $message="web commit by $user".(length $message ? ": $message" : "");
@ -189,10 +190,10 @@ sub rcs_commit ($$$;$$) {
return undef # success return undef # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
# Commits all staged changes. Changes can be staged using rcs_add, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # rcs_remove, and rcs_rename.
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
if (defined $user) { if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : ""); $message="web commit by $user".(length $message ? ": $message" : "");

View File

@ -98,12 +98,13 @@ sub rcs_prepedit ($) {
} }
} }
sub rcs_commit ($$$;$$) { sub rcs_commit ($$$;$$$) {
my $file=shift; my $file=shift;
my $message=shift; my $message=shift;
my $rcstoken=shift; my $rcstoken=shift;
my $user=shift; my $user=shift;
my $ipaddr=shift; my $ipaddr=shift;
my $emailuser=shift;
if (defined $user) { if (defined $user) {
$message="web commit by $user".(length $message ? ": $message" : ""); $message="web commit by $user".(length $message ? ": $message" : "");
@ -139,10 +140,10 @@ sub rcs_commit ($$$;$$) {
return undef # success return undef # success
} }
sub rcs_commit_staged ($$$) { sub rcs_commit_staged ($$$;$) {
# Commits all staged changes. Changes can be staged using rcs_add, # Commits all staged changes. Changes can be staged using rcs_add,
# rcs_remove, and rcs_rename. # rcs_remove, and rcs_rename.
my ($message, $user, $ipaddr)=@_; my ($message, $user, $ipaddr, $emailuser)=@_;
error("rcs_commit_staged not implemented for tla"); # TODO error("rcs_commit_staged not implemented for tla"); # TODO
} }

5
debian/changelog vendored
View File

@ -1,6 +1,9 @@
ikiwiki (3.20100624) UNRELEASED; urgency=low 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 <joeyh@debian.org> Wed, 23 Jun 2010 15:30:04 -0400 -- Joey Hess <joeyh@debian.org> Wed, 23 Jun 2010 15:30:04 -0400

View File

@ -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 it might return the current revision ID of the file, and use that
information later when merging changes. 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 Should try to commit the file. Returns `undef` on *success* and a version
of the page with the rcs's conflict markers on failure. 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. Returns undef on success, and an error message on failure.
Changes can be staged by calls to `rcs_add`, `rcs_remove`, and Changes can be staged by calls to `rcs_add`, `rcs_remove`, and