On Thu, 16 Feb 2012 11:42:14 +0100 Martin Vidner <[email protected]> wrote:
> On Mon, Feb 13, 2012 at 06:29:08PM +0100, Lukas Ocilka wrote: > > As SP2 is not blocking us anymore, it's now time to switch from SVN > > to GitHub as we've decided earlier in 2011. > > Hi, I try it and it is quite time consuming (need manual modification of svn dump file in some cases), so I think it is not doable via big revolution move. So I plan to do it per request. I start with ruby-bindings[0] as I become maintainer (so you can check in which quality I generate repository). If you want some of your modules moved, just mail me ( It can take some time before it is really done, in this time you should not do any commits ). If you are interested to do it your self I attach my modification to klaus svn2git satsolver part. I add ability to handle renamed modules to keep history and keeping history for projects started in tmp branch. I move project to yast project on github ( for easier administration). I create separated team for each project. So e.g. for ruby bindings only me and duncan can push, but everyone can contribute via pull request ( so I can review all changes before it really goes to repo ). Of course policy of your modules is up to you. Josef [0] https://github.com/yast/yast-ruby-bindings
commit 3820f32309ff7f4448418be59f680d70d5768632 Author: Josef Reidinger <[email protected]> Date: Fri Feb 17 14:28:23 2012 +0000 allow multiple modules to support case when module was renamed. Also few more fixes diff --git a/Makefile b/Makefile index 9cbbcaf..4c9a366 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,35 @@ # default rule +MODULE_NEW_NAME := $(shell echo $(MODULE) | sed "s/,.*//") +MODULE_REGEX := $(shell echo $(MODULE) | sed "s/,/|/g") + all: git git: svn -echo "Convert SVN to GIT" # convert svn to bare git repo - (cd $(MODULE).dir; rm -rf yast-$(MODULE); /abuild/projects/svn2git/svn-all-fast-export --debug-rules --add-metadata --identity-map ../yast.map --rules ../yast.rules svn > stdout.svn2git 2> stderr.svn2git) + (cd $(MODULE_NEW_NAME).dir; rm -rf yast-$(MODULE_NEW_NAME); /abuild/projects/svn2git/svn-all-fast-export --debug-rules --add-metadata --identity-map ../yast.map --rules ../yast.rules svn > stdout.svn2git 2> stderr.svn2git) svn: extract -echo "Create new SVN repo" # load the splitted dump into a new svn repo - (cd $(MODULE).dir; rm -rf svn; mkdir svn; cd svn; svnadmin create .; svnadmin load . < ../dump > ../stdout.svnadmin 2> ../stderr.svnadmin) + (cd $(MODULE_NEW_NAME).dir; rm -rf svn; mkdir svn; cd svn; svnadmin create .; svnadmin load . < ../dump > ../stdout.svnadmin 2> ../stderr.svnadmin) -extract: moduledir - -echo "Extracting relevant revisions for $(MODULE)" +extract: moduledir yast-full.solv + -echo "Extracting relevant revisions for $(MODULE_NEW_NAME)" # split the full dump - (cd $(MODULE).dir; ruby ../dump-splitter.rb --debug ../../yast-full.dump ../yast-full.solv $(MODULE) > dump) + (cd $(MODULE_NEW_NAME).dir; ruby ../dump-splitter.rb --debug ../../yast-full.dump ../yast-full.solv $(MODULE) > dump) + +yast-full.solv: ../yast-full.dump + ruby dump2solv.rb $< $@ moduledir: module.rule - rm -rf $(MODULE).dir - mkdir -p $(MODULE).dir + rm -rf ${MODULE_NEW_NAME}.dir + mkdir -p ${MODULE_NEW_NAME}.dir module.rule: modulename - -echo "declare MODULE=$(MODULE)" > module.rule + -echo "declare MODULE_NEW_NAME=${MODULE_NEW_NAME}" > module.rule + -echo "declare MODULE_REGEX=${MODULE_REGEX}" >> module.rule modulename: -if test -z "$(MODULE)"; then echo "Module name missing, set MODULE="; exit 1; fi diff --git a/dump-splitter.rb b/dump-splitter.rb index a72ff38..47b0fd5 100644 --- a/dump-splitter.rb +++ b/dump-splitter.rb @@ -130,7 +130,7 @@ loop do if filter usage "Excessive arguments" else - filter = arg + filter = arg.split(',') end else solvfile = arg diff --git a/revtree.rb b/revtree.rb index af173bb..9a99390 100644 --- a/revtree.rb +++ b/revtree.rb @@ -26,7 +26,7 @@ $have_any_trunk = false # # Check if path matches filter # -def path_matches? path, filter +def path_matches? path, filters path_components = path.split("/").collect! { |p| p.to_sym } # check if we can apply the filter @@ -35,7 +35,11 @@ def path_matches? path, filter when :trunk filter_pos = 1 # assume "trunk/<filter>" when :branches - filter_pos = 2 # assume "branches/<branch>/<filter>" + if path_components[1] == :tmp #special tmp branch, we also want history + filter_pos = 3 + else + filter_pos = 2 # assume "branches/<branch>/<filter>" + end when :tags filter_pos = 2 # assume "tags/<tag>/<filter>" when :users, :reipl # private branches @@ -46,7 +50,7 @@ def path_matches? path, filter raise "Unknown path start #{path_components[0].inspect}<#{path}>" end - return path_components[filter_pos] == filter + return filters.include? path_components[filter_pos] end @@ -175,7 +179,7 @@ class Satsolver::Solvable # # @return path if filter matches # - def is_relevant_for? filter, parents + def is_relevant_for? filters, parents pathrel = nil # get the one provides representing the Node-path self_id = @@pool.id("#{name}_#{version}") @@ -190,7 +194,7 @@ class Satsolver::Solvable pathrel = obsoletes[0] if pathrel.nil? # delete raise "Node #{name} of rev #{rev.name} without path" if pathrel.nil? path = pathrel.name - unless path_matches?(path, filter) || parents[path] + unless path_matches?(path, filters) || parents[path] # this node doesn't touch a relevant path or a parent # still it might be relevant if it copies from a parent pathreq = requires[0] # copypath @@ -487,7 +491,7 @@ private # return relevant path # def check_node node, rev, parents - path = node.is_relevant_for?(@filter, parents) + path = node.is_relevant_for?(@filters, parents) return nil unless path rev.make_relevant! node.make_relevant! @@ -576,10 +580,10 @@ public # # Go through all revisions and mark the relevant ones. # - def mark_relevants filter - Log.log(1, "mark_relevants '#{filter}'") if $debug + def mark_relevants filters + Log.log(1, "mark_relevants '#{filters}'") if $debug revnum = 0 - @filter = filter.to_sym + @filters = filters.collect {|f| f.to_sym} parents = {} # hash of relevant parent dirs, to detect relevance of 'delete' nodes while rev = get_rev(revnum) if !$quiet && revnum % 1000 == 0 diff --git a/yast.rules b/yast.rules index dec77c5..e46f48b 100644 --- a/yast.rules +++ b/yast.rules @@ -1,24 +1,24 @@ include module.rule -create repository yast-${MODULE} +create repository yast-${MODULE_NEW_NAME} end repository -match /trunk/${MODULE}/ - repository yast-${MODULE} +match /trunk/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} branch master # provide proper prefix path for commits with empty paths - see below as well prefix / end match match /trunk/ - repository yast-${MODULE} + repository yast-${MODULE_NEW_NAME} branch master prefix / end match -match /tags/stable-([^/]+)/${MODULE}/ - repository yast-${MODULE} - branch refs/tags/yast-${MODULE}/\1 +match /tags/stable-([^/]+)/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} + branch refs/tags/yast-${MODULE_NEW_NAME}/\1 annotated true prefix / end match @@ -26,52 +26,52 @@ end match ###################### # /tags/SuSE-Linux-9_3-GM/storage/ -match /tags/SuSE-Linux-([^/]+)-GM/${MODULE}/ - repository yast-${MODULE} - branch refs/tags/yast-${MODULE}/openSUSE-\1/GM +match /tags/SuSE-Linux-([^/]+)-GM/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} + branch refs/tags/yast-${MODULE_NEW_NAME}/openSUSE-\1/GM annotated true prefix / end match #################### -match /branches/Moblin/${MODULE}/ - repository yast-${MODULE} +match /branches/Moblin/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} branch Moblin prefix / end match match /branches/Moblin/$ - repository yast-${MODULE} + repository yast-${MODULE_NEW_NAME} branch Moblin end match -match /branches/REFACTORING-10_3/${MODULE}/ - repository yast-${MODULE} +match /branches/REFACTORING-10_3/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} branch REFACTORING-10_3 prefix / end match match /branches/REFACTORING-10_3/$ - repository yast-${MODULE} + repository yast-${MODULE_NEW_NAME} branch REFACTORING-10_3 end match # SuSE-Code-11-Branch # SuSE-Code-11-SP2-Branch -match /branches/SuSE-Code-([^/]+)-Branch/${MODULE}/ - repository yast-${MODULE} - branch Code-\1 +match /branches/SuSE-Code-([^/]+)-Branch/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} + branch SuSE-Code-\1 prefix / end match match /branches/SuSE-Code-([^/]+)-Branch/$ - repository yast-${MODULE} - branch Code-\1 + repository yast-${MODULE_NEW_NAME} + branch SuSE-Code-\1 end match # /tags/branch-Code-11-SP1-2_17_38_2/product-creator -match /tags/branch-Code-([^/]+)-([\d_]+)/${MODULE}/ - repository yast-${MODULE} - branch refs/tags/yast-${MODULE}/Code-\1/\2 +match /tags/branch-Code-([^/]+)-([\d_]+)/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} + branch refs/tags/yast-${MODULE_NEW_NAME}/Code-\1/\2 annotated true prefix / end match @@ -79,40 +79,40 @@ end match # SuSE-Linux-9_3-Branch -match /branches/SuSE-Linux-([^/]+)-Branch/${MODULE}/ - repository yast-${MODULE} +match /branches/SuSE-Linux-([^/]+)-Branch/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} branch openSUSE-\1 prefix / end match match /branches/SuSE-Linux-([^/]+)-Branch/$ - repository yast-${MODULE} + repository yast-${MODULE_NEW_NAME} branch openSUSE-\1 end match # /tags/branch-Linux-11_4-2_20_5/storage/ -match /tags/branch-Linux-([\d_]+)-([\d_]+)/${MODULE}/ - repository yast-${MODULE} - branch refs/tags/yast-${MODULE}/openSUSE-\1/\2 +match /tags/branch-Linux-([\d_]+)-([\d_]+)/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} + branch refs/tags/yast-${MODULE_NEW_NAME}/openSUSE-\1/\2 annotated true prefix / end match -match /branches/SuSE-SLE-([^/]+)-Branch/${MODULE}/ - repository yast-${MODULE} +match /branches/SuSE-SLE-([^/]+)-Branch/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} branch SLE-\1 prefix / end match match /branches/SuSE-SLE-([^/]+)-Branch/$ - repository yast-${MODULE} + repository yast-${MODULE_NEW_NAME} branch SLE-\1 end match # /tags/branch-SLE-10-2_13_11_1/storage/ # /tags/branch-SLE-10-SP2-2_13_207/storag.. -match /tags/branch-SLE-([^/]+)-([\d_]+)/${MODULE}/ - repository yast-${MODULE} - branch refs/tags/yast-${MODULE}/SLE-\1/\2 +match /tags/branch-SLE-([^/]+)-([\d_]+)/${MODULE_REGEX}/ + repository yast-${MODULE_NEW_NAME} + branch refs/tags/yast-${MODULE_NEW_NAME}/SLE-\1/\2 annotated true prefix / end match
