blob: ecf35a48c74982dac7fc983f91cef779e16b6682 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../test_helper'
class TestRemotes < Test::Unit::TestCase
def setup
set_file_paths
end
def test_remote_fun
in_temp_dir do |path|
loc = Git.clone(@wbare, 'local')
rem = Git.clone(@wbare, 'remote')
r = loc.add_remote('testrem', rem)
Dir.chdir('remote') do
new_file('test-file1', 'blahblahblah1')
rem.add
rem.commit('master commit')
rem.branch('testbranch').in_branch('tb commit') do
new_file('test-file3', 'blahblahblah3')
rem.add
true
end
end
assert(!loc.status['test-file1'])
assert(!loc.status['test-file3'])
r.fetch
r.merge
assert(loc.status['test-file1'])
loc.merge(loc.remote('testrem').branch('testbranch'))
assert(loc.status['test-file3'])
#puts loc.remotes.map { |r| r.to_s }.inspect
#r.remove
#puts loc.remotes.inspect
end
end
def test_push
in_temp_dir do |path|
loc = Git.clone(@wbare, 'local')
rem = Git.clone(@wbare, 'remote')
r = loc.add_remote('testrem', rem)
loc.chdir do
new_file('test-file1', 'blahblahblah1')
loc.add
loc.commit('master commit')
loc.branch('testbranch').in_branch('tb commit') do
new_file('test-file3', 'blahblahblah3')
loc.add
true
end
end
assert(!rem.status['test-file1'])
assert(!rem.status['test-file3'])
loc.push('testrem')
assert(rem.status['test-file1'])
assert(!rem.status['test-file3'])
loc.push('testrem', 'testbranch')
rem.checkout('testbranch')
assert(rem.status['test-file1'])
assert(rem.status['test-file3'])
end
end
end
|