tekkub-fugit 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 3
3
+ :patch: 4
4
4
  :major: 0
data/fugit.gemspec CHANGED
@@ -1,15 +1,15 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{fugit}
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Tekkub"]
7
- s.date = %q{2009-02-17}
7
+ s.date = %q{2009-02-18}
8
8
  s.default_executable = %q{fugit}
9
9
  s.description = %q{A cross-platform replacement for git-gui based on wxruby}
10
10
  s.email = %q{tekkub@gmail.com}
11
11
  s.executables = ["fugit"]
12
- s.files = ["fugit.gemspec", "SciTE.properties", "VERSION.yml", "bin/fugit", "lib/fugit", "lib/fugit/commit.rb", "lib/fugit/commit_tab.rb", "lib/fugit/console.rb", "lib/fugit/diff.rb", "lib/fugit/graph_renderer.rb", "lib/fugit/history_list.rb", "lib/fugit/history_tab.rb", "lib/fugit/icon_loader.rb", "lib/fugit/index_list.rb", "lib/fugit/main_frame.rb", "lib/fugit/messages.rb", "lib/fugit/SciTE.properties", "lib/fugit.rb", "lib/icons", "lib/icons/asterisk_yellow.png", "lib/icons/disk.png", "lib/icons/folder_add.png", "lib/icons/folder_delete.png", "lib/icons/page_add.png", "lib/icons/page_delete.png", "lib/icons/page_down.gif", "lib/icons/page_up.gif", "lib/icons/plus_minus.gif", "lib/icons/script.png", "lib/icons/script_add.png", "lib/icons/script_delete.png", "lib/icons/script_edit.png", "lib/icons/text_signature.png", "lib/icons/tick.png"]
12
+ s.files = ["fugit.gemspec", "SciTE.properties", "VERSION.yml", "bin/fugit", "lib/fugit", "lib/fugit/commit.rb", "lib/fugit/commit_tab.rb", "lib/fugit/console.rb", "lib/fugit/diff.rb", "lib/fugit/graph_renderer.rb", "lib/fugit/history_list.rb", "lib/fugit/history_tab.rb", "lib/fugit/icon_loader.rb", "lib/fugit/index_list.rb", "lib/fugit/io_get_line.rb", "lib/fugit/main_frame.rb", "lib/fugit/messages.rb", "lib/fugit/push_dialog.rb", "lib/fugit/SciTE.properties", "lib/fugit.rb", "lib/icons", "lib/icons/asterisk_yellow.png", "lib/icons/disk.png", "lib/icons/folder_add.png", "lib/icons/folder_delete.png", "lib/icons/page_add.png", "lib/icons/page_delete.png", "lib/icons/page_down.gif", "lib/icons/page_up.gif", "lib/icons/plus_minus.gif", "lib/icons/script.png", "lib/icons/script_add.png", "lib/icons/script_delete.png", "lib/icons/script_edit.png", "lib/icons/text_signature.png", "lib/icons/tick.png"]
13
13
  s.has_rdoc = true
