https://svn.lrde.epita.fr/svn/lrdetools/trunk
Index: ChangeLog
from Nicolas Pouillard <ertai(a)lrde.epita.fr>
Adapt the remaining files.
* vcs/lib/vcs/app.rb: Log to STDERR, improve the exception handling.
* vcs/lib/vcs/mail.rb, vcs/lib/vcs/status.rb, vcs/lib/vcs/revision.rb,
* vcs/lib/vcs/url.rb, vcs/lib/vcs/diffstat.rb, vcs/lib/vcs/svn.rb,
* vcs/lib/vcs/diff.rb, vcs/lib/vcs/last_changed_date.rb:
Update headers, and displayed message.
* vcs/lib/vcs/common_commit.rb: Fix a bug with the commit log.
* vcs/NEWS: Return to ceasar what belongs to him.
NEWS | 3 ++-
lib/vcs/app.rb | 6 ++++--
lib/vcs/common_commit.rb | 2 +-
lib/vcs/diff.rb | 4 ++--
lib/vcs/diffstat.rb | 2 +-
lib/vcs/last_changed_date.rb | 8 +++-----
lib/vcs/mail.rb | 4 ++--
lib/vcs/revision.rb | 2 +-
lib/vcs/status.rb | 2 ++
lib/vcs/svn.rb | 13 ++-----------
lib/vcs/url.rb | 10 +++-------
11 files changed, 23 insertions(+), 33 deletions(-)
Index: vcs/lib/vcs/diffstat.rb
--- vcs/lib/vcs/diffstat.rb (revision 235)
+++ vcs/lib/vcs/diffstat.rb (working copy)
@@ -18,7 +18,7 @@
def check_diffstat
unless `diffstat -V` =~ /diffstat version/
- raise ArgumentError, 'The `diffstat\' tool is needed by Vcs#diffstat'
+ raise ArgumentError, 'diffstat: diffstat is required'
end
end
Index: vcs/lib/vcs/url.rb
--- vcs/lib/vcs/url.rb (revision 235)
+++ vcs/lib/vcs/url.rb (working copy)
@@ -3,14 +3,10 @@
# License:: GNU General Public License (GPL).
# Revision:: $Id$
-require 'vcs/svn'
-
-class Svn
+class Vcs
def url! ( *args )
- puts info.read[/^URL:\s+(.*)$/, 1]
+ puts info(*args).read[/^URL:\s+(.*)$/, 1]
end
- alias_command :date, :last_changed_date
-
-end # class Svn
+end # class Vcs
Index: vcs/lib/vcs/app.rb
--- vcs/lib/vcs/app.rb (revision 235)
+++ vcs/lib/vcs/app.rb (working copy)
@@ -6,7 +6,7 @@
require 'pathname'
require 'logger'
-LOG = Logger.new(STDOUT)
+LOG = Logger.new(STDERR)
if severity = ENV['VCS_SEVERITY']
LOG.level = Logger.const_get(severity.upcase)
else
@@ -125,7 +125,9 @@
rescue Exception => ex
vcs.call_handlers unless vcs.nil?
LOG.debug { raise ex }
- LOG.error ex.to_s.sub(/\.$/, '')
+ err = ex.to_s.sub(/\.$/, '')
+ err = ex.inspect if err.empty?
+ LOG.error err
end
end
Index: vcs/lib/vcs/last_changed_date.rb
--- vcs/lib/vcs/last_changed_date.rb (revision 235)
+++ vcs/lib/vcs/last_changed_date.rb (working copy)
@@ -3,14 +3,12 @@
# License:: GNU General Public License (GPL).
# Revision:: $Id$
-require 'vcs/svn'
-
-class Svn
+class Vcs
def last_changed_date! ( *args )
- puts info.read[/^Last Changed Date:.*?\(([^)]*)\).*$/, 1]
+ puts info(*args).read[/^Last Changed Date:.*?\(([^)]*)\).*$/, 1]
end
alias_command :date, :last_changed_date
-end # class Svn
+end # class Vcs
Index: vcs/lib/vcs/mail.rb
--- vcs/lib/vcs/mail.rb (revision 235)
+++ vcs/lib/vcs/mail.rb (working copy)
@@ -28,13 +28,13 @@
def mail_failed
if defined? MAIL and MAIL.exist?
LOG.info "#{MAIL}: Contains the generated mail " +
- "(generated from #{@@message})"
+ "(generated from #{Message})"
end
end
def mail_conf_checker
unless `gpg --version` =~ /^gpg \(GnuPG\)/
- LOG.error 'command not found: gpg'
+ LOG.error 'mail: gunpg is required'
end
unless File.exist?("#{ENV['HOME']}/.gnupg/secring.gpg")
LOG.error 'no private key: in your ~/.gnupg'
Index: vcs/lib/vcs/common_commit.rb
--- vcs/lib/vcs/common_commit.rb (revision 235)
+++ vcs/lib/vcs/common_commit.rb (working copy)
@@ -37,7 +37,7 @@
args << 'ChangeLog' unless args.grep(/^[^-]/).empty?
begin
- commit_!('--message', mk_log_entry(*args), *(opts + args))
+ commit_!('--message', mk_log_entry(*args).read, *(opts + args))
iform = YAML.load(IForm.read).merge('commited' => true)
IForm.open('w') { |f| f.print iform.to_yaml }
TMP_CL.delete if TMP_CL.exist?
Index: vcs/lib/vcs/diff.rb
--- vcs/lib/vcs/diff.rb (revision 235)
+++ vcs/lib/vcs/diff.rb (working copy)
@@ -11,7 +11,7 @@
def check_gnu_diff
unless `diff --version` =~ /GNU/
- raise ArgumentError, 'Gnu diff is needed by Vcs#diffw'
+ raise ArgumentError, 'diffw: Gnu diff is required'
end
end
add_conf_checker :check_gnu_diff
@@ -19,7 +19,7 @@
end # class Vcs
-class Svn
+class Svn < Vcs
# A diff only for your eyes
def diffw! ( *args )
Index: vcs/NEWS
--- vcs/NEWS (revision 235)
+++ vcs/NEWS (working copy)
@@ -3,7 +3,8 @@
* Vcs extensions files:
- Protocol version:
You can now add `protocol_version "0.1"' in your extensions.
Thus
- you will be alert when the format will changes.
+ you will be warned when the format changes. Thanks to Akim Demaille
+ for this idea.
- Default commit:
By adding `default_commit :your_commit_method' you override the
default commit method with yours. So you can call `commit' and `ci',
Index: vcs/lib/vcs/svn.rb
--- vcs/lib/vcs/svn.rb (revision 235)
+++ vcs/lib/vcs/svn.rb (working copy)
@@ -1,16 +1,7 @@
# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
+# Copyright:: Copyright (c) 2004, 2005 LRDE. All rights reserved.
# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-
-CL = Pathname.new('ChangeLog')
-ADD_CL = Pathname.new(',ChangeLog')
-TMP_CL = Pathname.new(',,ChangeLog')
-META = Pathname.new(',meta')
+# Revision:: $Id: header 98 2004-09-29 12:07:43Z ertai $
class Svn < Vcs
Index: vcs/lib/vcs/revision.rb
--- vcs/lib/vcs/revision.rb (revision 235)
+++ vcs/lib/vcs/revision.rb (working copy)
@@ -10,7 +10,7 @@
class Svn
def revision! ( *args )
- puts info.read[/^Revision:\s+(\d+)/, 1]
+ puts info(*args).read[/^Revision:\s+(\d+)/, 1]
end
alias_command :rev, :revision
Index: vcs/lib/vcs/status.rb
--- vcs/lib/vcs/status.rb (revision 235)
+++ vcs/lib/vcs/status.rb (working copy)
@@ -3,6 +3,8 @@
# License:: GNU General Public License (GPL).
# Revision:: $Id$
+require 'vcs/svn'
+
class Svn
def from_status ( *args, &block )