git-process-lib 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
- # CHANGELOG - 2.0.2 #
1
+ # CHANGELOG - 2.0.4 #
2
+
3
+ ### Since 2.0.3 ###
4
+
5
+ * Fixed incompatibility with git 1.7 ([GH-128](https://github.com/jdigger/git-process/issues/128))
6
+
7
+ ### Since 2.0.2 ###
8
+
9
+ * Locked down dependencies due to a change in the "faraday" packages.
2
10
 
3
11
  ### Since 2.0.1 ###
4
12
 
@@ -558,6 +558,29 @@ module GitProc
558
558
  end
559
559
 
560
560
 
561
+ def set_upstream_branch(branch_name, upstream)
562
+ logger.info { "Setting upstream/tracking for branch '#{branch_name}' to '#{upstream}'." }
563
+
564
+ if has_a_remote?
565
+ parts = upstream.split(/\//)
566
+ if parts.length() > 1
567
+ potential_remote = parts.shift
568
+ if remote.remote_names.include?(potential_remote)
569
+ config["branch.#{branch_name}.remote"] = potential_remote
570
+ config["branch.#{branch_name}.merge"] = "refs/heads/#{parts.join('/')}"
571
+ end
572
+ else
573
+ config["branch.#{branch_name}.merge"] = "refs/heads/#{upstream}"
574
+ end
575
+ else
576
+ config["branch.#{branch_name}.merge"] = "refs/heads/#{upstream}"
577
+ end
578
+
579
+ # The preferred way assuming using git 1.8 cli
580
+ #command(:branch, ['--set-upstream-to', upstream, branch_name])
581
+ end
582
+
583
+
561
584
  private
562
585
 
563
586
 
@@ -642,13 +665,6 @@ module GitProc
642
665
  end
643
666
 
644
667
 
645
- def set_upstream_branch(branch_name, upstream)
646
- logger.info { "Setting upstream/tracking for branch '#{branch_name}' to '#{upstream}'." }
647
-
648
- command(:branch, ['--set-upstream-to', upstream, branch_name])
649
- end
650
-
651
-
652
668
  def sync_control_filename(branch_name)
653
669
  File.join(File.join(workdir, '.git'), "gitprocess-sync-#{remote.name}--#{branch_name}")
654
670
  end
@@ -14,7 +14,7 @@ module GitProc
14
14
  module Version
15
15
  MAJOR = 2
16
16
  MINOR = 0
17
- PATCH = 3
17
+ PATCH = 4
18
18
  BUILD = nil
19
19
 
20
20
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
data/local-build.rb CHANGED
@@ -15,10 +15,10 @@ for gem in gems
15
15
 
16
16
  %x[gem build #{gem}.gemspec]
17
17
  SystemExit.new($?) if $?.exitstatus
18
- end
19
18
 
20
- puts %x(gem install ./git-process-#{GitProc::Version::STRING}.gem -l -u)
21
- SystemExit.new($?) if $?.exitstatus
19
+ # puts %x(gem install ./#{gem}-#{GitProc::Version::STRING}.gem -l -u)
20
+ # SystemExit.new($?) if $?.exitstatus
22
21
 
23
- #puts %x(gem push ./git-process-#{GitProc::Version::STRING}.gem)
24
- #SystemExit.new($?) if $?.exitstatus
22
+ puts %x(gem push ./#{gem}-#{GitProc::Version::STRING}.gem)
23
+ SystemExit.new($?) if $?.exitstatus
24
+ end
data/spec/git_lib_spec.rb CHANGED
@@ -46,6 +46,43 @@ describe GitLib, :git_repo_helper do
46
46
  end
47
47
 
48
48
 
49
+ describe 'set_upstream_branch' do
50
+ include GitRepoHelper
51
+
52
+ it 'updates for remote branch' do
53
+ gitlib.branch('ba/bb', :base_branch => 'master')
54
+ clone_repo do |gl|
55
+ gl.checkout('new_branch', :new_branch => 'origin/master')
56
+ gl.set_upstream_branch('new_branch', 'origin/ba/bb')
57
+
58
+ gl.config['branch.new_branch.remote'].should == 'origin'
59
+ gl.config['branch.new_branch.merge'].should == 'refs/heads/ba/bb'
60
+ end
61
+ end
62
+
63
+
64
+ it 'updates for local branch' do
65
+ gitlib.branch('ba', :base_branch => 'master')
66
+ gitlib.checkout('new_branch', :new_branch => 'master')
67
+ gitlib.set_upstream_branch('new_branch', 'ba')
68
+
69
+ gitlib.config['branch.new_branch.remote'].should == nil
70
+ gitlib.config['branch.new_branch.merge'].should == 'refs/heads/ba'
71
+ end
72
+
73
+
74
+ it 'updates for local branch that looks remote' do
75
+ gitlib.branch('other/ba', :base_branch => 'master')
76
+ gitlib.checkout('new_branch', :new_branch => 'master')
77
+ gitlib.set_upstream_branch('new_branch', 'other/ba')
78
+
79
+ gitlib.config['branch.new_branch.remote'].should == nil
80
+ gitlib.config['branch.new_branch.merge'].should == 'refs/heads/other/ba'
81
+ end
82
+
83
+ end
84
+
85
+
49
86
  describe 'fetch' do
50
87
 
51
88
  it 'parse the list of changes' do
data/spec/sync_spec.rb CHANGED
@@ -1108,7 +1108,7 @@ describe Sync do
1108
1108
 
1109
1109
  it 'should fail if it is not subsumed by the remote' do
1110
1110
  Given do
1111
- @local.command(:remote, ['remove', 'origin'])
1111
+ @local.command(:remote, ['rm', 'origin'])
1112
1112
  end
1113
1113
 
1114
1114
  expect { when_sync_is_run(false) }.to raise_error(GitProcessError, /Specifying 'no_remote' does not make sense without a remote/)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-process-lib
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 3
10
- version: 2.0.3
9
+ - 4
10
+ version: 2.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Moore