ohloh_scm 3.0.11 → 3.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -6
- data/lib/ohloh_scm/bzr/activity.rb +1 -2
- data/lib/ohloh_scm/git/scm.rb +1 -1
- data/lib/ohloh_scm/git/validation.rb +1 -7
- data/lib/ohloh_scm/git_svn/activity.rb +2 -1
- data/lib/ohloh_scm/version.rb +1 -1
- data/spec/ohloh_scm/git/scm_spec.rb +21 -0
- data/spec/ohloh_scm/git/validation_spec.rb +0 -4
- data/spec/ohloh_scm/git_svn/activity_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5de328f7aa2d702317d87536410bc62dbe5ea5c9a88f9b617fc5739eb6b8847
|
4
|
+
data.tar.gz: 181c2b2ce676bae8f60f718a39106273f359fb07deb013a102c27f1585dfefd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2418c9ed3f8cd9e239e2f965793ee0c77cdd8c10e5384d6c91419873c90f5e3f4ee3f2ac3cd80305c1557af2340ac1e1d52cc68de595e905ef4eedff9ed5dbd7
|
7
|
+
data.tar.gz: 17148569eb0a811ecb1943d8f0e2639ba278828a28c14923da77d5970512cdf841be66e031967b81fe636ab80943d27aa02edb71f06d6bfe5529d589ce189aed
|
data/README.md
CHANGED
@@ -20,17 +20,13 @@ One may use Docker to run Ohloh SCM and test changes.
|
|
20
20
|
```sh
|
21
21
|
$ git clone https://github.com/blackducksoftware/ohloh_scm
|
22
22
|
$ cd ohloh_scm
|
23
|
-
$
|
23
|
+
$ docker build -t ohloh_scm:foobar .
|
24
24
|
|
25
25
|
# To run all tests, we need to start the ssh server and set UTF-8 locale for encoding tests.
|
26
26
|
$ cmd='/etc/init.d/ssh start; LANG=en_US.UTF-8 rake test 2> /dev/null'
|
27
|
-
$ docker run -P -v $(pwd):/home/app/ohloh_scm -ti
|
27
|
+
$ docker run --rm -P -v $(pwd):/home/app/ohloh_scm -ti ohloh_scm:foobar /bin/sh -c "$cmd"
|
28
28
|
# This mounts the current folder into the docker container;
|
29
29
|
# hence any edits made in ohloh_scm on the host machine would reflect in the container.
|
30
|
-
|
31
|
-
# One may also edit the Dockerfile & build the image locally for other distros.
|
32
|
-
$ docker build -t ohloh_scm:custom .
|
33
|
-
$ docker run -P -v $(pwd):/home/app/ohloh_scm -ti ohloh_scm:custom /bin/bash
|
34
30
|
```
|
35
31
|
|
36
32
|
## Development Setup
|
@@ -75,8 +75,7 @@ module OhlohScm
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def head_token
|
78
|
-
run("
|
79
|
-
" | grep ^revision-id | cut -f2 -d' '").strip
|
78
|
+
run("bzr log --limit 1 --show-id #{url} 2> /dev/null | grep ^revision-id | cut -f2 -d' '").strip
|
80
79
|
end
|
81
80
|
|
82
81
|
def head
|
data/lib/ohloh_scm/git/scm.rb
CHANGED
@@ -66,7 +66,7 @@ module OhlohScm
|
|
66
66
|
return if branch_name.to_s.empty?
|
67
67
|
return if activity.branches.include?(branch_name)
|
68
68
|
|
69
|
-
run "cd '#{url}' && git branch -f #{branch_name} origin/#{branch_name}"
|
69
|
+
run "cd '#{url}' && git remote update && git branch -f #{branch_name} origin/#{branch_name}"
|
70
70
|
end
|
71
71
|
|
72
72
|
# Deletes everything but the *.git* folder in the working directory.
|
@@ -3,16 +3,10 @@
|
|
3
3
|
module OhlohScm
|
4
4
|
module Git
|
5
5
|
class Validation < OhlohScm::Validation
|
6
|
-
def validate
|
7
|
-
super
|
8
|
-
@errors << [:branch_name, 'Invalid Branch Name.'] if scm.branch_name.to_s.empty?
|
9
|
-
end
|
10
|
-
|
11
6
|
private
|
12
7
|
|
13
8
|
def validate_server_connection
|
14
|
-
msg = "The server did not respond to the 'git-ls-remote' command."
|
15
|
-
msg << ' Are the URL and Branch fields correct?'
|
9
|
+
msg = "The server did not respond to the 'git-ls-remote' command. Is the URL correct?"
|
16
10
|
@errors << [:failed, msg] unless status.exist?
|
17
11
|
end
|
18
12
|
|
@@ -73,7 +73,8 @@ module OhlohScm
|
|
73
73
|
|
74
74
|
def cat(revision, file_path)
|
75
75
|
file_path = file_path.to_s
|
76
|
-
run("cd #{url} && git show #{revision}:#{file_path.shellescape}")
|
76
|
+
run("cd #{url} && git show #{revision}:#{file_path.shellescape} | #{string_encoder_path}")
|
77
|
+
.strip
|
77
78
|
end
|
78
79
|
|
79
80
|
def git_svn_log_cmd
|
data/lib/ohloh_scm/version.rb
CHANGED
@@ -33,6 +33,27 @@ describe 'Git::Scm' do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'must update branches in local copy' do
|
37
|
+
test_branch_name = 'test' # consider that 'test' is the current *main* branch.
|
38
|
+
|
39
|
+
with_git_repository('git_with_multiple_branch', test_branch_name) do |src_core|
|
40
|
+
tmpdir do |dest_dir|
|
41
|
+
core = OhlohScm::Factory.get_core(scm_type: :git, url: dest_dir, branch_name: test_branch_name)
|
42
|
+
core.scm.pull(src_core.scm, TestCallback.new)
|
43
|
+
|
44
|
+
# Emulate a scenario where the local copy doesn't have the current *main* branch.
|
45
|
+
`cd #{dest_dir} && git checkout master && git branch -D test`
|
46
|
+
|
47
|
+
local_branch_cmd = "cd #{dest_dir} && git branch | grep '\*' | sed 's/^\* //'"
|
48
|
+
`#{ local_branch_cmd }`.chomp.must_equal 'master'
|
49
|
+
|
50
|
+
# On doing a refetch, our local copy will now have the updated *main* branch.
|
51
|
+
core.scm.pull(src_core.scm, TestCallback.new)
|
52
|
+
`#{ local_branch_cmd }`.chomp.must_equal test_branch_name
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
36
57
|
it 'must test the basic conversion to git' do
|
37
58
|
with_cvs_repository('cvs', 'simple') do |src_core|
|
38
59
|
tmpdir do |dest_dir|
|
@@ -7,10 +7,6 @@ describe 'Git::Validation' do
|
|
7
7
|
core.errors.must_be :empty?
|
8
8
|
end
|
9
9
|
|
10
|
-
it 'must have errors for no branch_name' do
|
11
|
-
get_core(:git, branch_name: '').validation.send(:branch_name_errors).wont_be :empty?
|
12
|
-
end
|
13
|
-
|
14
10
|
it 'must have errors for invalid branch_name' do
|
15
11
|
get_core(:git, branch_name: 'x' * 81).validation.send(:branch_name_errors).wont_be :empty?
|
16
12
|
get_core(:git, branch_name: 'foo@bar').validation.send(:branch_name_errors).wont_be :empty?
|
@@ -60,7 +60,7 @@ describe 'GitSvn::Activity' do
|
|
60
60
|
|
61
61
|
it 'cat_file_with_invalid_filename' do
|
62
62
|
with_git_svn_repository('git_svn') do |git_svn|
|
63
|
-
|
63
|
+
assert git_svn.activity.cat_file(commit_1, OhlohScm::Diff.new(path: 'invalid')).must_be_empty
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohloh_scm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenHub Team at Synopsys
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
The OpenHub source control management library for \
|