copernicium 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pushpull.rb +7 -4
- data/lib/repos.rb +36 -19
- data/lib/ui.rb +1 -1
- data/lib/workspace.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb6fba68a58e08a40c7ce16a1e17bc9eccfbffe
|
4
|
+
data.tar.gz: a758b66457ad81b6a60678250154d71d3f85d448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb0f72fc70a568d58573e0e245955694c2e9bffc7e4356058fedd7274b9999268496dd35e428f0bd670070309e31c70094490561901bd370a8ab283d4641be2
|
7
|
+
data.tar.gz: 9c31d2562c0e248161c60ee7e2f0ad6c84c29a04d80764dc0ef40ae9d4edb63e7c2f431da39c591369f79197b2785525c54a5a69b095abef18ae822f690dcf44
|
data/lib/pushpull.rb
CHANGED
@@ -22,7 +22,7 @@ module Copernicium
|
|
22
22
|
@@host = remote[0]
|
23
23
|
@@path = remote[1]
|
24
24
|
elsif remote.length == 1
|
25
|
-
@@host = "
|
25
|
+
@@host = "cycle1.csug.rochester.edu"
|
26
26
|
@@path = remote.first
|
27
27
|
else
|
28
28
|
raise 'Remote host information not given.'.red
|
@@ -129,6 +129,7 @@ module Copernicium
|
|
129
129
|
#
|
130
130
|
# Description:
|
131
131
|
# pushes local changes on the current branch to a remote branch
|
132
|
+
#
|
132
133
|
def PushPull.ppush
|
133
134
|
begin
|
134
135
|
PushPull.transfer do |ssh|
|
@@ -146,6 +147,7 @@ module Copernicium
|
|
146
147
|
|
147
148
|
PushPull.connect do |ssh|
|
148
149
|
puts ssh.exec! "cd #{@@path} && cn update #{@@user}"
|
150
|
+
puts ssh.exec! "cd #{@@path} && cn checkout head"
|
149
151
|
end
|
150
152
|
rescue => error
|
151
153
|
connection_failure "trying to push files", error
|
@@ -163,17 +165,18 @@ module Copernicium
|
|
163
165
|
begin
|
164
166
|
PushPull.fetch do |session|
|
165
167
|
# uploading our history to remote
|
166
|
-
session.download!("#{@@path}/.cn/
|
167
|
-
"#{Dir.pwd}/.cn/
|
168
|
+
session.download!( "#{@@path}/.cn/history",
|
169
|
+
"#{Dir.pwd}/.cn/merging_#{@@user}")
|
168
170
|
|
169
171
|
# uploading our .cn info to remote
|
170
172
|
%w{revs snap}.each do |file|
|
171
173
|
session.download!("#{@@path}/.cn/#{file}",
|
172
174
|
"#{Dir.pwd}/.cn/",
|
173
|
-
|
175
|
+
:recursive => true)
|
174
176
|
end
|
175
177
|
end
|
176
178
|
system "cn update", @@user
|
179
|
+
system "cn checkout head"
|
177
180
|
puts "Remote pulled: ".grn + @@host + @@path
|
178
181
|
rescue => error
|
179
182
|
connection_failure "trying to pull files", error
|
data/lib/repos.rb
CHANGED
@@ -263,38 +263,55 @@ module Copernicium
|
|
263
263
|
update_history
|
264
264
|
end
|
265
265
|
|
266
|
+
# only append commits that arent already in there
|
267
|
+
# thus - the order is not the same, but that is ok
|
268
|
+
# bc each snapshot in our repo is atomic, not diffed
|
269
|
+
# snap here is the id of a specific commit id
|
270
|
+
# todo - optionally sort these by timestamp, sync
|
271
|
+
def Repos.merge_history(branch, hist)
|
272
|
+
hist.each do |snap|
|
273
|
+
@@history[branch] << snap unless @@history[branch].include? snap
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
266
277
|
# FOR PUSHPULL UPDATE
|
278
|
+
# - give a comm with username hist to merge
|
267
279
|
def Repos.update(comm = UIComm.new)
|
268
|
-
merge_name = File.join(@@copn, 'merging_'+comm.opts)
|
280
|
+
merge_name = File.join(@@copn, 'merging_' + comm.opts)
|
269
281
|
status = "Remote is either up-to-date or ahead of local"
|
270
282
|
|
271
283
|
if File.exist?(merge_name)
|
272
|
-
|
273
|
-
|
274
|
-
# merge @@history with
|
275
|
-
|
276
|
-
if
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
284
|
+
branches = YAML.load File.read(merge_name)
|
285
|
+
|
286
|
+
# merge @@history with remote hash
|
287
|
+
branches.each do |branch, hist|
|
288
|
+
if Repos.has_branch? branch
|
289
|
+
hist.each_with_index do |snap, i|
|
290
|
+
|
291
|
+
# merger hist length is longer than ours
|
292
|
+
if @@history[branch][i].nil?
|
293
|
+
status = "Updated successfully"
|
294
|
+
Repos.merge_history branch, hist
|
295
|
+
break
|
296
|
+
|
297
|
+
# merger hist diverged from our system
|
298
|
+
elsif @@history[branch][i] != snap
|
285
299
|
status = "Merged remote history with local"
|
300
|
+
Repos.merge_history branch, hist
|
301
|
+
break
|
286
302
|
end
|
287
|
-
end
|
288
|
-
else
|
289
|
-
@@history[
|
303
|
+
end # will exit cleanly if we are more up-to-date
|
304
|
+
else # branch does not exist locally yet, copy
|
305
|
+
@@history[branch] = hist
|
290
306
|
end
|
291
307
|
end
|
292
308
|
|
309
|
+
puts 'Result: '.grn + status
|
293
310
|
File.delete(merge_name)
|
294
311
|
update_history
|
295
|
-
|
312
|
+
return status
|
296
313
|
else
|
297
|
-
puts 'Error updating: '.red + merge_name + '
|
314
|
+
puts 'Error updating: '.red + merge_name + ' does not exist.'
|
298
315
|
end
|
299
316
|
end # update
|
300
317
|
end # Repos
|
data/lib/ui.rb
CHANGED
data/lib/workspace.rb
CHANGED