fossgit 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +5 -5
- data/README.md +76 -23
- data/bin/fossgit +45 -73
- data/lib/fossgit.rb +53 -38
- data/lib/fossgit/cli.rb +163 -0
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eca5110eb895f6f749b936257f8afdc5319cfae
|
4
|
+
data.tar.gz: 42265b429b00832cb61896d2479a7bc1ac352ff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b020ff7cde1febd18476afe0f13fd84b1b910e80d717d40173a57e2be74a81ac4975e8293c64c146a1bd75bcdcef39e94dc58f872e6ae99d99aa06f5b484f45a
|
7
|
+
data.tar.gz: 203a1b2366d7ac83e3d476a7af9e06679b691b4b75c7d9d208a66e9ec1a37f244254dfdbbc358a7a760514e89451cd1a059d625169be43d457a045bbde28486b
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
FossGit: Copyright 2016 Chad Perrin, released under the terms of version 0.
|
1
|
+
FossGit: Copyright 2016 Chad Perrin, released under the terms of version 0.5 of
|
2
2
|
the Copyfree Open Innovation License.
|
3
3
|
|
4
4
|
## Terms and Conditions
|
@@ -17,10 +17,10 @@ and/or otherwise deal in the licensed material without restriction.
|
|
17
17
|
license to reproduce, modify, distribute, publish, sell, use, and/or otherwise
|
18
18
|
deal in the licensed material without restriction, for any and all patents:
|
19
19
|
|
20
|
-
a. Held
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
a. Held by each such holder of copyright or other legal privilege, author
|
21
|
+
or assembler, or contributor, necessarily infringed by the contributions
|
22
|
+
alone or by combination with the work, of that privilege holder, author or
|
23
|
+
assembler, or contributor.
|
24
24
|
|
25
25
|
b. Necessarily infringed by the work at the time that holder of copyright
|
26
26
|
or other privilege, author or assembler, or contributor made any
|
data/README.md
CHANGED
@@ -12,21 +12,86 @@ Install the [Ruby Gem][gem]:
|
|
12
12
|
If, for some reason, that is not an available option for you or you wish to do
|
13
13
|
things the hard way, there is another installation method:
|
14
14
|
|
15
|
-
1. Clone it from the [Fossil repository][frepo]
|
15
|
+
1. Clone it from the [Fossil repository][frepo], the [GitHub][ghrepo] mirror,
|
16
|
+
or the [GitLab][glrepo] mirror.
|
16
17
|
|
17
|
-
2.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
2. Build a gem, using this command:
|
19
|
+
|
20
|
+
gem build fossgit.gemspec
|
21
|
+
|
22
|
+
3. Install the gem, using this command, using the whole filename of the gem
|
23
|
+
filename, substituting the actual version number for `<version`:
|
24
|
+
|
25
|
+
gem install fossgit-<version>
|
26
|
+
|
27
|
+
If that still does not suit your needs, you're on your own for now. I'd be
|
28
|
+
happy to accept suggestions for additional installation methods to describe.
|
22
29
|
|
23
30
|
## Usage
|
24
31
|
|
32
|
+
After installation, you can use this command to see documentation for command
|
33
|
+
line usage and (optional) configuration:
|
34
|
+
|
35
|
+
$ fossgit -h
|
36
|
+
|
37
|
+
### Basic Command Line
|
38
|
+
|
25
39
|
With an open checkout of your Fossil repository:
|
26
40
|
|
27
41
|
$ cd /path/to/open/fossil/checkout
|
28
42
|
$ fossgit /path/to/git/repository
|
29
43
|
|
44
|
+
### Config
|
45
|
+
|
46
|
+
The following is just a basic introduction to FossGit configuration. See full
|
47
|
+
config documentation via the command line tool's `-h` option.
|
48
|
+
|
49
|
+
By placing a config file in the directory that will serve as your working
|
50
|
+
directory while running `fossgit` (typically the root of your Fossil repository
|
51
|
+
checkout directory tree), you can do away with the need to specify the path to
|
52
|
+
the local Git repository mirror. Simply create a file there called `.fossgit`
|
53
|
+
containing the following:
|
54
|
+
|
55
|
+
gitrepo: /path/to/gitdir/reponame
|
56
|
+
|
57
|
+
You can then run the command without arguments:
|
58
|
+
|
59
|
+
$ cd /path/to/open/fossil/checkout
|
60
|
+
$ fossgit
|
61
|
+
|
62
|
+
You can also place a `.fossgit` config file in your home directory, in which
|
63
|
+
case you may wish to specify the path to a directory in which you keep all your
|
64
|
+
Git repository mirrors and let `fossgit` infer your repository name from the
|
65
|
+
project-name setting in your Fossil repository:
|
66
|
+
|
67
|
+
gitpath: /path/to/gitdir
|
68
|
+
|
69
|
+
Once again, this allows you to run the command without arguments, but in this
|
70
|
+
case you should ensure the "project name" setting has been configured in your
|
71
|
+
Fossil repository, because it will default to using that to find your local Git
|
72
|
+
mirror. If you want to specify a different Git repository name, using the
|
73
|
+
`gitrepo` setting in a `.fossgit` file within the checkout of your Fossil
|
74
|
+
repository as described above might be a better option.
|
75
|
+
|
76
|
+
You can check whether your project name has been configured by running this
|
77
|
+
command from within an open checkout:
|
78
|
+
|
79
|
+
$ fossil info
|
80
|
+
|
81
|
+
If the `project-name` line says `<unnamed>`, the project name is unconfigured.
|
82
|
+
You can cofigure it yourself; open the web UI for the repository (e.g. run
|
83
|
+
`fossil serve` from within an open checkout and open `localhost:8080` in your
|
84
|
+
browser), navigate to `Admin > Configuration`, fill in the Project Name field,
|
85
|
+
and click the button to apply your changes.
|
86
|
+
|
87
|
+
If you do both, the most-specific option (gitrepo) will be chosen as the target
|
88
|
+
Git repository, which is probably a good idea if, for a specific project, you
|
89
|
+
have not configured the Fossil repository's project-name setting, or if you
|
90
|
+
want to default to updating a mirror with a different name than the Fossil
|
91
|
+
project-name. Specifying a repository path at the command line will cause
|
92
|
+
`fossgit` to ignore both, and just use the command line argument as the target
|
93
|
+
Git repository path.
|
94
|
+
|
30
95
|
## Dependencies
|
31
96
|
|
32
97
|
* Fossil SCM
|
@@ -40,27 +105,15 @@ With an open checkout of your Fossil repository:
|
|
40
105
|
In order from most preferred to least preferred:
|
41
106
|
|
42
107
|
* Add a ticket in the Fossil repository.
|
43
|
-
* Add a ticket in the GitHub repository (
|
108
|
+
* Add a ticket in the GitHub or GitLab repository (and I'll copy it to Fossil).
|
44
109
|
|
45
110
|
## Roadmap
|
46
111
|
|
47
|
-
* Add tests, maybe.
|
112
|
+
* Add more tests, maybe.
|
113
|
+
* Change defaults for v2.0, perhaps.
|
48
114
|
* Incorporate this functionality into FossRec, a more comprehensive tool.
|
49
115
|
|
50
|
-
## Development
|
51
|
-
|
52
|
-
The discerning programmer may look over FossGit in its current form and realize
|
53
|
-
it is neither object-oriented nor functional in its design. It is, in fact, a
|
54
|
-
pretty straightforward procedural program, written in Ruby (an odd language to
|
55
|
-
use for procedural programming, perhaps). The reason for this is simple: it is
|
56
|
-
in essence a glorified shell script. There are plans to make it part of a
|
57
|
-
larger set of libraries and utilities (see the Roadmap), and it will need to
|
58
|
-
undergo a fair bit of redesign as part of that; I expect it to be largely
|
59
|
-
unrecognizable by then.
|
60
|
-
|
61
|
-
Much of this work was done on Christmas weekend 2016. That may or may not be
|
62
|
-
significant.
|
63
|
-
|
64
116
|
[gem]: https://rubygems.org/gems/fossgit
|
65
117
|
[frepo]: https://fossrec.com/u/apotheon/fossgit
|
66
|
-
[
|
118
|
+
[ghrepo]: https://github.com/apotheon/fossgit
|
119
|
+
[glrepo]: https://gitlab.com/apotheon/fossgit
|
data/bin/fossgit
CHANGED
@@ -1,97 +1,69 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'fossgit'
|
3
|
+
require 'fossgit/cli'
|
4
|
+
require 'yaml'
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def sed_command
|
11
|
-
%q{sed 's/^\(committer \+\)\([^ ]\+@[^ ]\+\)\( *<\)\(\w\+\)\(>.*\)$/\1\4\3\2\5/'}
|
12
|
-
end
|
13
|
-
|
14
|
-
def fossil_command
|
15
|
-
cmd = ['fossil export --git']
|
16
|
-
|
17
|
-
cmd << "--import-marks #{fossil_marks}" if update_export?
|
18
|
-
cmd << "--export-marks #{fossil_marks}"
|
19
|
-
cmd << @fg.fossil_repository
|
20
|
-
|
21
|
-
cmd.join ' '
|
22
|
-
end
|
23
|
-
|
24
|
-
def git_command
|
25
|
-
cmd = ['git fast-import']
|
26
|
-
|
27
|
-
cmd << "--import-marks=#{git_marks}" if update_export?
|
28
|
-
cmd << "--export-marks=#{git_marks}"
|
29
|
-
|
30
|
-
cmd.join ' '
|
31
|
-
end
|
32
|
-
|
33
|
-
def push_command
|
34
|
-
'; git checkout trunk; git push origin trunk'
|
6
|
+
def projectname
|
7
|
+
fossil_info = YAML.load `fossil info | head -n 1`
|
8
|
+
name = fossil_info ? fossil_info['project-name'] : fossil_info
|
9
|
+
name if not name.eql? '<unnamed>'
|
35
10
|
end
|
36
11
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
12
|
+
@cli = CLI.new ARGV, File.basename($0)
|
13
|
+
@fg = FossGit.new (@cli.get_option('-c') or Dir.pwd)
|
40
14
|
|
41
|
-
|
42
|
-
fossil_file 'fossil.marks'
|
43
|
-
end
|
15
|
+
Dir.chdir @fg.checkout_path
|
44
16
|
|
45
|
-
|
46
|
-
|
17
|
+
if @cli.config['gitdir'] and projectname and not @cli.config['gitrepo']
|
18
|
+
@cli.config['gitrepo'] = File.join(@cli.config['gitdir'], projectname)
|
47
19
|
end
|
48
20
|
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def fossil_path
|
54
|
-
get_option '-c' or Dir.pwd
|
55
|
-
end
|
56
|
-
|
57
|
-
def get_option opt, default=nil
|
58
|
-
ARGV.index(opt).tap do |val|
|
59
|
-
return val ? (ARGV.delete_at val and ARGV.delete_at val) : default
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def option_switch? long_name
|
64
|
-
ARGV.delete "-#{long_name[0]}" or ARGV.delete "--#{long_name}"
|
65
|
-
end
|
66
|
-
|
67
|
-
name = File.basename $0
|
68
|
-
|
69
|
-
if option_switch? 'help'
|
70
|
-
puts FossGit.help_text name
|
21
|
+
if @cli.option_switch? 'help'
|
22
|
+
puts @cli.help_text
|
71
23
|
exit
|
72
|
-
elsif option_switch? 'version'
|
73
|
-
puts [name, FossGit.version].join ' '
|
74
|
-
elsif option_switch? 'text-export'
|
75
|
-
|
24
|
+
elsif @cli.option_switch? 'version'
|
25
|
+
puts [@cli.name, FossGit.version].join ' '
|
26
|
+
elsif @cli.option_switch? 'text-export'
|
27
|
+
system @fg.text_export_command
|
76
28
|
exit
|
77
29
|
else
|
78
|
-
|
79
|
-
|
30
|
+
opts = Hash.new
|
31
|
+
opts[:local] = @cli.option_switch? 'local'
|
32
|
+
|
33
|
+
@cli.remotes = nil if (opts[:all] = @cli.remotes.eql? 'all')
|
34
|
+
|
35
|
+
@cli.option_switch?('all').tap {|v| opts[:all] ||= v }
|
36
|
+
|
37
|
+
remotes = (@cli.get_option '-r') or @cli.remotes
|
80
38
|
|
81
|
-
|
39
|
+
gitrepo = (@cli.args.shift or @cli.config['gitrepo'])
|
82
40
|
|
83
|
-
if
|
41
|
+
if gitrepo.to_s.empty?
|
84
42
|
STDERR.puts 'Error! No Git path provided.'
|
85
43
|
exit!
|
86
|
-
elsif Dir.exist?
|
87
|
-
Dir.chdir
|
44
|
+
elsif Dir.exist? gitrepo
|
45
|
+
Dir.chdir gitrepo
|
88
46
|
else
|
89
|
-
STDERR.puts %Q{Error! Invalid Git path "#{
|
47
|
+
STDERR.puts %Q{Error! Invalid Git path "#{gitrepo}" provided.}
|
90
48
|
exit!
|
91
49
|
end
|
92
50
|
|
51
|
+
if remotes
|
52
|
+
remotes = remotes.split ','
|
53
|
+
else
|
54
|
+
if opts[:all]
|
55
|
+
remotes = @fg.git_remotes gitrepo
|
56
|
+
else
|
57
|
+
remotes = ['origin']
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
93
61
|
if system 'git status'
|
94
|
-
|
62
|
+
if opts[:local]
|
63
|
+
system @fg.mirror_command
|
64
|
+
else
|
65
|
+
@fg.push_remote_list! remotes
|
66
|
+
end
|
95
67
|
else
|
96
68
|
STDERR.print %Q{Error! Invalid Git repository "#{Dir.pwd}" provided.}
|
97
69
|
exit!
|
data/lib/fossgit.rb
CHANGED
@@ -10,58 +10,71 @@ class FossGit
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.version
|
13
|
-
'1.0
|
13
|
+
'1.1.0'
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
16
|
+
def fossil_marks
|
17
|
+
File.join checkout_path, 'fossil.marks'
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
1. both Fossil SCM and Git installed
|
23
|
-
2. a Fossil repository to mirror with an open checkout
|
24
|
-
3. a Git repository to use as a mirror
|
20
|
+
def git_marks
|
21
|
+
File.join checkout_path, 'git.marks'
|
22
|
+
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
#{name} -t
|
24
|
+
def fossil_command
|
25
|
+
cmd = ['fossil export --git']
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
the local Git repository.
|
27
|
+
cmd << "--import-marks #{fossil_marks}" if update_export?
|
28
|
+
cmd << "--export-marks #{fossil_marks}"
|
29
|
+
cmd << fossil_repository
|
34
30
|
|
35
|
-
|
31
|
+
cmd.join ' '
|
32
|
+
end
|
36
33
|
|
37
|
-
|
38
|
-
|
34
|
+
def push_command gitremote
|
35
|
+
"; git checkout trunk; git push #{gitremote} trunk"
|
36
|
+
end
|
39
37
|
|
40
|
-
|
41
|
-
|
42
|
-
use this tool from within an open checkout of your
|
43
|
-
Fossil repository instead.
|
38
|
+
def git_command
|
39
|
+
cmd = ['git fast-import']
|
44
40
|
|
45
|
-
|
46
|
-
|
47
|
-
default, #{name} tries to push to an upstream Git
|
48
|
-
repository whenever it exports from Fossil to Git.
|
41
|
+
cmd << "--import-marks=#{git_marks}" if update_export?
|
42
|
+
cmd << "--export-marks=#{git_marks}"
|
49
43
|
|
50
|
-
|
51
|
-
|
52
|
-
if present.
|
44
|
+
cmd.join ' '
|
45
|
+
end
|
53
46
|
|
54
|
-
|
47
|
+
def sed_command
|
48
|
+
%q{sed 's/^\(committer \+\)\([^ ]\+@[^ ]\+\)\( *<\)\(\w\+\)\(>.*\)$/\1\4\3\2\5/'}
|
49
|
+
end
|
55
50
|
|
56
|
-
|
51
|
+
def mirror_command
|
52
|
+
[fossil_command, sed_command, git_command].join '|'
|
53
|
+
end
|
57
54
|
|
58
|
-
|
55
|
+
def push_mirror_command gitremote
|
56
|
+
mirror_command + push_command(gitremote)
|
57
|
+
end
|
59
58
|
|
60
|
-
|
59
|
+
def push_remote_list! remote_list
|
60
|
+
remote_list.each do |gitremote|
|
61
|
+
puts "PUSH TO: #{gitremote}"
|
62
|
+
system push_mirror_command(gitremote)
|
63
|
+
end
|
64
|
+
end
|
61
65
|
|
62
|
-
|
66
|
+
def text_export_command
|
67
|
+
[fossil_command, sed_command].join '|'
|
68
|
+
end
|
63
69
|
|
64
|
-
|
70
|
+
def update_export?
|
71
|
+
File.exist? git_marks and File.exist? fossil_marks
|
72
|
+
end
|
73
|
+
|
74
|
+
def git_remotes gitpath
|
75
|
+
Dir.chdir gitpath do
|
76
|
+
`git remote`.split "\n"
|
77
|
+
end
|
65
78
|
end
|
66
79
|
|
67
80
|
private
|
@@ -78,8 +91,10 @@ class FossGit
|
|
78
91
|
def fossil_status
|
79
92
|
Dir.chdir checkout_path
|
80
93
|
|
81
|
-
|
82
|
-
|
94
|
+
stat = `fossil status`
|
95
|
+
|
96
|
+
if stat.size > 0
|
97
|
+
stat.split(/\n/)
|
83
98
|
else
|
84
99
|
raise ArgumentError, "#{checkout_path} is not a valid checkout path"
|
85
100
|
end
|
data/lib/fossgit/cli.rb
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
class CLI
|
4
|
+
attr_accessor :args, :config, :name
|
5
|
+
|
6
|
+
def initialize args=[], cliname='fossgit', filename='.fossgit'
|
7
|
+
@args = args
|
8
|
+
@config = Hash.new
|
9
|
+
@name = cliname
|
10
|
+
|
11
|
+
@config_filename = filename
|
12
|
+
@home_config_file = File.join(Dir.home, @config_filename)
|
13
|
+
|
14
|
+
configure @config_filename
|
15
|
+
end
|
16
|
+
|
17
|
+
def configure file=@config_filename
|
18
|
+
load_home_config
|
19
|
+
load_local_config file
|
20
|
+
end
|
21
|
+
|
22
|
+
def load_home_config
|
23
|
+
if File.exist? @home_config_file
|
24
|
+
@config = YAML.load_file @home_config_file
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_local_config file=@config_filename
|
29
|
+
if File.exist? file
|
30
|
+
YAML.load_file(file).tap do |local|
|
31
|
+
local.each_key {|k| @config[k] = local[k] }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def remotes
|
37
|
+
config['remotes']
|
38
|
+
end
|
39
|
+
|
40
|
+
def remotes= gitremotes
|
41
|
+
config['remotes'] = gitremotes
|
42
|
+
end
|
43
|
+
|
44
|
+
def help_text
|
45
|
+
help = <<-EOF
|
46
|
+
|
47
|
+
FossGit mirrors Fossil repositories to Git repositories. You need:
|
48
|
+
|
49
|
+
1. both Fossil SCM and Git installed
|
50
|
+
2. a Fossil repository with an open checkout to export
|
51
|
+
3. a Git repository to use as a mirror
|
52
|
+
|
53
|
+
USAGE: #{name} [-h | -v | -t]
|
54
|
+
#{name} [-c <CHECKOUT>] [-a | -r REMOTE | -l] [GITREPO]
|
55
|
+
|
56
|
+
By default, when exporting to local Git repository GITREPO, #{name}
|
57
|
+
attempts to push updates to a configured upstream Git repository. It
|
58
|
+
should harmlessly fail to push if there is no upstream repository
|
59
|
+
configured for the local Git repository. If there is no GITREPO in
|
60
|
+
configuration (see CONFIG below), you must specify GITREPO when using
|
61
|
+
#{name} to mirror your Fossil repository.
|
62
|
+
|
63
|
+
OPTIONS/ARGUMENTS:
|
64
|
+
|
65
|
+
-h Display this help text and exit, ignoring all other
|
66
|
+
arguments.
|
67
|
+
|
68
|
+
-a Push to all configured remotes for the target Git
|
69
|
+
repository. Default behavior is to push only to the
|
70
|
+
configured "origin" remote.
|
71
|
+
|
72
|
+
-c CHECKOUT Specify the location of your Fossil repository's open
|
73
|
+
checkout, CHECKOUT. This is optional; you may simply
|
74
|
+
use this tool from within an open checkout of your
|
75
|
+
Fossil repository instead.
|
76
|
+
|
77
|
+
-l Perform local-only mirror operations, without trying
|
78
|
+
to push Git updates to a remote repository. By
|
79
|
+
default, #{name} tries to push to an upstream Git
|
80
|
+
repository whenever it exports from Fossil to Git.
|
81
|
+
|
82
|
+
-r Specify which of your Git mirror's configured remotes
|
83
|
+
you want to push. This overrides the -a switch. For
|
84
|
+
multiple remotes, use a comma-separated list with no
|
85
|
+
spaces between them.
|
86
|
+
|
87
|
+
-t Dump export to STDOUT as text rather than sending it
|
88
|
+
to Git. This overrides the `-l` switch and GITREPO
|
89
|
+
argument, if present.
|
90
|
+
|
91
|
+
-v Show FossGit version number.
|
92
|
+
|
93
|
+
GITREPO Specify the location of your local Git repository.
|
94
|
+
This is optional if there is a configuration file
|
95
|
+
that specifies it for you.
|
96
|
+
|
97
|
+
COMMAND EXAMPLES:
|
98
|
+
|
99
|
+
$ fossgit -h
|
100
|
+
|
101
|
+
$ fossgit -c ~/fossil_checkouts/projectname ~/git/projectname
|
102
|
+
|
103
|
+
$ cd ~/fossil_checkouts/projectname && fossgit ~/git/projectname
|
104
|
+
|
105
|
+
CONFIG:
|
106
|
+
|
107
|
+
A config file named ".fossgit" can be used to set #{name} defaults.
|
108
|
+
|
109
|
+
A universal config file can be placed in the home directory of the
|
110
|
+
user account that executes this command, in which case it will apply
|
111
|
+
every time that account executes #{name}. A config file can also be
|
112
|
+
placed in the root of an open Fossil repository, in which case it
|
113
|
+
will only apply when #{name} is used for that particular repository.
|
114
|
+
If both files exist, settings from both will be used, but where both
|
115
|
+
have the same setting the more specific config (in the project
|
116
|
+
directory) overrides the equivalent setting from the universal
|
117
|
+
config. This means a universal configuration can be used for the
|
118
|
+
most common case, but for specific projects that have different needs
|
119
|
+
you can place a config file the project repository.
|
120
|
+
|
121
|
+
These are the available configuration options:
|
122
|
+
|
123
|
+
* The "gitdir" setting can be used to specify a directory in which
|
124
|
+
Git repositories are kept. In this case, #{name} infers the Git
|
125
|
+
repository name from the "project-name" in "fossil info" output.
|
126
|
+
|
127
|
+
* The "gitrepo" setting can be used to specify the full path to a Git
|
128
|
+
repository, without letting #{name} try to infer the repository
|
129
|
+
name. This option overrides "gitdir" if both are set. It is
|
130
|
+
probably a bad idea to set "gitrepo" in a universal config. It is
|
131
|
+
intended to be set in a project-specific ".fossgit" file because
|
132
|
+
chaos may ensue if all Fossil repositories use the same "gitrepo".
|
133
|
+
|
134
|
+
* The "remotes" setting can be used to specify which of your Git
|
135
|
+
mirror's configured remotes you want to use when pushing from Git.
|
136
|
+
As with the -r command line option, you can list one remote or list
|
137
|
+
several as a comma-separated list with no spaces. The "remotes"
|
138
|
+
setting in a configuration file accepts the "all" value, equivalent
|
139
|
+
to the -a command line option.
|
140
|
+
|
141
|
+
CONFIG EXAMPLES:
|
142
|
+
|
143
|
+
gitdir: /home/username/fossrec/git
|
144
|
+
|
145
|
+
gitrepo: /home/username/fossrec
|
146
|
+
|
147
|
+
remotes: gitlab
|
148
|
+
|
149
|
+
EOF
|
150
|
+
end
|
151
|
+
|
152
|
+
def get_option opt, default=nil
|
153
|
+
if val = args.index(opt)
|
154
|
+
return (args.delete_at val and args.delete_at val)
|
155
|
+
else
|
156
|
+
return default
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def option_switch? long_name
|
161
|
+
args.delete "-#{long_name[0]}" or args.delete "--#{long_name}"
|
162
|
+
end
|
163
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fossgit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Perrin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: " Maintain a presence in Git hosting for Fossil
|
13
|
+
description: " Maintain a presence in Git hosting for Fossil project mirrors.\n"
|
14
14
|
email: code@apotheon.net
|
15
15
|
executables:
|
16
16
|
- fossgit
|
@@ -21,21 +21,26 @@ files:
|
|
21
21
|
- README.md
|
22
22
|
- bin/fossgit
|
23
23
|
- lib/fossgit.rb
|
24
|
+
- lib/fossgit/cli.rb
|
24
25
|
homepage: https://fossrec.com/u/apotheon/fossgit
|
25
26
|
licenses:
|
26
27
|
- COIL
|
27
28
|
metadata: {}
|
28
29
|
post_install_message: |2
|
29
30
|
Thank you for using FossGit. For it to work properly, you need to have the
|
30
|
-
following software dependencies installed:
|
31
|
+
following external software dependencies installed:
|
31
32
|
|
32
33
|
* Fossil SCM (the world's most decentralized SCM and DVCS)
|
33
34
|
* Git (the world's most popular DVCS)
|
34
35
|
* sed (standard on Unix-like systems)
|
35
36
|
|
36
|
-
|
37
|
+
This update adds support for configuration files and specifying which Git
|
38
|
+
remotes to push. It should not break backward compatibility. If it does,
|
39
|
+
that is a bug, and you are encouraged to report it at:
|
37
40
|
|
38
|
-
|
41
|
+
https://fossrec.com/u/apotheon/fossgit/index.cgi/reportlist
|
42
|
+
|
43
|
+
Run "fossgit -h" for usage and configuration information.
|
39
44
|
rdoc_options: []
|
40
45
|
require_paths:
|
41
46
|
- lib
|
@@ -43,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
48
|
requirements:
|
44
49
|
- - ">="
|
45
50
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
51
|
+
version: 2.4.5
|
47
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
53
|
requirements:
|
49
54
|
- - ">="
|
@@ -51,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
56
|
version: '0'
|
52
57
|
requirements: []
|
53
58
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.6.14.3
|
55
60
|
signing_key:
|
56
61
|
specification_version: 4
|
57
62
|
summary: 'FossGit: Mirror Fossil to Git.'
|