Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for git localized messages issue, and also fixes "gc is already running" message #277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions ChangeLog.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@
* Added the ability to specify the '--branches' and '--tags' arguments multiple times (thanks pdf).
* Fixed a problem with processing of the '--exclude' argument (improper quoting internally) (thanks pdf).

# 2.3.3 - 2016-03-02
This is a bugfix release. It provides fix for git localized messages issue, and also fixes "gc is already running" message.

As git2svn runs git to do it's things (and analyzes it's responses in some points), it is necessary to set LANGUAGE environment variable to "en_US" to fix this kind of error:

Running command: git branch --track "<some_branch_here>" "remotes/svn/<some_branch_here>"
fatal: Не удалось настроить информацию отслеживания; стартовая точка «remotes/svn/<some_branch_here>» не является веткой.
********************************************************************
svn2git warning: Tracking remote SVN branches is deprecated.
In a future release local branches will be created without tracking.
If you must resync your branches, run: svn2git --rebase
********************************************************************
Running command: git checkout "<some_branch_here>"
error: pathspec '<some_branch_here>' did not match any file(s) known to git.
command failed:
git checkout "<some_branch_here>"

Notice localized message of git output. You can fix it with new key `--force-en-us-to-git`.

Also there was changes in git, which triggers `git gc --auto` after some point of modifications to local git repo, so now svn2git modifies `gc.auto` option, sets it to `0` to disable automatic packing of loose objects.
This fixes failing at the end of svn2git script, where it calls `git gc` explicitly:

Running command: git gc
fatal: gc is already running on machine '<machine_name>' pid <pid> (use --force if not)
command failed:
git gc

For me, `gc ---auto` starts just after `fetch`, and while svn2git finishes it's work (really fast) it stays running. When svn2git starts `git gc` explicitly, this new process conflicts with already running process, causing an error message.


# 2.3.2 - 2014-06-08

This is a bugfix release. It fixes issues running with Windows using MRI ruby and fixes a problem with Ruby 1.8.7.
Expand Down
63 changes: 62 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,55 @@ Once you have the necessary software on your system, you can install svn2git thr

$ sudo gem install svn2git

Some hints before you start
-----
In Ubuntu 14.04 you have to install latest git and subversion versions to successfully done conversion.
This fixes "error: git-svn died of signal 11" issue.

