Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use XML-specified ordering during fetch-manifest.

Previously, entries were only read into a hashtable, so iteration
ordering was undefined and seen to be different across machines.

Change-Id: Ifc0807384b7ce7a41c5c440ec5f5a4e0d15fc513
Reviewed-on: http://review.couchbase.org/14276
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Volker Mische <volker.mische@gmail.com>
  • Loading branch information...
commit 746a2b06f36a79c8a55494878537a7a4ba028af7 1 parent 27bc7f1
Steve Yen steveyen authored

Showing 1 changed file with 15 additions and 5 deletions. Show diff stats Hide diff stats

  1. +15 5 fetch-manifest.rb
20 fetch-manifest.rb
@@ -18,15 +18,18 @@
18 18 root = REXML::Document.new(File.new(path)).root
19 19
20 20 default = root.get_elements("//default")[0]
21   -remotes = {}
22 21
  22 +remotes_arr = []
  23 +remotes = {}
23 24 root.each_element("//remote") do |remote|
  25 + remotes_arr << remote.attributes['name']
24 26 remotes[remote.attributes['name']] = remote
25 27 end
26 28
  29 +projects_arr = []
27 30 projects = {}
28   -
29 31 root.each_element("//project") do |project|
  32 + projects_arr << project.attributes['name']
30 33 projects[project.attributes['name']] = project
31 34 end
32 35
@@ -36,16 +39,23 @@
36 39 if more
37 40 more_root = REXML::Document.new(File.new(more)).root
38 41 more_root.each_element("//remote") do |remote|
  42 + unless remotes[remote.attributes['name']]
  43 + remotes_arr << remote.attributes['name']
  44 + end
39 45 remotes[remote.attributes['name']] = remote
40 46 end
41 47 more_root.each_element("//project") do |project|
  48 + unless projects[project.attributes['name']]
  49 + projects_arr << project.attributes['name']
  50 + end
42 51 projects[project.attributes['name']] = project
43 52 end
44 53 end
45 54
46 55 changes = {}
47 56
48   -projects.each do |name, project|
  57 +projects_arr.each do |name|
  58 + project = projects[name]
49 59 path = project.attributes['path'] || project.attributes['name']
50 60 remote = remotes[project.attributes['remote'] || default.attributes['remote']]
51 61 fetch = remote.attributes['fetch']
@@ -121,14 +131,14 @@
121 131 File.open(oxml, 'w') do |o|
122 132 o.write "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
123 133 o.write "<manifest>\n"
124   - remotes.keys.sort.each do |name|
  134 + remotes_arr.each do |name|
125 135 remote = remotes[name]
126 136 o.write " <remote name=\"#{name}\" fetch=\"#{remote.attributes['fetch']}\"/>\n"
127 137 end
128 138 o.write "\n"
129 139 o.write " <default remote=\"#{default.attributes['remote']}\" revision=\"#{default.attributes['revision']}\"/>\n"
130 140 o.write "\n"
131   - projects.keys.sort.each do |name|
  141 + projects_arr.each do |name|
132 142 project = projects[name]
133 143 remote = project.attributes['remote']
134 144 path = project.attributes['path'] || project.attributes['name']

0 comments on commit 746a2b0

Please sign in to comment.
Something went wrong with that request. Please try again.