14
14
  s.homepage = %q{http://github.com/tekkub/fugit}
15
15
  s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
data/lib/fugit/commit.rb CHANGED
@@ -96,7 +96,8 @@ module Fugit
96
96
  end
97
97
 
98
98
  def on_push_clicked
99
- `git push origin HEAD`
99
+ @push_dialog ||= PushDialog .new(self)
100
+ @push_dialog.show
100
101
  end
101
102
 
102
103
  end
@@ -0,0 +1,15 @@
1
+
2
+ class IO
3
+ def get_line
4
+ line = nil
5
+ while c = self.read(1)
6
+ if c == "\r" || c == "\n"
7
+ break if line
8
+ else
9
+ line ||= ""
10
+ line << c
11
+ end
12
+ end
13
+ line
14
+ end
15
+ end
@@ -0,0 +1,117 @@
1
+ include Wx
2
+
3
+ module Fugit
4
+ class PushDialog < Dialog
5
+ def initialize(parent)
6
+ super(parent, ID_ANY, "Push branches", :size => Size.new(350, 500))
7
+
8
+ @branch_list = CheckListBox.new(self, ID_ANY)
9
+ @log = TextCtrl.new(self, ID_ANY, :size => Size.new(20, 150), :style => TE_MULTILINE|TE_DONTWRAP|TE_READONLY)
10
+ @progress = Gauge.new(self, ID_ANY, 100, :size => Size.new(20, 20))
11
+
12
+ @remote = ComboBox.new(self, ID_ANY)
13
+
14
+ check_panel = Panel.new(self, ID_ANY)
15
+ @tag_check = CheckBox.new(check_panel, ID_ANY)
16
+ @force_check = CheckBox.new(check_panel, ID_ANY)
17
+
18
+ flex = FlexGridSizer.new(1,2,4,4)
19
+ flex.add(@tag_check, 0, EXPAND)
20
+ flex.add(StaticText.new(check_panel, ID_ANY, "Include tags"), 0, EXPAND)
21
+ flex.add(@force_check, 0, EXPAND)
22
+ flex.add(StaticText.new(check_panel, ID_ANY, "Force update"), 0, EXPAND)
23
+
24
+ check_panel.set_sizer(flex)
25
+
26
+ butt_sizer = create_button_sizer(OK|CANCEL)
27
+ butt_sizer.get_children.map {|s| s.get_window}.compact.each {|b| b.set_label(b.get_label == "OK" ? "Push" : "Close")}
28
+ evt_button(get_affirmative_id, :on_ok)
29
+
30
+ box = BoxSizer.new(VERTICAL)
31
+ box2 = BoxSizer.new(HORIZONTAL)
32
+
33
+ box2.add(@branch_list, 1, EXPAND|LEFT|RIGHT|BOTTOM, 4)
34
+ box2.add(check_panel, 1)
35
+
36
+ box.add(StaticText.new(self, ID_ANY, "Select branches:"), 0, EXPAND|ALL, 4)
37
+ box.add(box2, 1, EXPAND)
38
+ box.add(StaticText.new(self, ID_ANY, "Push to:"), 0, EXPAND|ALL, 4)
39
+ box.add(@remote, 0, EXPAND|LEFT|RIGHT|BOTTOM, 4)
40
+ box.add(StaticText.new(self, ID_ANY, "Output:"), 0, EXPAND|ALL, 4)
41
+ box.add(@log, 0, EXPAND|LEFT|RIGHT, 4)
42
+ box.add(@progress, 0, EXPAND|ALL, 4)
43
+ box.add(butt_sizer, 0, EXPAND|BOTTOM, 4)
44
+
45
+ self.set_sizer(box)
46
+ end
47
+
48
+ def show
49
+ branches = `git branch`
50
+ remotes = `git remote`
51
+ @remote.clear
52
+ remotes.split("\n").each {|r| @remote.append(r)}
53
+ @remote.set_value(@remote.get_string(0))
54
+ current = branches.match(/\* (.+)/).to_a.last
55
+ branches = branches.split("\n").map {|b| b.split(" ").last}
56
+ @branch_list.set(branches)
57
+ @branch_list.check(@branch_list.find_string(current)) if current
58
+
59
+ @progress.set_value(0)
60
+ @log.clear
61
+
62
+ super
63
+ end
64
+
65
+ def on_ok
66
+ @progress.set_value(0)
67
+ failed = false
68
+ last_line_type = nil
69
+
70
+ branches = @branch_list.get_checked_items.map {|i| @branch_list.get_string(i)}
71
+ tags = @tag_check.is_checked ? "--tags " : ""
72
+ force = @force_check.is_checked ? "--force " : ""
73
+ remote = @remote.get_value
74
+ command = "git push #{tags}#{force}#{remote} #{branches.join(" ")}"
75
+ @log.append_text("#{@log.get_last_position == 0 ? "" : "\n\n"}> #{command}")
76
+
77
+ IO.popen("#{command} 2>&1") do |io|
78
+ while line = io.get_line
79
+ last_line_type = case line
80
+ when "Everything up-to-date"
81
+ @progress.set_value(100)
82
+ update_log(last_line_type, nil, line)
83
+ when /Counting objects: \d+, done./
84
+ @progress.set_value(10)
85
+ update_log(last_line_type, :counting, line)
86
+ when /Counting objects: \d+/
87
+ update_log(last_line_type, :counting, line)
88
+ when /Compressing objects:\s+\d+% \((\d+)\/(\d+)\)/
89
+ @progress.set_value(10 + (45*$1.to_f/$2.to_f).to_i)
90
+ update_log(last_line_type, :compressing, line)
91
+ when /Writing objects:\s+\d+% \((\d+)\/(\d+)\)/
92
+ @progress.set_value(55 + (45*$1.to_f/$2.to_f).to_i)
93
+ update_log(last_line_type, :writing, line)
94
+ when /\[rejected\]/
95
+ failed = true
96
+ @progress.set_value(100)
97
+ update_log(last_line_type, nil, line)
98
+ else
99
+ update_log(last_line_type, nil, line)
100
+ end
101
+ end
102
+ end
103
+
104
+ #~ end_modal(ID_OK) if success
105
+ end
106
+
107
+ def update_log(last, current, line)
108
+ if last == current && !last.nil?
109
+ @log.replace(@log.xy_to_position(0, @log.get_number_of_lines - 1), @log.get_last_position, line)
110
+ else
111
+ @log.append_text("\n" + line)
112
+ end
113
+ current
114
+ end
115
+
116
+ end
117
+ end
data/lib/fugit.rb CHANGED
@@ -3,6 +3,7 @@ $:.unshift File.dirname(__FILE__)
3
3
 
4
4
  require 'wx'
5
5
 
6
+ require "fugit/io_get_line"
6
7
  require "fugit/messages"
7
8
  require "fugit/icon_loader"
8
9
  require "fugit/main_frame"
@@ -14,6 +15,7 @@ require "fugit/index_list"
14
15
  require "fugit/history_tab"
15
16
  require "fugit/graph_renderer"
16
17
  require "fugit/history_list"
18
+ require "fugit/push_dialog"
17
19
 
18
20
 
19
21
  version = File.exist?(File.join(File.dirname(__FILE__), "..", ".git")) ? "Developer's alpha" : Gem.searcher.find("fugit").version.to_s rescue "Unknown"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tekkub-fugit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tekkub
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-17 00:00:00 -08:00
12
+ date: 2009-02-18 00:00:00 -08:00
13
13
  default_executable: fugit
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -45,8 +45,10 @@ files:
45
45
  - lib/fugit/history_tab.rb
46
46
  - lib/fugit/icon_loader.rb
47
47
  - lib/fugit/index_list.rb
48
+ - lib/fugit/io_get_line.rb
48
49
  - lib/fugit/main_frame.rb
49
50
  - lib/fugit/messages.rb
51
+ - lib/fugit/push_dialog.rb
50
52
  - lib/fugit/SciTE.properties
51
53
  - lib/fugit.rb
52
54
  - lib/icons