Upgrade can be done using PPAs:
[https://launchpad.net/~dominik-stadler/+archive/ubuntu/subversion-1.9](https://launchpad.net/~dominik-stadler/+archive/ubuntu/subversion-1.9)
[https://launchpad.net/~git-core/+archive/ubuntu/ppa](https://launchpad.net/~git-core/+archive/ubuntu/ppa)

To add each ppa use commands:

$ sudo add-apt-repository ppa:dominik-stadler/subversion-1.9
$ sudo add-apt-repository ppa:git-core/ppa

or add -E to sudo if you are using proxy to preserve environment variables with proxy information

$ sudo -E add-apt-repository ppa:dominik-stadler/subversion-1.9
$ sudo -E add-apt-repository ppa:git-core/ppa

After that update repository cache and upgrade packages

$ sudo apt-get update
$ sudo apt-get install git-core git-svn subversion

This will upgrade git, git-svn and subversion to latest version (as for 2016-03-02)

Also if you get this kind of error

Running command: git branch --track "<some_branch_here>" "remotes/svn/<some_branch_here>"
fatal: Не удалось настроить информацию отслеживания; стартовая точка «remotes/svn/<some_branch_here>» не является веткой.
********************************************************************
svn2git warning: Tracking remote SVN branches is deprecated.
In a future release local branches will be created without tracking.
If you must resync your branches, run: svn2git --rebase
********************************************************************
Running command: git checkout "<some_branch_here>"
error: pathspec '<some_branch_here>' did not match any file(s) known to git.
command failed:
git checkout "<some_branch_here>"

Notice localized message of git. As svn2git script analyzes git answer here, force English messages from git, using new key `--force-en-us-to-git` (testing feature).
This sets LANGUAGE environment variable to "en_US" for svn2git and its child processes.

Also if you have to provide a password to subversion repository and stuck on

Authentication realm: <http://your_subversion_repository.domain> CollabNet Subversion Repository
Password for '<your_login>':

then try to invoke in console `svn co` first to authorize at subversion repo, it will cache your visit, and then rerun svn2git command.

Usage
-----
Expand Down Expand Up @@ -143,6 +192,16 @@ specified trunk=foo branches=bar and tags=foobar it would be referencing
http://svn.example.com/path/to/repo/foo as your trunk, and so on. However, in
case 4 it references the root of the repo as trunk.

### Tags Notice ###

Notice, that if you want to push tags also to git repo, you need to run not only

git push origin --all

but also

git push origin --tags

### Repository Updates ###

As of svn2git 2.0 there is a new feature to pull in the latest changes from SVN into your
Expand Down Expand Up @@ -206,7 +265,7 @@ Options Reference
Specific options:
--rebase Instead of cloning a new project, rebase an existing one against SVN
--username NAME Username for transports that needs it (http(s), svn)
--password PASS Password for transports that needs it (http(s), svn)
--password PASSWORD Password for transports that needs it (http(s), svn)
--trunk TRUNK_PATH Subpath to trunk from repository URL (default: trunk)
--branches BRANCHES_PATH Subpath to branches from repository URL (default: branches); can be used multiple times
--tags TAGS_PATH Subpath to tags from repository URL (default: tags); can be used multiple times
Expand All @@ -221,6 +280,8 @@ Options Reference
--authors AUTHORS_FILE Path to file containing svn-to-git authors mapping (default: ~/.svn2git/authors)
--exclude REGEX Specify a Perl regular expression to filter paths when fetching; can be used multiple times
-v, --verbose Be verbose in logging -- useful for debugging issues
--rebasebranch REBASEBRANCH Rebase specified branch.
--force-en-us-to-git Force en_US locale to be used by git commands, called by this script.

-h, --help Show this message

Expand Down
24 changes: 24 additions & 0 deletions lib/svn2git/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ def initialize(args)
end

def run!
log "LANGUAGE is: #{ENV["LANGUAGE"]}\n"
if @options[:forceenustogit]
log "Set LANGUAGE environment variable to \"en_US.\"\n"
ENV["LANGUAGE"]="en_US"
log "LANGUAGE is: #{ENV["LANGUAGE"]}\n"
end

if @options[:rebase]
get_branches
elsif @options[:rebasebranch]
Expand All @@ -37,6 +44,13 @@ def run!
fix_tags
fix_trunk
optimize_repos

ensure
unless @gc_auto_is_off.nil?
run_command("#{git_config_command} --get gc.auto", false)
run_command("#{git_config_command} --unset gc.auto")
run_command("#{git_config_command} --get gc.auto", false)
end
end

def parse(args)
Expand All @@ -54,6 +68,7 @@ def parse(args)
options[:username] = nil
options[:password] = nil
options[:rebasebranch] = false
options[:forceenustogit] = false

if File.exists?(File.expand_path(DEFAULT_AUTHORS_FILE))
options[:authors] = DEFAULT_AUTHORS_FILE
Expand Down Expand Up @@ -138,6 +153,10 @@ def parse(args)
options[:rebasebranch] = rebasebranch
end

opts.on('--force-en-us-to-git', 'Force en_US locale to be used by git commands, called by this script.') do
options[:forceenustogit] = true
end

opts.separator ""

# No argument, shows at tail. This will print an options summary.
Expand Down Expand Up @@ -224,6 +243,11 @@ def clone!
run_command(cmd, true, true)
end

run_command("#{git_config_command} --get gc.auto", false)
run_command("#{git_config_command} gc.auto 0")
@gc_auto_is_off = true
run_command("#{git_config_command} --get gc.auto", false)

run_command("#{git_config_command} svn.authorsfile #{authors}") unless authors.nil?

cmd = "git svn fetch "
Expand Down