
https://svn.lrde.epita.fr/svn/lrdetools/trunk Index: ChangeLog from Nicolas Pouillard <ertai@lrde.epita.fr> Add --force to common_commit. * vcs/lib/vcs/common_commit.rb: The --force option bypass the rule with unrecognized files. Inform the user that an update is done. Make the message for +commited files shorter. common_commit.rb | 26 +++++++++++++++++++------- 1 files changed, 19 insertions(+), 7 deletions(-) Index: vcs/lib/vcs/common_commit.rb --- vcs/lib/vcs/common_commit.rb (revision 272) +++ vcs/lib/vcs/common_commit.rb (working copy) @@ -11,8 +11,12 @@ raise Failure, "No `#{CL}', you are probably not in a valid directory." end + force = opts[:force] + opts.delete :force + @@subject_format = subject_format + logger.info { 'Updating your working copy...' } update! have_unrecognized_files = false @@ -24,7 +28,7 @@ end end if have_unrecognized_files - raise Failure, " + message = " |You have unrecognized files in your working copy! |This meant that these files won't be commited! |You have some solutions to comply with the rule: @@ -43,9 +47,15 @@ | ------------ .vcs ------------ |- You can also perform a partial commit and specify which files | and directories commit. For example this command: - | #{@command} commit foo.c bar/ + | #{@cmd.command} commit foo.c bar/ | - |Commit failed".head_cut! + |".head_cut! + if force + logger.warn { message } + else + logger.error { message } + commit_failed + end end Vcs.commited = edit_form!(files) @@ -82,23 +92,25 @@ block[iform['subject']] if block_given? - logger.info 'Deleting junk files...' + logger.info { 'Deleting junk files...' } TMP_CL.delete if TMP_CL.exist? destdir = '+commited'.to_path/iform['revision'].to_s destdir.mkpath unless destdir.directory? + moved = PathList.new [LogEntry, Form, IForm, Message, MAIL, NEWS].each do |path| next unless path.exist? dest = destdir/path - logger.info "Moving `#{path}' to `#{dest}'..." + moved << path path.rename(dest) end + logger.info { "Moving `#{moved.join('\', `')}' to `#{destdir}'..." } end protected :common_commit! def commit_failed ( ex=nil ) - logger.error "Aborting #{ex}" - logger.info 'You can rerun the same command to resume the commit' + logger.error { "Aborting #{ex}" } + logger.info { 'You can rerun the same command to resume the commit' } raise 'Commit failed' end