vcs 0.4.1 → 0.5.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS CHANGED
@@ -1,4 +1,32 @@
1
- New in 0.4 ...:
1
+ New in 0.5 ...:
2
+
3
+ * Add the full CVS support.
4
+
5
+ * Add a new_user flag in the configuration, this flag is enable by default
6
+ and makes vcs be more explicit. To turn of this option add this to your
7
+ main configuration file (~/.vcs):
8
+ new_user: false
9
+
10
+ * The interactive is now more by default (in non new_user mode):
11
+ So no question will be asked to you before the commit.
12
+ To active the interactive mode add this to your main .vcs:
13
+ interactive: true
14
+
15
+ * Add a force option to commit to bypass the unrecognized file rule.
16
+
17
+ * Now, just few colors are set by default. To have your full colored vcs
18
+ add this to your main configuration file:
19
+ color: xmas_tree
20
+
21
+ * Enforce the revision managment to avoid some conlifcts during two
22
+ commits at the same time.
23
+
24
+ * Add paginate which just open a file with your default pager program.
25
+
26
+ * Remove Prcs from the list of default systems, because it is not fully
27
+ supported. Of course contributions are wellcome :)
28
+
29
+ New in 0.4 2005-10-03:
2
30
 
3
31
  * Vcs now supports ruby 1.8.3.
4
32
 
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{vcs}
3
- s.version = "0.4.1"
4
- s.date = %q{2005-10-10}
3
+ s.version = "0.5.2.4"
4
+ s.date = %q{2006-02-28}
5
5
  s.summary = %q{A wrapper over Version Control Systems}
6
6
  s.email = ["ertai@lrde.epita.fr"]
