copernicium 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/RevLog.rb +1 -9
- data/lib/pushpull.rb +90 -231
- data/lib/repos.rb +35 -0
- data/lib/required.rb +1 -1
- data/lib/ui.rb +26 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd3e9247c74ce89252cccb9a53e801ffed973358
|
4
|
+
data.tar.gz: eb9c7868a7271ad1b679edea4532f5c1dac3265f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c2ad848204714087cc28d43cac3608dbeed48a874b1b47f287d68200a5fbc9436d7305909cb0d923e35d2600b5912103dde8bf832f7f384aab4ff3929e45c8
|
7
|
+
data.tar.gz: a5780ed3510d641f84ca8d80e9ef6573f65636ccdb91e9b8ff8f75f3f0a652d986acc0f9742f2134140dd6321f5c777caf452478a001d01b0defc7f13ca02337
|
data/lib/RevLog.rb
CHANGED
@@ -125,14 +125,6 @@ module Copernicium
|
|
125
125
|
File.open(@@log_path, 'w') { |f| f.write(@@logmap.to_yaml) }
|
126
126
|
File.open(@@hash_path, 'w') { |f| f.write(@@hashmap.to_yaml) }
|
127
127
|
end
|
128
|
-
|
129
|
-
# def RevLog.alterFile(fileObject, fileReferenceString, versionReferenceString)
|
130
|
-
# end
|
131
|
-
|
132
|
-
# def RevLog.deleteFileVersion(fileReferenceString, versionReferenceString)
|
133
|
-
# end
|
134
|
-
|
135
|
-
# def RevLog.viewFileHistory(fileReferenceString)
|
136
|
-
# end
|
137
128
|
end
|
138
129
|
end
|
130
|
+
|
data/lib/pushpull.rb
CHANGED
@@ -2,39 +2,56 @@
|
|
2
2
|
# CSC 253
|
3
3
|
# PushPull Module
|
4
4
|
# November 6, 2015
|
5
|
-
|
5
|
+
#
|
6
|
+
# How to use for Push, Pull and Clone:
|
7
|
+
# Push - cn push <user> <repo.host:/dir/of/repo> <branch-name>
|
8
|
+
# Pull - cn pull <user> <repo.host:/dir/of/repo> <branch-name>
|
9
|
+
# Clone - cn clone <user> <repo.host:/dir/of/repo>
|
10
|
+
# assumes that the user has ssh keys to the remote server setup
|
6
11
|
|
7
12
|
module Copernicium
|
8
|
-
|
9
|
-
# Push - cn push <user> <repo.host:/dir/of/repo> <branch-name>
|
10
|
-
# Pull - cn pull <user> <repo.host:/dir/of/repo> <branch-name>
|
11
|
-
# Clone - cn clone <user> <repo.host:/dir/of/repo>
|
12
|
-
class UIComm
|
13
|
-
end
|
14
|
-
|
13
|
+
include Workspace
|
15
14
|
module PushPull
|
16
|
-
include Repos # needed for calling their methods
|
17
|
-
# Chris's edit
|
18
|
-
# Takes in Ethan's UICommandCommunicator object and calls
|
19
|
-
# a method based on the command
|
20
|
-
#
|
21
15
|
# Fields in UIComm and what they are for me:
|
22
16
|
# @opts - user
|
23
17
|
# @repo - repo.host:/path/to/repo
|
18
|
+
# @repo - :/path/to/repo
|
24
19
|
# @rev - branch name
|
25
|
-
def PushPull.UICommandParser(
|
26
|
-
|
20
|
+
def PushPull.UICommandParser(comm)
|
21
|
+
# handle parsing out remote info
|
22
|
+
remote = comm.repo.split(':')
|
23
|
+
if remote.length == 2
|
24
|
+
@@host = remote[0]
|
25
|
+
@@path = remote[1]
|
26
|
+
elsif remote.length == 1
|
27
|
+
@@host = "cycle3.csug.rochester.edu"
|
28
|
+
@@path = remote[0].sub!(/^:/, '')
|
29
|
+
else
|
30
|
+
raise 'Remote host information not given'.red
|
31
|
+
end
|
32
|
+
|
33
|
+
@@user = comm.opts
|
34
|
+
case comm.command
|
27
35
|
when "clone"
|
28
|
-
clone
|
36
|
+
clone
|
29
37
|
when "push"
|
30
|
-
push
|
38
|
+
push
|
31
39
|
when "pull"
|
32
|
-
pull
|
40
|
+
pull
|
41
|
+
when 'test'
|
42
|
+
# avoid error while doing unit testing
|
33
43
|
else
|
34
44
|
raise "Error: Invalid command supplied to PushPull".red
|
35
45
|
end
|
36
46
|
end
|
37
47
|
|
48
|
+
# tell user to set up their ssh keys
|
49
|
+
def connection_failure(str = '')
|
50
|
+
puts "Connection error while: ".red + str
|
51
|
+
puts "Make sure SSH keys are setup.".yel
|
52
|
+
false
|
53
|
+
end
|
54
|
+
|
38
55
|
# Function: connect()
|
39
56
|
#
|
40
57
|
# Description:
|
@@ -43,58 +60,13 @@ module Copernicium
|
|
43
60
|
#
|
44
61
|
# remote: the remote server, formatted "my.server"
|
45
62
|
# user: the user to connect as
|
46
|
-
def PushPull.connect
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Net::SSH.start(remote, user) do |ssh|
|
53
|
-
puts ssh.exec!("echo Successful Connection!")
|
54
|
-
exit_code = true
|
55
|
-
end
|
56
|
-
rescue
|
57
|
-
begin
|
58
|
-
print "Username for remote repo?: "
|
59
|
-
user = (STDIN.readline).strip
|
60
|
-
|
61
|
-
print "Password for #{user}: "
|
62
|
-
passwd = (STDIN.noecho(&:gets)).strip
|
63
|
-
puts
|
64
|
-
|
65
|
-
Net::SSH.start(remote, user, :password => passwd) do |ssh|
|
66
|
-
puts ssh.exec!("echo Successful Connection!")
|
67
|
-
exit_code = true
|
68
|
-
end
|
69
|
-
rescue
|
70
|
-
raise "Unsuccessful Connection".red
|
71
|
-
end
|
72
|
-
end
|
73
|
-
else
|
74
|
-
begin
|
75
|
-
Net::SSH.start(remote, user) do |ssh|
|
76
|
-
yield ssh
|
77
|
-
end
|
78
|
-
exit_code = true
|
79
|
-
rescue
|
80
|
-
begin
|
81
|
-
print "Username for remote repo: "
|
82
|
-
user = (STDIN.readline).strip
|
83
|
-
|
84
|
-
print "Password for #{user}: "
|
85
|
-
passwd = (STDIN.noecho(&:gets)).strip
|
86
|
-
puts
|
87
|
-
|
88
|
-
Net::SSH.start(remote, user, :password => passwd) do |ssh|
|
89
|
-
yield ssh
|
90
|
-
end
|
91
|
-
exit_code = true
|
92
|
-
rescue
|
93
|
-
raise "Unable to execute command!".red
|
94
|
-
end
|
95
|
-
end
|
63
|
+
def PushPull.connect
|
64
|
+
begin
|
65
|
+
Net::SSH.start(@@host, @@user) { |scp| yield scp }
|
66
|
+
true
|
67
|
+
rescue
|
68
|
+
connection_failure 'trying to execute a command'
|
96
69
|
end
|
97
|
-
return exit_code
|
98
70
|
end
|
99
71
|
|
100
72
|
# Function: transfer()
|
@@ -104,29 +76,12 @@ module Copernicium
|
|
104
76
|
#
|
105
77
|
# remote: the remote server and directory to pull from, formatted "my.server"
|
106
78
|
# user: the user to connect as
|
107
|
-
def PushPull.transfer
|
108
|
-
exit_code = false
|
79
|
+
def PushPull.transfer
|
109
80
|
begin
|
110
|
-
Net::SCP.start(
|
111
|
-
|
112
|
-
end
|
113
|
-
exit_code = true
|
81
|
+
Net::SCP.start(@@host, @@user) { |scp| yield scp }
|
82
|
+
true
|
114
83
|
rescue
|
115
|
-
|
116
|
-
print "Username for remote repo: "
|
117
|
-
user = (STDIN.readline).strip
|
118
|
-
|
119
|
-
print "Password for #{user}: "
|
120
|
-
passwd = (STDIN.noecho(&:gets)).strip
|
121
|
-
puts
|
122
|
-
|
123
|
-
Net::SCP.start(remote, user, :passwd => passwd) do |scp|
|
124
|
-
yield scp
|
125
|
-
end
|
126
|
-
exit_code = true
|
127
|
-
rescue
|
128
|
-
raise "Unable to upload file!".red
|
129
|
-
end
|
84
|
+
connection_failure 'trying to upload a file'
|
130
85
|
end
|
131
86
|
end
|
132
87
|
|
@@ -139,56 +94,25 @@ module Copernicium
|
|
139
94
|
# dest: what we want of the branch, not needed for blocked calls
|
140
95
|
# local: where we want to put the file, not needed for blocked calls
|
141
96
|
# user: the user to connect as
|
142
|
-
def PushPull.fetch(
|
143
|
-
|
144
|
-
if(block.nil?)
|
97
|
+
def PushPull.fetch(local = Dir.pwd, &block)
|
98
|
+
if block.nil? # we are cloning a repo in this section of code
|
145
99
|
begin
|
146
|
-
Net::SCP.start(
|
147
|
-
scp.download!(
|
148
|
-
end
|
149
|
-
exit_code = true
|
150
|
-
rescue
|
151
|
-
begin
|
152
|
-
print "Username for remote repo: "
|
153
|
-
user = (STDIN.readline).strip
|
154
|
-
|
155
|
-
print "Password for #{user}: "
|
156
|
-
passwd = (STDIN.noecho(&:gets)).strip
|
157
|
-
puts
|
158
|
-
|
159
|
-
Net::SCP.start(remote, user, :password => passwd) do |scp|
|
160
|
-
scp.download!(dest, local, :recursive => true)
|
161
|
-
end
|
162
|
-
exit_code = true
|
163
|
-
rescue
|
164
|
-
raise "Unable to fetch file(s)!".red
|
100
|
+
Net::SCP.start(@@host, @@user) do |scp|
|
101
|
+
scp.download!(@@path, local, :recursive => true)
|
165
102
|
end
|
103
|
+
true
|
104
|
+
rescue # no ssh keys are setup, die
|
105
|
+
connection_failure 'trying to copy a file'
|
166
106
|
end
|
167
|
-
|
107
|
+
|
108
|
+
else # fetch more than one file or folder
|
168
109
|
begin
|
169
|
-
Net::SCP.start(
|
170
|
-
|
171
|
-
end
|
172
|
-
exit_code = true
|
110
|
+
Net::SCP.start(@@host, @@user) { |scp| yield scp }
|
111
|
+
true
|
173
112
|
rescue
|
174
|
-
|
175
|
-
print "Username for remote repo: "
|
176
|
-
user = (STDIN.readline).strip
|
177
|
-
|
178
|
-
print "Password for #{user}: "
|
179
|
-
passwd = (STDIN.noecho(&:gets)).strip
|
180
|
-
puts
|
181
|
-
|
182
|
-
Net::SCP.start(remote, user, :password => passwd) do |scp|
|
183
|
-
yield scp
|
184
|
-
end
|
185
|
-
exit_code = true
|
186
|
-
rescue
|
187
|
-
raise "Unable to fetch file(s)!".red
|
188
|
-
end
|
113
|
+
connection_failure "trying to fetch files"
|
189
114
|
end
|
190
115
|
end
|
191
|
-
return exit_code
|
192
116
|
end
|
193
117
|
|
194
118
|
# Function: push()
|
@@ -199,52 +123,27 @@ module Copernicium
|
|
199
123
|
# remote: the remote server and directory to push to, formatted "my.server:/the/location/we/want"
|
200
124
|
# branch: the branch that we are pushing to
|
201
125
|
# user: the user to connect as
|
202
|
-
def PushPull.push
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
contents = contents.delete_if{|x| (x.eql? '.cn') || (x.eql? '.') || (x.eql? '..')}
|
214
|
-
end
|
215
|
-
|
216
|
-
# todo - check if branch exists on the remote server
|
217
|
-
# if so, dump contents and save a new commit saying pushed from user
|
218
|
-
# else, create branch and dump files, then make a new commit saying
|
219
|
-
# created branch
|
220
|
-
connect(dest[0], user) do |session|
|
221
|
-
session.exec!("cd #{dest[1]}")
|
222
|
-
result = session.exec!('ls .cn')
|
223
|
-
if(result.strip.eql? '')
|
224
|
-
puts 'remote directory not a Copernicium repo'
|
225
|
-
return
|
226
|
-
end
|
227
|
-
session.exec!("cn branch .temp_push_#{user}")
|
228
|
-
session.exec!("find . ! -name \".cn\" -exec rm -r {} \\;")
|
229
|
-
|
230
|
-
# Move the files over to the remote branch
|
231
|
-
transfer(dest[0], user) do |scp|
|
232
|
-
contents.each do |x|
|
233
|
-
scp.upload!(Dir.pwd+'/'+x, dest[1], :recursive => true)
|
234
|
-
end
|
126
|
+
def PushPull.push
|
127
|
+
transfer do |session|
|
128
|
+
# uploading our history to remote
|
129
|
+
session.upload!("#{Dir.pwd}/.cn/history",
|
130
|
+
"#{@@path}/.cn/merging_#{@@user}")
|
131
|
+
|
132
|
+
# uploading our .cn info to remote
|
133
|
+
%w{revs snap}.each do |file|
|
134
|
+
session.upload!("#{Dir.pwd}/.cn/#{file}",
|
135
|
+
"#{@@path}/.cn/#{file}",
|
136
|
+
:recursive => true)
|
235
137
|
end
|
138
|
+
end # session
|
236
139
|
|
237
|
-
|
238
|
-
session.exec!(
|
239
|
-
session.exec!(
|
240
|
-
session.exec!("cn checkout #{branch}")
|
241
|
-
session.exec!("cn merge .temp_push_#{user}")
|
242
|
-
session.exec!("cn branch -d .temp_push_#{user}")
|
140
|
+
connect do |session|
|
141
|
+
session.exec!("cd #{@@path}")
|
142
|
+
puts session.exec!("cn update #{@@user}")
|
243
143
|
end
|
244
|
-
|
245
|
-
puts "Successfully pushed to #{remote}"
|
246
144
|
end
|
247
145
|
|
146
|
+
|
248
147
|
# Function: pull()
|
249
148
|
#
|
250
149
|
# Description:
|
@@ -253,56 +152,24 @@ module Copernicium
|
|
253
152
|
# remote: the remote server and directory to push to, formatted "my.server:/the/location/we/want"
|
254
153
|
# branch: the branch that we are pushing to
|
255
154
|
# user: the user to connect as
|
256
|
-
def PushPull.pull
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
else
|
268
|
-
contents = contents.delete_if{|x| (x.eql? '.cn') || (x.eql? '.') || (x.eql? '..')}
|
269
|
-
end
|
270
|
-
|
271
|
-
# create a new branch and clean it in prep for the incoming files
|
272
|
-
system "cn branch .temp_pull_#{user}"
|
273
|
-
contents.each do |x|
|
274
|
-
system "rm -r #{x}"
|
275
|
-
end
|
276
|
-
|
277
|
-
# get the file list from the remote directory
|
278
|
-
connect(dest[0], user) do |session|
|
279
|
-
session.exec!("cd #{dest[1]}")
|
280
|
-
session.exec!("cn checkout #{branch}")
|
281
|
-
collection = session.exec!("ls | cat")
|
282
|
-
end
|
283
|
-
|
284
|
-
collection = collection.split('\n')
|
285
|
-
if(!collection.include? '.cn')
|
286
|
-
puts 'failed to pull from remote, remote folder not an initialized Copernicium repo'
|
287
|
-
return
|
288
|
-
else
|
289
|
-
collection = collection.delete_if{|x| (x.eql? '.cn') || (x.eql? '.') || (x.eql? '..')}
|
290
|
-
end
|
291
|
-
|
292
|
-
# fetch the files from the remote directory and merge them to the branch
|
293
|
-
fetch(dest[0], nil, nil, user) do |scp|
|
294
|
-
collection.each do |x|
|
295
|
-
scp.download!(dest[1]+'/'+x, Dir.pwd, :recursive => true)
|
155
|
+
def PushPull.pull
|
156
|
+
fetch do |session|
|
157
|
+
# uploading our history to remote
|
158
|
+
session.download!("#{@@path}/.cn/merging_#{@@user}",
|
159
|
+
"#{Dir.pwd}/.cn/history")
|
160
|
+
|
161
|
+
# uploading our .cn info to remote
|
162
|
+
%w{revs snap}.each do |file|
|
163
|
+
session.download!("#{@@path}/.cn/#{file}",
|
164
|
+
"#{Dir.pwd}/.cn/#{file}",
|
165
|
+
:recursive => true)
|
296
166
|
end
|
297
167
|
end
|
298
|
-
system "cn
|
299
|
-
|
300
|
-
system "cn checkout #{crbr}"
|
301
|
-
system "cn merge .temp_pull_#{user}"
|
302
|
-
system "cn branch -d .temp_pull_#{user}"
|
303
|
-
puts "Successfully pulled from #{remote}"
|
168
|
+
system "cn update", @@user
|
169
|
+
puts "Remote #{@@repo} pulled.".grn
|
304
170
|
end
|
305
171
|
|
172
|
+
|
306
173
|
# Function: clone()
|
307
174
|
#
|
308
175
|
# Description:
|
@@ -310,20 +177,12 @@ module Copernicium
|
|
310
177
|
#
|
311
178
|
# remote: the remote server and directory to push to, formatted "my.server:/the/location/we/want"
|
312
179
|
# user: the user to connect as
|
313
|
-
def PushPull.clone
|
314
|
-
exit_code = false
|
315
|
-
dest = remote.split(':')
|
316
|
-
if(dest.length != 2)
|
317
|
-
dest = dest.insert(0, "cycle3.csug.rochester.edu")
|
318
|
-
end
|
180
|
+
def PushPull.clone
|
319
181
|
begin
|
320
|
-
fetch
|
321
|
-
exit_code = true
|
182
|
+
PushPull.fetch
|
322
183
|
rescue
|
323
|
-
|
184
|
+
connection_failure 'trying to clone a repo'
|
324
185
|
end
|
325
|
-
|
326
|
-
return exit_code
|
327
186
|
end
|
328
187
|
end
|
329
188
|
end
|
data/lib/repos.rb
CHANGED
@@ -262,6 +262,41 @@ module Copernicium
|
|
262
262
|
@@history.delete(branch)
|
263
263
|
update_history
|
264
264
|
end
|
265
|
+
|
266
|
+
# FOR PUSHPULL UPDATE
|
267
|
+
def Repos.update(comm = UIComm.new)
|
268
|
+
merge_name = File.join(@@copn,'merging_',comm.ops)
|
269
|
+
status = "Remote is either up-to-date or ahead of local"
|
270
|
+
|
271
|
+
if File.exist?(merge_name)
|
272
|
+
merger = YAML.load File.read(merge_name)
|
273
|
+
|
274
|
+
# merge @@history with merger hash
|
275
|
+
merger.each do |key, val|
|
276
|
+
if @@history.keys.include? key
|
277
|
+
val.each_with_index do |snap, index|
|
278
|
+
if @@history[key][index].nil?
|
279
|
+
@@history[key] += val[index..-1]
|
280
|
+
status = "Updated remote successfully"
|
281
|
+
elsif @@history[key][index] == snap
|
282
|
+
next
|
283
|
+
elsif @@history[key][index] != snap
|
284
|
+
@@history[key] += val[index..-1]
|
285
|
+
status = "Merged remote history with local"
|
286
|
+
end
|
287
|
+
end
|
288
|
+
else
|
289
|
+
@@history[key] = val
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
File.delete(merge_name)
|
294
|
+
update_history
|
295
|
+
puts status
|
296
|
+
else
|
297
|
+
puts 'Error updating: '.red + merge_name + 'doesnt exist.'
|
298
|
+
end
|
299
|
+
end # update
|
265
300
|
end # Repos
|
266
301
|
end # Copernicium
|
267
302
|
|
data/lib/required.rb
CHANGED
@@ -15,7 +15,7 @@ require 'net/scp' # Needed for file transfer between servers
|
|
15
15
|
require_relative 'banners'
|
16
16
|
require_relative 'RevLog'
|
17
17
|
require_relative 'repos'
|
18
|
-
require_relative 'pushpull'
|
19
18
|
require_relative 'workspace'
|
19
|
+
require_relative 'pushpull'
|
20
20
|
require_relative 'ui'
|
21
21
|
|
data/lib/ui.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# user interface module - parse and execute commands
|
2
2
|
# integrates all modules, central module
|
3
3
|
|
4
|
-
VERSION = "0.1.
|
4
|
+
VERSION = "0.1.2"
|
5
5
|
|
6
6
|
module Copernicium
|
7
7
|
# Communication object that will pass commands to backend modules
|
@@ -52,6 +52,8 @@ module Copernicium
|
|
52
52
|
# create the cn project, else already in one
|
53
53
|
if cmd == 'init'
|
54
54
|
noroot?? init(args) : puts(IN_REPO_WARNING.yel, getroot)
|
55
|
+
elsif cmd == 'clone' # allow cloning a new repo
|
56
|
+
clone args
|
55
57
|
elsif noroot? # if not in a repo, warn them, tell how to create
|
56
58
|
puts NO_REPO_WARNING.yel
|
57
59
|
else # now, assume we are in a copernicum project
|
@@ -67,8 +69,6 @@ module Copernicium
|
|
67
69
|
branch args
|
68
70
|
when 'clean'
|
69
71
|
clean args
|
70
|
-
when 'clone'
|
71
|
-
clone args
|
72
72
|
when 'commit'
|
73
73
|
commit args
|
74
74
|
when 'checkout'
|
@@ -79,6 +79,8 @@ module Copernicium
|
|
79
79
|
push args
|
80
80
|
when 'pull'
|
81
81
|
pull args
|
82
|
+
when 'update'
|
83
|
+
update args
|
82
84
|
when 'init'
|
83
85
|
# fall through - init handled above, before case statement
|
84
86
|
else # handle an unrecognized argument, show help and exit
|
@@ -249,23 +251,16 @@ module Copernicium
|
|
249
251
|
ui
|
250
252
|
end
|
251
253
|
|
254
|
+
# usage: cn clone <user> <repo.host:/dir/of/repo>
|
252
255
|
def clone(args)
|
253
|
-
|
254
|
-
|
255
|
-
user = args.first
|
256
|
-
if user.nil?
|
257
|
-
user = get "username for clone"
|
258
|
-
# Make sure username is first arg, since PushPull is expecting this.
|
259
|
-
args << user
|
260
|
-
end
|
256
|
+
user = args.shift
|
257
|
+
user = get "username for clone" if user.nil?
|
261
258
|
|
262
|
-
repo = args
|
263
|
-
repo = get "
|
259
|
+
repo = args.first
|
260
|
+
repo = get "url to clone (format: <repo.host:/dir/of/repo>)" if repo.nil?
|
264
261
|
|
265
|
-
comm = UIComm.new(command: 'clone', opts:
|
266
|
-
# Do the clone
|
262
|
+
comm = UIComm.new(command: 'clone', opts: user, repo: repo)
|
267
263
|
PushPull.UICommandParser(comm)
|
268
|
-
|
269
264
|
comm
|
270
265
|
end
|
271
266
|
|
@@ -297,7 +292,7 @@ module Copernicium
|
|
297
292
|
|
298
293
|
def merge(args)
|
299
294
|
if args.empty?
|
300
|
-
rev = get '
|
295
|
+
rev = get 'branch to merge'
|
301
296
|
else
|
302
297
|
rev = args.first
|
303
298
|
end
|
@@ -305,21 +300,23 @@ module Copernicium
|
|
305
300
|
# If rev is a branch name, resolve it to a rev ID.
|
306
301
|
if Repos.has_branch? rev
|
307
302
|
rev = (Repos.history rev).last
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
# If there were any conflicts, display them to the user.
|
313
|
-
if not conflicts.nil?
|
314
|
-
|
315
|
-
conflicts.each do |conflict|
|
316
|
-
puts " #{conflict}".red
|
303
|
+
conflicts = Workspace.merge(rev)
|
304
|
+
unless conflicts.nil?
|
305
|
+
conflicts.each { |conflict| puts "Conflict: ".red + conflict }
|
317
306
|
end
|
307
|
+
else # branch not found
|
308
|
+
puts "Branch not found: ".red + rev
|
318
309
|
end
|
310
|
+
end
|
319
311
|
|
320
|
-
|
321
|
-
|
312
|
+
def update(args)
|
313
|
+
if args.empty?
|
314
|
+
username = get "user to update to"
|
315
|
+
else
|
316
|
+
username = args.first
|
317
|
+
end
|
318
|
+
Repos.update(UIComm.new(command: 'update', ops: username))
|
322
319
|
end
|
323
320
|
end # Driver
|
324
|
-
end
|
321
|
+
end # Copernicium
|
325
322
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copernicium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Copernicium
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|