Skip to content
Browse files

Allow limiting the number of patches to pull

  • Loading branch information...
1 parent 53bfabb commit abbefc5573cc8a32b2cd942e910d34c628271755 @nominolo nominolo committed May 9, 2008
Showing with 19 additions and 6 deletions.
  1. +19 −6 darcs-to-git
View
25 darcs-to-git
@@ -293,12 +293,26 @@ while patch = patches.pop
patches_to_pull.unshift(patch)
end
+$run_consistency_check = true
+if OPTIONS[:num_patches] > 0 then
+ # if we don't pull all patches, then the consistency check would
+ # fail, so we simply skip it
+ $run_consistency_check = patches_to_pull.length <= OPTIONS[:num_patches]
+ # only pull specified number of patches
+ patches_to_pull = patches_to_pull[0, OPTIONS[:num_patches]]
+end
+
patches_to_pull.each { |patch| patch.pull_and_apply }
-def check_consistent()
- puts "Checking for consistency ..."
- system("diff", "-ur", "-x", "_darcs", "-x", ".git", ".", SRCREPO)
- if $? == 0 then
+def check_consistent(pulled)
+ ok = true
+ if $run_consistency_check then
+ puts "Checking for consistency ..."
+ system("diff", "-ur", "-x", "_darcs", "-x", ".git", ".", SRCREPO)
+ ok = $? == 0
+ end
+ if ok then
+ puts "\nPulled #{pulled.length} patch#{pulled.length != 1 ? "es" : ""}."
puts "\nDarcs import successful! You may now want to run `git gc' to
improve space usage the git repo"
else
@@ -308,5 +322,4 @@ improve space usage the git repo"
end
end
-check_consistent()
-
+check_consistent(patches_to_pull)

0 comments on commit abbefc5

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