Skip to content

Commit

Permalink
Check that darcs reports the working area as clean before pulling the…
Browse files Browse the repository at this point in the history
… next patch

Idea is to avoid creation of -darcs-backup0 files when using darcs v2.
  • Loading branch information
purcell committed May 12, 2008
1 parent 2690e4b commit 6d8c857
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions darcs-to-git
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,29 @@ class DarcsPatch

pull
system("git-status")
apply_to_git_repo
commit_to_git_repo
end

private

def pull
unless darcs_reports_clean_repo?
raise "Darcs reports dirty repo before pulling #{identifier}; confused, so aborting"
end
run("darcs", "pull", "--all", "--quiet",
"--match", "hash #{identifier}",
"--set-scripts-executable", source_repo)
unless `darcs whatsnew -sl` =~ /^No changes!$/
unless darcs_reports_clean_repo?
puts "Darcs reports dirty directory: assuming conflict that is fixed by a later patch... reverting"
run("darcs revert --all")
end
end

def apply_to_git_repo
def darcs_reports_clean_repo?
`darcs whatsnew -sl` =~ /^No changes!$/
end

def commit_to_git_repo
ENV['GIT_AUTHOR_NAME'] = ENV['GIT_COMMITTER_NAME'] = git_author_name
ENV['GIT_AUTHOR_EMAIL'] = ENV['GIT_COMMITTER_EMAIL'] = git_author_email
ENV['GIT_AUTHOR_DATE'] = ENV['GIT_COMMITTER_DATE'] = date
Expand Down

0 comments on commit 6d8c857

Please sign in to comment.