Permalink
Browse files

Feature add:

* svn status -u (see files new or modified on remote not on local repo)
* svn update selected (only operate on selected files)
  • Loading branch information...
1 parent 0763680 commit 1f568f6854a04670ac540e6ef8b6cc08e6594d37 @dvwright committed Jun 27, 2012
Showing with 86 additions and 8 deletions.
  1. +1 −1 README.rdoc
  2. +5 −4 lib/svn_wc_broker.rb
  3. +58 −0 lib/svn_wc_client.rb
  4. +2 −2 svn_wc_tree.gemspec
  5. +20 −1 svn_wc_tree/js/swt.js
View
@@ -6,7 +6,7 @@ Subversion (SVN) repository. (See Requirements)
== VERSION:
-Version 0.0.9
+Version 0.0.10
NOTE: THIS IS ALPHA QUALITY SOFTWARE, use at your own risk!
View
@@ -33,9 +33,9 @@ module SvnWcBroker
#--
# this list gets 'evaled' is why
#++
- SUPPORTED_ACTIONS = %w(add commit delete info
- revert list ignore diff update
- status)
+ SUPPORTED_ACTIONS = %w(add commit delete info
+ revert list ignore diff update
+ status status_show_updates update_selected)
# set abs_path to your configuration file
def set_conf_file(conf) ; @conf_file = conf ; end
@@ -97,7 +97,7 @@ def do_requested_action(params)
end
# eval known actions only
# svn_list takes args # svn_status takes args
- if action == 'list' || action == 'status'
+ if action == 'list' || action == 'status' || action == 'status_show_updates'
eval("svn_#{action}('#{params['filter_re']}','#{params['filter_amt']}','#{params['dir']}')")
else
# NOTE only eval known supported actions
@@ -161,6 +161,7 @@ def ret_just_files_list(file_status_list) # :nodoc:
return file_status_list unless file_status_list.respond_to?('each')
file_status_list.each do |f_list_str|
f_stat, f_name = f_list_str.split(/\s/)
+ next if f_name == 'undefined' # yes the str undefined
just_files.push(f_name)
end
just_files
View
@@ -104,6 +104,46 @@ def svn_status(f_regex=nil, f_amt=nil, dir=nil)
repo_entries
end
+ # emulate a svn status -u
+ # returns entries on remote host not on local
+ # shows what files would be updated from an svn up
+
+ def svn_status_show_updates(f_regex=nil, f_amt=nil, dir=nil)
+ get_repo
+ repo_entries = Array.new
+ dir = @repo_root unless dir and not dir.empty?
+ # only way to test
+ # @error = "1.#{f_regex} 2.#{f_amt} 3.#{dir}"
+ # repo_entries.push info_data
+ @current_rev = nil
+ begin
+ @@svn_wc.info(dir).each do |r|
+ @current_rev = r[1] if r[0].to_s == 'rev'
+ end
+ rescue SvnWc::RepoAccessError => e
+ @error = e.message
+ repo_entries.push info_data
+ ensure
+ if @current_rev.nil?
+ @error = 'Error: Revision Unknown'
+ repo_entries.push info_data
+ end
+ end
+ svn_list(f_regex, f_amt, dir)
+ end
+
+ def not_new_rev(svn_e)
+ lcr = svn_e[:last_changed_rev] rescue nil
+ return true if lcr.nil?
+ enty = lcr[:entry]
+ return true if enty.nil?
+ # skip if file is on remote and local, we want remote only
+ return true if File.file?(enty) || File.directory?(enty)
+ # return false if is a new revision
+ return false if lcr > @current_rev
+ true
+ end
+ private :not_new_rev
# diff current to previous (HEAD only)
# returns diff content
@@ -181,6 +221,23 @@ def svn_update
remote_files
end
+ # update, returns 'updated' message, revision and update data
+ def svn_update_selected
+ get_repo
+ remote_files = Array.new
+ begin
+ @content = 'Updated: Revision '
+ @content << @@svn_wc.update(@files.to_s).to_a.join("\n")
+ remote_files.push info_data
+ #@error = "1.#{@files} 2.#{files}"
+ #remote_files.push info_data
+ rescue SvnWc::RepoAccessError => e
+ @error = e.message
+ remote_files.push info_data
+ end
+ remote_files
+ end
+
# delete
def svn_delete
get_repo
@@ -254,6 +311,7 @@ def svn_list(f_regex=nil, f_amt=nil, dir=nil)
begin
l_svn_list = Array.new
@@svn_wc.list(dir).each { |el|
+ next if not_new_rev(el) if @current_rev
status_info = {}
#fqpn = File.join(@repo_root, el[:entry])
fqpn = File.join(dir, el[:entry])
View
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = %q{svn_wc_tree}
- s.version = "0.0.9"
- s.date = %q{2012-02-07}
+ s.version = "0.0.10"
+ s.date = %q{2012-06-27}
s.authors = ["David Wright"]
s.email = %q{david_v_wright@yahoo.com}
s.summary = %q{svn_wc_tree is a web application (GUI) that enables
View
@@ -97,6 +97,17 @@ $(document).ready(function(){
},
separator_before : true
},
+ // svn status -u menu option
+ svn_status_u : {
+ label : 'svn status -u',
+ icon : '',
+ action : function (NODE, TREE_OBJ) {
+ SVN_ACTION = 'status_show_updates';
+ TREE_OBJ.callback('beforedata', [NODE, TREE_OBJ]);
+ $.tree.focused().refresh();//refresh does a http POST
+ },
+ separator_before : true
+ },
// svn update menu option
svn_update : {
label : "svn update",
@@ -105,6 +116,14 @@ $(document).ready(function(){
},
separator_before : true
},
+ // svn update menu option
+ svn_update_u : {
+ label : "svn update selected",
+ action : function (NODE, TREE_OBJ) {
+ post_req_svn_resp('update_selected');
+ },
+ separator_before : true
+ },
// svn diff menu option
svn_diff : {
label : 'svn diff',
@@ -416,7 +435,7 @@ $(document).ready(function(){
// just repo root sent, other files not seen!?
if (info[1] === undefined) abs_pn = info[1] + ' ' + info[0];
- svn_files.push(abs_pn);
+ if (abs_pn != undefined) svn_files.push(abs_pn);
}
//console.log(svn_files);
}

0 comments on commit 1f568f6

Please sign in to comment.