From f26211be01479491ddc60de80b95a7bd9f0d60f8 Mon Sep 17 00:00:00 2001 From: Anton Matsiuk Date: Fri, 10 May 2019 15:04:03 +0300 Subject: [PATCH] Fix for git localized messages issue, and also fixes _gc is already running_ message --- ChangeLog.markdown | 30 +++++++++++++++++++ README.markdown | 63 +++++++++++++++++++++++++++++++++++++++- lib/svn2git/migration.rb | 24 +++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-) diff --git a/ChangeLog.markdown b/ChangeLog.markdown index f8d7239..448fbcf 100644 --- a/ChangeLog.markdown +++ b/ChangeLog.markdown @@ -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 "" "remotes/svn/" + fatal: Не удалось настроить информацию отслеживания; стартовая точка «remotes/svn/» не является веткой. + ******************************************************************** + 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 "" + error: pathspec '' did not match any file(s) known to git. + command failed: + git checkout "" + + 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 '' 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. diff --git a/README.markdown b/README.markdown index 7b1165c..f2481cf 100644 --- a/README.markdown +++ b/README.markdown @@ -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 "" "remotes/svn/" + fatal: Не удалось настроить информацию отслеживания; стартовая точка «remotes/svn/» не является веткой. + ******************************************************************** + 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 "" + error: pathspec '' did not match any file(s) known to git. + command failed: + git checkout "" + +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: CollabNet Subversion Repository + Password for '': + +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 ----- @@ -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 @@ -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 @@ -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 diff --git a/lib/svn2git/migration.rb b/lib/svn2git/migration.rb index 4de8a9e..74a8030 100755 --- a/lib/svn2git/migration.rb +++ b/lib/svn2git/migration.rb @@ -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] @@ -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) @@ -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 @@ -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. @@ -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 "