r2482 - trunk/scripts
Andres Salomon
dilinger-guest@costa.debian.org
Sun, 13 Feb 2005 08:27:53 +0100
Author: dilinger-guest
Date: 2005-02-13 08:27:52 +0100 (Sun, 13 Feb 2005)
New Revision: 2482
Modified:
trunk/scripts/changeset-all.rb
Log:
Update script to save hash in filename as well as cset num, and check for the
hash instead of cset; csets are dynamic, hashes are constant.
Modified: trunk/scripts/changeset-all.rb
===================================================================
--- trunk/scripts/changeset-all.rb 2005-02-12 19:46:00 UTC (rev 2481)
+++ trunk/scripts/changeset-all.rb 2005-02-13 07:27:52 UTC (rev 2482)
@@ -1,8 +1,10 @@
#!/usr/bin/ruby -w
# changeset-all.rb - grab udiffs of all changesets in bk from the last X weeks
# This will grab all changesets committed in the past X days, weeks, months,
-# or years, storing them in <dir>/new/cset@<nr> as unified diffs. It will
-# only download changesets that aren't already in <dir>/*/cset@<nr>.
+# or years, storing them in <dir>/new/cset@<cset>@<hash> as unified diffs.
+# It will only download changesets that aren't already in
+# <dir>/*/*@<hash>. Note that <cset> numbers may change (thanks bitkeeper!),
+# while <hash> will remain constant.
#
# Copyright (C) 2004-2005 Andres Salomon <dilinger@voxel.net>
#
@@ -184,12 +186,17 @@
puts "#{csets.length} changesets found."
csets.each { |key, val|
- next if Dir.glob(ARGV[0] + '/*/' + key).length > 0
- puts "cset: #{key}"
+ print "cset: #{key}: "
begin
- File.open(ARGV[0] + '/new/' + key, 'w') { |f|
+ hash = val.udiff.split('@').pop
+ if Dir.glob(ARGV[0] + '/*/*@' + hash).length > 0
+ puts "skipped."
+ next
+ end
+ File.open(ARGV[0] + '/new/' + key + '@' + hash, 'w') { |f|
f.puts Net::HTTP.get(URI.parse(val.udiff))
}
+ puts "new."
rescue => e
puts "exception: #{e}"
end