script to retroactively add commitids to past openbsd commits

just write out script to set commitids, don't actually do it

modifying a local repo is not as important right now

+10 -8
+6 -5
lib/outputter.rb
··· 162 162 end 163 163 164 164 def dup_script(script, tree) 165 + puts "writing update script to #{script.path}" 166 + 165 167 script.puts "#!/bin/sh -x" 166 168 script.puts "if [ \"$TMPCVSDIR\" = \"\" ]; then echo 'set $TMPCVSDIR'; " + 167 169 "exit 1; fi" ··· 193 195 csid = nil 194 196 @scanner.db.execute("SELECT 195 197 files.file, changesets.commitid, changesets.author, changesets.date, 196 - revisions.version 198 + revisions.version, changesets.branch 197 199 FROM revisions 198 200 LEFT OUTER JOIN files ON files.id = file_id 199 201 LEFT OUTER JOIN changesets ON revisions.changeset_id = changesets.id 200 - WHERE revisions.commitid IS NULL 201 - ORDER BY changesets.date ASC, files.file ASC") do |rev| 202 + ORDER BY changesets.csorder ASC, files.file ASC") do |rev| 202 203 if csid == nil || rev["commitid"] != csid 203 - script.puts "# commit #{rev["commitid"]} at #{Time.at(rev["date"])} " + 204 - "by " + rev["author"] 204 + script.puts "# #{Time.at(rev["date"])} by " + rev["author"] + 205 + (rev["branch"].to_s == "" ? "" : " (branch #{rev["branch"]})") 205 206 csid = rev["commitid"] 206 207 end 207 208
+4 -3
openbsd-commitid.rb
··· 94 94 # in the commitids-{tree} file 95 95 sc.recalculate_commitids(CVSTMP, CVSROOT, tree, GENESIS) 96 96 97 - # and finally, update every revision of every file and write its calculated 98 - # commitid, possibly replacing the random one already there 99 - sc.repo_surgery(CVSTMP, CVSROOT, tree) 97 + # output a shell script to add/change all of the commitids in a clean repo 98 + sc.outputter.dup_script(f = File.open("out/add_commitids_to_#{tree}.sh", 99 + "w+"), tree) 100 + f.close 100 101 end