7
7
  s.homepage = %q{http://rubyforge.org/projects/vcs}
8
8
  s.rubyforge_project = %q{vcs}
9
9
  s.description = %q{Version control systems (Subversion, CVS, PRCS...), however useful, are not very extensible: adding new features can be cumbersome, especially if you want them for different such systems at once. Vcs provide a simple dynamic hierarchy for Version Control Systems.}
10
10
  s.authors = ["Nicolas Pouillard"]
11
- s.files = ["lib/vcs/add.rb", "lib/vcs/app.rb", "lib/vcs/back.rb", "lib/vcs/changelog.rb", "lib/vcs/common_commit.rb", "lib/vcs/conflict.rb", "lib/vcs/cvs.rb", "lib/vcs/delete.rb", "lib/vcs/diff.rb", "lib/vcs/diffstat.rb", "lib/vcs/edit.rb", "lib/vcs/environment.rb", "lib/vcs/form.rb", "lib/vcs/ignore.rb", "lib/vcs/junk.rb", "lib/vcs/last_changed_date.rb", "lib/vcs/list.rb", "lib/vcs/mail.rb", "lib/vcs/message.rb", "lib/vcs/news.rb", "lib/vcs/opt_parse.rb", "lib/vcs/prcs.rb", "lib/vcs/revision.rb", "lib/vcs/script.rb", "lib/vcs/status.rb", "lib/vcs/svn.rb", "lib/vcs/url.rb", "lib/vcs/vcs.rb", "bin/vcs", "bin/vcs-cvs", "bin/vcs-prcs", "bin/vcs-svn", "AUTHORS", "HOWTO", "NEWS", "NEWS.FR", "Rakefile", "README", "SPEC.dyn.yml", "SPEC.gemspec", "SPEC.yml"]
12
- s.executables = ["vcs", "vcs-cvs", "vcs-prcs", "vcs-svn"]
13
- s.add_dependency(%q<ruby_ex>, ["~> 0.3.0"])
11
+ s.files = ["lib/vcs/revision.rb", "lib/vcs/diff.rb", "lib/vcs/conflict.rb", "lib/vcs/message.rb", "lib/vcs/common_commit.rb", "lib/vcs/junk.rb", "lib/vcs/opt_parse.rb", "lib/vcs/edit.rb", "lib/vcs/list.rb", "lib/vcs/mail.rb", "lib/vcs/add.rb", "lib/vcs/app.rb", "lib/vcs/cvs.rb", "lib/vcs/form.rb", "lib/vcs/news.rb", "lib/vcs/delete.rb", "lib/vcs/svn.rb", "lib/vcs/vcs.rb", "lib/vcs/url.rb", "lib/vcs/back.rb", "lib/vcs/environment.rb", "lib/vcs/status.rb", "lib/vcs/changelog.rb", "lib/vcs/last_changed_date.rb", "lib/vcs/script.rb", "lib/vcs/version.rb", "lib/vcs/prcs.rb", "lib/vcs/diffstat.rb", "lib/vcs/ignore.rb", "bin/vcs", "bin/vcs-prcs", "bin/vcs-cvs", "bin/vcs-svn", "contrib/emacs-support/vcs.el", "NEWS", "SPEC.gemspec", "HOWTO", "Rakefile", "README", "NEWS.FR", "AUTHORS", "SPEC.yml"]
12
+ s.executables = ["vcs", "vcs-prcs", "vcs-cvs", "vcs-svn"]
13
+ s.add_dependency(%q<ruby_ex>, ["~> 0.4.5"])
14
14
  end
data/SPEC.yml CHANGED
@@ -3,7 +3,7 @@ Author: Nicolas Pouillard
3
3
  License: GNU General Public License (GPL)
4
4
  Revision: '$Id$'
5
5
 
6
- name: vcs
6
+ version: !feydakins.org,2006/version dev-util/vcs-0.5_beta4
7
7
 
8
8
  title: Vcs -- A wrapper over Version Control Systems
9
9
  summary: A wrapper over Version Control Systems
@@ -14,11 +14,12 @@ description: |
14
14
  hierarchy for Version Control Systems.
15
15
  homepage: http://rubyforge.org/projects/vcs
16
16
 
17
+ user: ertai
18
+ rubyforge_project: vcs
17
19
  rdoc_dir: doc/html
20
+ trunk_url: https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs
18
21
  tags_url: https://svn.lrde.epita.fr/svn/lrdetools/tags
19
-
20
- commit_command: ltci
21
- commit_dir: ..
22
+ version_path: !path lib/vcs/version.rb
22
23
 
23
24
  rdoc_files: !filelist
24
25
  - README
@@ -28,15 +29,16 @@ rdoc_files: !filelist
28
29
  pkg_files: !filelist
29
30
  - lib/vcs/**/*.rb
30
31
  - bin/**/*
32
+ - contrib/emacs-support/**/*.el
31
33
  - '[A-Z]*'
32
34
 
33
35
  executables: [ vcs, vcs-svn, vcs-cvs, vcs-prcs ]
34
36
 
35
37
  dependencies:
36
38
  ruby_ex:
37
- gem : ~> 0.3.0
38
- tarball: 6317/ruby_ex-0.3.0.tar.gz
39
+ gem : ~> 0.4.5
40
+ tarball: 8879/ruby_ex-0.4.tar.gz
39
41
  vcs : svn://svn.feydakins.org/ruby_ex/trunk
40
42
 
41
43
  root_test_suite: test/vcs-check.yml
42
- ttk_version: ~> 0.3.0
44
+ uttk_version: ~> 0.3.1
@@ -0,0 +1,11 @@
1
+ (defun vcs-mode ()
2
+ "Mode for editing VCS message files."
3
+ (interactive)
4
+ (kill-all-local-variables)
5
+ (let ((file-name buffer-file-name))
6
+ (message-mode)
7
+ ;; Ensure message-mode didn't modified file-name.
8
+ (setq buffer-file-name file-name
9
+ major-mode 'vcs-mode
10
+ mode-name "VCS")
11
+ (run-hooks 'vcs-mode-hook)))
@@ -1,7 +1,7 @@
1
1
  # Copyright:: Copyright (c) 2005 LRDE. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: add.rb 265 2005-10-03 12:37:03Z pouill_n $
4
+ # Revision:: $Id: /lrde/tools/trunk/vcs/lib/vcs/add.rb 9106 2005-10-03T12:37:03.631187Z pouill_n $
5
5
 
6
6
  class Vcs
7
7
 
@@ -1,7 +1,7 @@
1
1
  # Copyright:: Copyright (c) 2005 LRDE. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: app.rb 261 2005-10-03 00:45:53Z pouill_n $
4
+ # Revision:: $Id: /w/lrde/tools/trunk/vcs/lib/vcs/app.rb 22374 2006-02-28T14:42:27.599831Z pouillar $
5
5
 
6
6
  require 'pathname'
7
7
 
@@ -29,7 +29,7 @@ class VcsApp
29
29
 
30
30
  def requirements
31
31
  Pathname.glob("{#{vcs_dir},#{extension_dirs.join(',')}}/*.rb") do |file|
32
- next if file.to_s =~ /\/(app|opt_parse|vcs)\.rb$/
32
+ next if file.to_s =~ /\/(app|opt_parse|vcs|svn|version)\.rb$/
33
33
  logger.debug { file.basename.to_s } if require file.to_s
34
34
  end
35
35
  grab_all_vcs()
@@ -85,7 +85,7 @@ class VcsApp
85
85
  end
86
86
 
87
87
  def user_configuration_setup
88
- grab_dirs('.vcs').each do |vcs_user_conf|
88
+ grab_dirs('.vcs').reverse_each do |vcs_user_conf|
89
89
  Vcs.merge_user_conf(vcs_user_conf)
90
90
  end
91
91
  end
@@ -95,6 +95,7 @@ class VcsApp
95
95
  begin
96
96
  user_configuration_setup()
97
97
  Vcs.logger.color = Vcs.color? { STDERR.tty? }
98
+ Vcs::Logger.enable_xmas_tree_colors if Vcs.xmas_tree_colors?
98
99
  vcs_extensions_setup()
99
100
  @@parser.parse! ARGV if Vcs.default.nil?
100
101
  if Vcs.default.nil?
@@ -1,7 +1,7 @@
1
1
  # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: back.rb 261 2005-10-03 00:45:53Z pouill_n $
4
+ # Revision:: $Id: /lrde/tools/trunk/vcs/lib/vcs/back.rb 9102 2005-10-03T00:45:53.019651Z pouill_n $
5
5
 
6
6
  class Vcs
7
7
  # This command take a command as argument and search the last revision where
@@ -39,6 +39,8 @@ class Vcs
39
39
  # Same switches as status
40
40
  def mk_log_entry! ( *args )
41
41
  with_cache! LogEntry, 'Log entry' do
42
+ puts '<%= Title %>'
43
+ puts
42
44
  mk_log_entry_contents(*args).each do |se|
43
45
  puts "- #{se.file}: #{se.comment}."
44
46
  end
@@ -47,12 +49,25 @@ class Vcs
47
49
  alias_command :mkl, :mk_log_entry
48
50
  LogEntry = ',log'.to_path unless defined? LogEntry
49
51
 
52
+
53
+ # Same switches as status
54
+ def mk_yaml_log_entry! ( *args )
55
+ raise NotImplentedError
56
+ # with_cache! LogEntry, 'Log entry' do
57
+ # mk_log_entry_contents(*args).each do |se|
58
+ # puts " - #{se.file}: >2\n #{se.comment}."
59
+ # end
60
+ # end
61
+ end
62
+ alias_command :mkyl, :mk_yaml_log_entry
63
+
64
+
50
65
  def log_to_changelog ( aString )
51
66
  if aString.blank?
52
67
  puts
53
68
  else
54
- putc ?\t
55
- aString.sub!(/^-/, '*')
69
+ aString.sub!(/^([^-\s])/, "\t\\1")
70
+ aString.sub!(/^-/, "\t*")
56
71
  puts aString
57
72
  end
58
73
  end
@@ -72,6 +87,7 @@ class Vcs
72
87
  puts 'Index: ChangeLog'
73
88
  puts "from #{Vcs.full_email}"
74
89
  puts
90
+ puts "\tDo not fill this draft entry!" if editing?
75
91
  mk_log_entry(*args).each_line(&method(:log_to_changelog))
76
92
  end
77
93
  alias_command :mkml, :mk_message_entry
@@ -5,18 +5,27 @@
5
5
 
6
6
  class Vcs
7
7
 
8
- def common_commit! ( subject_format, files=[], opts={}, &block )
8
+ cattr_accessor :commit_state
9
+
10
+ def common_commit! ( subject_format, files=[], commit_opts={}, &block )
9
11
 
10
12
  unless CL.exist?
11
13
  raise Failure, "No `#{CL}', you are probably not in a valid directory."
12
14
  end
13
15
 
16
+ Vcs.commit_state = :editing
17
+ force = commit_opts[:force]
18
+ commit_opts.delete :force
19
+
20
+ opts = just_standard_options commit_opts
21
+
14
22
  @@subject_format = subject_format
15
23
 
16
- update!
24
+ logger.info { 'Updating your working copy...' }
25
+ update! [], opts
17
26
 
18
27
  have_unrecognized_files = false
19
- status(files) do |se|
28
+ status(files, opts) do |se|
20
29
  if se.category == :unrecognize
21
30
  have_unrecognized_files = true
22
31
  se.colorize! if color?
@@ -24,87 +33,123 @@ class Vcs
24
33
  end
25
34
  end
26
35
  if have_unrecognized_files
27
- raise Failure, "
28
- |You have unrecognized files in your working copy!
29
- |This meant that these files won't be commited!
30
- |You have some solutions to comply with the rule:
31
- |- You must put these files in some categories.
32
- | For instance you can rename these files and put a `+' before
33
- | to make it `precious':
34
- | put `,' for `junk'
35
- | put `\\' for `unmask'
36
- | put `-' for `exclude'
37
- |- You can also edit your configuration file (.vcs) to customize
38
- | these categories. For example add this:
39
- | ------------ .vcs ------------
40
- | precious:
41
- | - !re my_precious_file[0-9]*
42
- | - !re .*\.patch
43
- | ------------ .vcs ------------
44
- |- You can also perform a partial commit and specify which files
45
- | and directories commit. For example this command:
46
- | #{@command} commit foo.c bar/
47
- |
48
- |Commit failed".head_cut!
36
+ message = 'You have unrecognized files in your working copy!'
37
+ if Vcs.user_conf.new_user
38
+ message << "
39
+ |This meant that these files won't be committed!
40
+ |You have some solutions to comply with the rule:
41
+ |- You must put these files in some categories.
42
+ | For instance you can rename these files and put a `+' before
43
+ | to make it `precious':
44
+ | put `,' for `junk'
45
+ | put `\\' for `unmask'
46
+ | put `-' for `exclude'
47
+ |- You can also edit your configuration file (.vcs) to customize
48
+ | these categories. For example add this:
49
+ | ------------ .vcs ------------
50
+ | precious:
51
+ | - !re my_precious_file[0-9]*
52
+ | - !re .*\.patch
53
+ | ------------ .vcs ------------
54
+ |- You can also perform a partial commit and specify which files
55
+ | and directories commit. For example this command:
56
+ | #{@cmd.command} commit foo.c bar/
57
+ |
58
+ |".head_cut!
59
+ end
60
+ if force
61
+ logger.warn { message }
62
+ else
63
+ logger.error { message }
64
+ commit_failed
65
+ end
49
66
  end
50
67
 
51
- Vcs.commited = edit_form!(files)
68
+ block['empty subject'] if block_given?
52
69
 
53
- mk_message(files)
54
- edit! Message
70
+ Vcs.commit_state = edit_form!(files, opts.merge(:to => Vcs.mail_options.to))
55
71
 
56
- iform = nil
72
+ iform = YAML.load(IForm.read)
57
73
 
58
- if commited?
59
- iform ||= YAML.load(IForm.read)
60
- else
74
+ Message.unlink if Message.exist? and not committed?
75
+ mk_message(files, opts.merge(iform))
76
+ block[iform['Subject']] if block_given?
77
+ paginate! Message
61
78
 
62
- unless @h.agree 'Committing, are you sure? (y/n)', true
63
- commit_failed
79
+ unless committed?
80
+
81
+ if Vcs.interactive?
82
+ question = 'Committing, are you sure?'
83
+ begin
84
+ response = @h.agree "#{question} (y/n)", true
85
+ rescue NoMethodError
86
+ response = @h.agree "#{question} (yes/no)"
87
+ end
88
+ unless response
89
+ commit_failed
90
+ end
64
91
  end
65
92
 
66
- concat_changelog!(files)
93
+ concat_changelog!(files, opts)
67
94
 
68
95
  files << 'ChangeLog' unless files.empty?
69
96
 
70
97
  begin
71
- commit_!(files, opts.merge(:message => mk_log_entry(files).read))
72
- iform = YAML.load(IForm.read).merge('commited' => true)
98
+ commit_!(files, commit_opts.merge(:message => mk_log_entry(files).read))
99
+ update!
100
+ revision = rev.read.to_i
101
+ iform = YAML.load(IForm.read).merge('Revision' => revision)
73
102
  IForm.open('w') { |f| f.print iform.to_yaml }
103
+ Vcs.commit_state = revision
74
104
  TMP_CL.delete if TMP_CL.exist?
75
105
  rescue Exception => ex
76
106
  commit_failed ex
77
107
  end
78
108
 
79
- update!
80
-
81
109
  end
82
110
 
83
- block[iform['subject']] if block_given?
111
+ Vcs.commit_state = :sending
112
+ block[iform['Subject']] if block_given?
84
113
 
85
- logger.info 'Deleting junk files...'
114
+ logger.info { 'Deleting junk files...' }
86
115
  TMP_CL.delete if TMP_CL.exist?
87
- destdir = '+commited'.to_path/iform['revision'].to_s
116
+ # Backward typo compatibility
117
+ '+commited'.to_path.mv('+committed') if '+commited'.to_path.exist?
118
+ destdir = '+committed'.to_path/iform['Revision'].to_s
88
119
  destdir.mkpath unless destdir.directory?
89
- [LogEntry, Form, IForm, Message, MAIL, NEWS].each do |path|
120
+ moved = PathList.new
121
+ [LogEntry, Form, IForm, Message].each do |path|
90
122
  next unless path.exist?
91
123
  dest = destdir/path
92
- logger.info "Moving `#{path}' to `#{dest}'..."
124
+ moved << path
93
125
  path.rename(dest)
94
126
  end
127
+ logger.info { "Moving `#{moved.join('\', `')}' to `#{destdir}'..." }
95
128
 
96
129
  end
97
130
  protected :common_commit!
98
131
 
99
132
  def commit_failed ( ex=nil )
100
- logger.error "Aborting #{ex}"
101
- logger.info 'You can rerun the same command to resume the commit'
133
+ Message.unlink if defined? Message and Message.exist? and not committed?
134
+ logger.error { "Aborting #{ex}" }
135
+ logger.info { 'You can rerun the same command to resume the commit' }
102
136
  raise 'Commit failed'
103
137
  end
104
138
 
105
- cattr_accessor :commited
106
- def commited?
107
- Vcs.commited
139
+ def committed?
140
+ Vcs.commit_state.is_a? Integer
141
+ end
142
+
143
+ def editing?
144
+ Vcs.commit_state == :editing
145
+ end
146
+
147
+ def sending?
148
+ Vcs.commit_state == :sending
149
+ end
150
+
151
+ def committing?
152
+ [:editing, :committing, :sending].include? Vcs.commit_state
108
153
  end
109
154
 
110
155
  end # class Vcs
@@ -5,19 +5,23 @@
5
5
 
6
6
  class Vcs
7
7
 
8
- def mk_conflicts_list ( files, options={} )
9
- ls = status.output.readlines.grep(/^C/).map! { |s| s[/^C\s+(.*)/, 1] }
10
- raise "no conflicts" if ls.empty?
11
- ls
8
+ def mk_conflicts_list ( files=[], options={} )
9
+ conflicts = []
10
+ status(files, options) do |se|
11
+ conflicts << se.file if se.category == :conflict
12
+ end
13
+ raise "no conflicts" if conflicts.empty?
14
+ conflicts
12
15
  end
13
16
  protected :mk_conflicts_list
14
17
 
15
- def edit_conflicts! ( files, options={} )
16
- edit! mk_conflicts_list
18
+ def edit_conflicts! ( files=[], options={} )
19
+ edit! mk_conflicts_list(files, options)
20
+ resolve_conflicts! files, options
17
21
  end
18
22
 
19
- def resolve_conflicts! ( files, options={} )
20
- conflicts = mk_conflicts_list
23
+ def resolve_conflicts! ( files=[], options={} )
24
+ conflicts = mk_conflicts_list(files, options)
21
25
  question = "Resolve these conflicts?: \n - #{conflicts.join("\n - ")}\n(y/n)"
22
26
  if @h.agree question, true
23
27
  return resolved(conflicts)
@@ -15,10 +15,30 @@ class Cvs < Vcs
15
15
  self.option_controller = @@cvs_option_controller
16
16
  end
17
17
 
18
- %w[ rdiff rtag tag ].each do |m|
18
+ %w[ rdiff rtag tag login ].each do |m|
19
19
  add_basic_method(m)
20
20
  end
21
21
 
22
- @@options_specification ||= ""
22
+ @@options_specification ||= "
23
+ -H (--usage) ((Displays usage information for command.))
24
+ -Q (--really-quiet) ((Cause CVS to be really quiet.))
25
+ -q (--somewhat-quiet) ((Cause CVS to be somewhat quiet.))
26
+ -r (--read-only) ((Make checked-out files read-only.))
27
+ -w (--read-write) ((Make checked-out files read-write (default).))
28
+ -n (--pretend) ((Do not execute anything that will change the disk.))
29
+ -t (--trace) ((Show trace of program execution -- try with -n.))
30
+ -v (--version) ((CVS version and copyright.))
31
+ -T (--tmp) TMPDIR ((Use 'tmpdir' for temporary files.))
32
+ -e (--editor) EDITOR ((Use 'editor' for editing log information.))
33
+ -d (--cvsroot) CVSROOT ((Overrides $CVSROOT as the root of the CVS tree.))
34
+ -f (--no-cvsrc) ((Do not use the ~/.cvsrc file.))
35
+ -z (--compression) LEVEL ((Use compression level 'LEVEL' for net traffic.))
36
+ -a (--auth) ((Authenticate all net traffic.))
37
+ -s (--set) VAR=VAL ((Set CVS user variable.))
38
+ ".gsub(/^( +)/, '*PRE*\1')
39
+
40
+ def diffw ( files=[], options={} )
41
+ super
42
+ end
23
43
 
24
44
  end # class Cvs