From: Benoit Sigoure <tsuna@lrde.epita.fr>
To: git@vger.kernel.org
Cc: normalperson@yhbt.net, Benoit Sigoure <tsuna@lrde.epita.fr>
Subject: [PATCHv2 5/5] Simplify the handling of fatal errors.
Date: Tue, 16 Oct 2007 16:36:52 +0200 [thread overview]
Message-ID: <1192545412-10929-5-git-send-email-tsuna@lrde.epita.fr> (raw)
In-Reply-To: <1192545412-10929-4-git-send-email-tsuna@lrde.epita.fr>
* git-svn.perl (&fatal): Append the newline at the end of the error
message.
Adjust all callers.
Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
---
git-svn.perl | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 8efe949..656493a 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -21,12 +21,12 @@ $Git::SVN::Log::TZ = $ENV{TZ};
$ENV{TZ} = 'UTC';
$| = 1; # unbuffer STDOUT
-sub fatal (@) { print STDERR @_; exit 1 }
+sub fatal (@) { print STDERR "@_\n"; exit 1 }
require SVN::Core; # use()-ing this causes segfaults for me... *shrug*
require SVN::Ra;
require SVN::Delta;
if ($SVN::Core::VERSION lt '1.1.0') {
- fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)\n";
+ fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)";
}
push @Git::SVN::Ra::ISA, 'SVN::Ra';
push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
@@ -369,7 +369,7 @@ sub cmd_set_tree {
} elsif (scalar @tmp > 1) {
push @revs, reverse(command('rev-list',@tmp));
} else {
- fatal "Failed to rev-parse $c\n";
+ fatal "Failed to rev-parse $c";
}
}
my $gs = Git::SVN->new;
@@ -379,7 +379,7 @@ sub cmd_set_tree {
fatal "There are new revisions that were fetched ",
"and need to be merged (or acknowledged) ",
"before committing.\nlast rev: $r_last\n",
- " current: $gs->{last_rev}\n";
+ " current: $gs->{last_rev}";
}
$gs->set_tree($_) foreach @revs;
print "Done committing ",scalar @revs," revisions to SVN\n";
@@ -408,7 +408,7 @@ sub cmd_dcommit {
(undef, $last_rev, undef) = cmt_metadata("$d~1");
unless (defined $last_rev) {
fatal "Unable to extract revision information ",
- "from commit $d~1\n";
+ "from commit $d~1";
}
}
if ($_dry_run) {
@@ -521,7 +521,7 @@ sub cmd_create_ignore {
my $ignore = '.' . $path . '.gitignore';
my $s = $props->{'svn:ignore'} or return;
open(GITIGNORE, '>', $ignore)
- or fatal("Failed to open `$ignore' for writing: $!\n");
+ or fatal("Failed to open `$ignore' for writing: $!");
$s =~ s/[\r\n]+/\n/g;
chomp $s;
# Prefix all patterns so that the ignore doesn't apply
@@ -529,7 +529,7 @@ sub cmd_create_ignore {
$s =~ s#^#/#gm;
print GITIGNORE "$s\n";
close(GITIGNORE)
- or fatal("Failed to close `$ignore': $!\n");
+ or fatal("Failed to close `$ignore': $!");
command_noisy('add', $ignore);
});
}
@@ -545,7 +545,7 @@ sub get_svnprops {
# prefix THE PATH by the sub-directory from which the user
# invoked us.
$path = $cmd_dir_prefix . $path;
- fatal("No such file or directory: $path\n") unless -e $path;
+ fatal("No such file or directory: $path") unless -e $path;
my $is_dir = -d $path ? 1 : 0;
$path = $gs->{path} . '/' . $path;
@@ -578,7 +578,7 @@ sub cmd_propget {
usage(1) if not defined $prop;
my $props = get_svnprops($path);
if (not defined $props->{$prop}) {
- fatal("`$path' does not have a `$prop' SVN property.\n");
+ fatal("`$path' does not have a `$prop' SVN property.");
}
print $props->{$prop} . "\n";
}
@@ -642,7 +642,7 @@ sub cmd_multi_fetch {
sub cmd_commit_diff {
my ($ta, $tb, $url) = @_;
my $usage = "Usage: $0 commit-diff -r<revision> ".
- "<tree-ish> <tree-ish> [<URL>]\n";
+ "<tree-ish> <tree-ish> [<URL>]";
fatal($usage) if (!defined $ta || !defined $tb);
my $svn_path;
if (!defined $url) {
@@ -660,7 +660,7 @@ sub cmd_commit_diff {
if (defined $_message && defined $_file) {
fatal("Both --message/-m and --file/-F specified ",
"for the commit message.\n",
- "I have no idea what you mean\n");
+ "I have no idea what you mean");
}
if (defined $_file) {
$_message = file_to_s($_file);
@@ -723,7 +723,7 @@ sub complete_svn_url {
if ($path !~ m#^[a-z\+]+://#) {
if (!defined $url || $url !~ m#^[a-z\+]+://#) {
fatal("E: '$path' is not a complete URL ",
- "and a separate URL is not specified\n");
+ "and a separate URL is not specified");
}
return ($url, $path);
}
@@ -744,7 +744,7 @@ sub complete_url_ls_init {
$repo_path =~ s#^/+##;
unless ($ra) {
fatal("E: '$repo_path' is not a complete URL ",
- "and a separate URL is not specified\n");
+ "and a separate URL is not specified");
}
}
my $url = $ra->{url};
@@ -1750,7 +1750,7 @@ sub assert_index_clean {
$x = command_oneline('write-tree');
if ($y ne $x) {
::fatal "trees ($treeish) $y != $x\n",
- "Something is seriously wrong...\n";
+ "Something is seriously wrong...";
}
});
}
@@ -2176,7 +2176,7 @@ sub set_tree {
my ($self, $tree) = (shift, shift);
my $log_entry = ::get_commit_entry($tree);
unless ($self->{last_rev}) {
- fatal("Must have an existing revision to commit\n");
+ fatal("Must have an existing revision to commit");
}
my %ed_opts = ( r => $self->{last_rev},
log => $log_entry->{log},
@@ -3126,7 +3126,7 @@ sub apply_diff {
if (defined $o{$f}) {
$self->$f($m);
} else {
- fatal("Invalid change type: $f\n");
+ fatal("Invalid change type: $f");
}
}
$self->rmdirs if $_rmdir;
@@ -3734,15 +3734,15 @@ sub config_pager {
sub run_pager {
return unless -t *STDOUT && defined $pager;
pipe my $rfd, my $wfd or return;
- defined(my $pid = fork) or ::fatal "Can't fork: $!\n";
+ defined(my $pid = fork) or ::fatal "Can't fork: $!";
if (!$pid) {
open STDOUT, '>&', $wfd or
- ::fatal "Can't redirect to stdout: $!\n";
+ ::fatal "Can't redirect to stdout: $!";
return;
}
- open STDIN, '<&', $rfd or ::fatal "Can't redirect stdin: $!\n";
+ open STDIN, '<&', $rfd or ::fatal "Can't redirect stdin: $!";
$ENV{LESS} ||= 'FRSX';
- exec $pager or ::fatal "Can't run pager: $! ($pager)\n";
+ exec $pager or ::fatal "Can't run pager: $! ($pager)";
}
sub tz_to_s_offset {
@@ -3878,7 +3878,7 @@ sub cmd_show_log {
$r_min = $r_max = $::_revision;
} else {
::fatal "-r$::_revision is not supported, use ",
- "standard \'git log\' arguments instead\n";
+ "standard 'git log' arguments instead";
}
}
--
1.5.3.4.214.g6f43
next prev parent reply other threads:[~2007-10-16 14:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-16 14:36 [PATCHv2 1/5] Add a generic tree traversal to fetch SVN properties Benoit Sigoure
2007-10-16 14:36 ` [PATCHv2 2/5] Implement git svn create-ignore Benoit Sigoure
2007-10-16 14:36 ` [PATCHv2 3/5] Add git svn propget Benoit Sigoure
2007-10-16 14:36 ` [PATCHv2 4/5] Add git svn proplist Benoit Sigoure
2007-10-16 14:36 ` Benoit Sigoure [this message]
2007-11-12 17:13 ` [PATCH] git-svn: Document the `create-ignore', `propget' and `proplist' subcommands Benoit Sigoure
2007-10-16 14:53 ` [PATCHv2 1/5] Add a generic tree traversal to fetch SVN properties Johannes Sixt
2007-10-16 15:10 ` Benoit SIGOURE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1192545412-10929-5-git-send-email-tsuna@lrde.epita.fr \
--to=tsuna@lrde.epita.fr \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).