[LrdeTools] 230: Status & User Configuration File.

https://svn.lrde.epita.fr/svn/lrdetools/trunk Index: ChangeLog from Nicolas Pouillard <ertai@lrde.epita.fr> Status & User Configuration File. * vcs/NEWS: Add this feature. * vcs/lib/vcs/status.rb: Override the default status to handle ignoring, and masking. * vcs/lib/vcs/changelog.rb, * vcs/lib/vcs/diff.rb: Do not treat files with 'U' and ',' status. * vcs/template/prj.rb: Adapt to common_commit v0.3. * vcs/template/HOWTO: Remove. Deprecated. * vcs/NEWS.FR: New. From an old news. NEWS | 19 ++++++++++ NEWS.FR | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/vcs/changelog.rb | 2 - lib/vcs/diff.rb | 2 - lib/vcs/status.rb | 25 ++++++++++++-- template/HOWTO | 49 --------------------------- template/prj.rb | 13 +++++-- 7 files changed, 142 insertions(+), 58 deletions(-) Index: vcs/lib/vcs/status.rb --- vcs/lib/vcs/status.rb (revision 229) +++ vcs/lib/vcs/status.rb (working copy) @@ -6,12 +6,31 @@ class Svn def from_status ( *args, &block ) - status(*args).each_line do |line| + status_(*args).each_line do |line| next unless line =~ /^.{5} / - m = /^(.)(.).(.).\s*(.*)$/.match(line) - block[*m.to_a] + m = /^(.)(.)(.)(.)(.\s*)(.*)$/.match(line) + line, file_st, bl1, prop_st, cpy, bl2, file = m.to_a + file = file.to_path + if file_st == '?' + if Vcs.user_conf_global_ignore(file) + # nothing ... + next + elsif Vcs.user_conf_global_unmask(file) + file_st = 'U' + elsif file.basename.to_s =~ /^,/ + file_st = ',' + end + end + line = "#{file_st}#{bl1}#{prop_st}#{cpy}#{bl2}#{file}" + block[line, file_st, prop_st, cpy, file] end end protected :from_status + def status! ( *args ) + from_status(*args) do |line, file_st, prop_st, cpy, file| + puts line + end + end + end # class Svn Index: vcs/template/prj.rb --- vcs/template/prj.rb (revision 229) +++ vcs/template/prj.rb (working copy) @@ -1,4 +1,6 @@ class Vcs + # See http://rubyforge.org/projects/vcs + # and http://vcs.rubyforge.org <% # Just type `erb prj.rb > a_file' and answer questions. STDERR.puts 'project name: ' @@ -9,14 +11,17 @@ short = STDIN.readline.chomp STDERR.puts 'to (emails, newsgroups...): ' to = STDIN.readline.chomp.split(/\s*,\s*/) + def tag ( s ) + '<' + "%= #{s} %" + '>' + end %> - def <%= project %>_commit! ( s, *args ) + def <%= project %>_commit! ( *args ) - common_commit!(*args) do |rev| + common_commit!("<%= tag 'rev' %>: <%= project %>: <%= tag 'title' %>", *args) do |subject| <% if type == 'news' %> - news!(:groups => <%=to.inspect%>, :subject => "#{rev}: <%=short%>: #{s}") + news!(:groups => <%= to.inspect %>, :subject => subject) <% elsif type == 'mail' %> - mail!(:to => <%= to.inspect %>, :subject => "#{rev}: <%=short%>: #{s}") + mail!(:to => <%= to.inspect %>, :subject => subject) <% end %> end Index: vcs/lib/vcs/changelog.rb --- vcs/lib/vcs/changelog.rb (revision 229) +++ vcs/lib/vcs/changelog.rb (working copy) @@ -23,7 +23,7 @@ def mkchangelog_from_status ( *args ) result = [] from_status(*args) do |line, file_st, prop_st, copy_st, file| - next if file_st =~ /[?X]/ + next if file_st =~ /[?XU,]/ next if file == 'ChangeLog' ls = [] ls << @@file_st[file_st] if @@file_st.has_key? file_st Index: vcs/lib/vcs/diff.rb --- vcs/lib/vcs/diff.rb (revision 229) +++ vcs/lib/vcs/diff.rb (working copy) @@ -8,7 +8,7 @@ def diffw_from_status! ( *args ) files = Set.new from_status(*args) do |line, file_st, prop_st, cpy, file| - next if file_st =~ /[?X]/ + next if file_st =~ /[?XU,]/ next if file == 'ChangeLog' files << Pathname.new(file) end Index: vcs/template/HOWTO --- vcs/template/HOWTO (revision 229) +++ vcs/template/HOWTO (working copy) @@ -1,49 +0,0 @@ ---- - -<% -# Just type `erb HOWTO > a_file' and answer questions. -STDERR.puts 'project name: ' -project = STDIN.readline.chomp -STDERR.puts 'type (news|mail): ' -type = STDIN.readline.chomp -STDERR.puts 'shortcut (lt, hc, ttk...): ' -short = STDIN.readline.chomp -%> - -Mini Vcs HOWTO: - - - Install Vcs: - - - From a package: - - - Install rubygems: http://rubyforge.org/frs/?group_id=126 - - - Install Vcs (as root): gem install vcs - - - From the svn repository: - - - Find a place to install it: - cd ~/local - - - Checkout Vcs: - svn co https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs - - - Update your PATH: - export PATH=$PATH:~/local/vcs/bin - - - If your shell is zsh: rehash - - - Check Vcs: - vcs --help - - - Make aliases: - `vcs --mk-alias` # Don't forget backquotes ! - - - Check the transparent mode: - svn status! - - - Commit in <%=project%>: - svn <%=project.downcase%>_commit 'Your <%=type%> subject' - - or: - svn <%=short%>ci 'Your <%=type%> subject' - Index: vcs/NEWS --- vcs/NEWS (revision 229) +++ vcs/NEWS (working copy) @@ -1,3 +1,20 @@ +New in 0.4 ...: + + * Status & User Configuration File: + >>>> ~/.vcsrc <<<< + --- + global_ignore: + - !re ,messages + - !re .*\.(diff|patch)$ + global_unmask: + - !re \bdoc + >>>> ~/.vcsrc <<<< + + - During a status files which match global_ignore regexps will not be + printed. + - Files which match global_unmask are prepend by 'U' + - Files which begins by `,' (vcs internal use) are prepend by ',' + New in 0.3 2005-09-16: * The help command now show all commands including vcs ones. @@ -7,3 +24,5 @@ * Improve the command running handling, vcs calls are now full stream based. * Add two commands `url' and `script'. * Improve the error handling. + +New in 0.2 2005-06: See NEWS Index: vcs/NEWS.FR --- vcs/NEWS.FR (revision 0) +++ vcs/NEWS.FR (revision 0) @@ -0,0 +1,90 @@ +>= 0.3: See NEWS + +Vcs passe en version 0.2: + + - Beaucoup de bugs ont �t� corrig�s: + + - Quelques commandes de svn provoquaient un warning. + + - L'entr�e du ChangeLog se retrouvait parfois dans le diff. + + - Dans certains cas il fallait supprimer le ,message. + + - Et d'autres... + + + - La robustesse a �t� grandement am�lior�e. + + + - Nouvelles fonctionnalit�s: + + - On peut d�sormais envoyer des mails sign�s avec GPG: + - > + Cela fait m�me partie la s�quence par d�faut, donc pr�parer vos + cl�s GPG. + + - Deux formats support�s: + - PGP/MIME + - PGP inline + + - V�rification de la configuration: > + L'option --check de Vcs vous aidera � configurer Vcs sur votre + machine. + + - R�sum� explicatif du contenue de chaque fichier sp�cial (,*). + + - Reprise sur erreur plus intuitive: > + Si une erreur se produit (serveur news/mail indisponible, diffstat + non install�...), il vous suffit de corriger le probl�me puis de + relancer la m�me commande qui va recommencer ou elle en �tait. + + - Ajout de plusieurs nouvelles m�thodes pour la gestion des conflits. + + - Le diff utilis� lors du commit est insensible au espaces. + + - Et plein d'autres trucs sympa pour vous faciliter la vie. + + + - Installation / Mise � jour: + + - Installation: + + - Rubygems: + - > + Vcs est distribu� sous la forme d'un paquet GEM (le syst�me de + paquet de Ruby), vous devez donc l'installer (si ce n'est pas + d�j� fait). + + - url: http://docs.rubygems.org/ + + - en root: + ruby setup.rb + + - Vcs (en root): + gem install vcs + + - Mise � jour (en root): + gem update + + + - Configuration: + + - V�rifiez que Vcs est correctement install�: + vcs --help + + - Mettez des alias pour svn/cvs/prcs: + - Ajouter dans votre conf zsh le **r�sulat** de cette commande: + vcs --mk-alias + + - V�rifiez que l'alias fonctionne: + svn st! # doit produire la m�me chose que "svn st" + + - V�rifiez votre configuration et suivez les instructions: + vcs --check + + - Pour voir les commandes propos�es par svn + vcs: + svn --help + +--- +Si vous avez des difficult�s � utiliser Vcs n'h�sitez pas � poser des +questions.
participants (1)
-
Nicolas Pouillard