Class | Capistrano::Deploy::SCM::Darcs |
In: |
lib/capistrano/recipes/deploy/scm/darcs.rb
lib/capistrano/recipes/deploy/scm/darcs.rb |
Parent: | Base |
Implements the Capistrano SCM interface for the darcs revision control system (www.abridgegame.org/darcs/).
Returns the command that will check out the given revision to the given destination. The ‘revision’ parameter must be the ‘hash’ value for the revision in question, as given by ‘darcs changes —xml-output’.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 24 24: def checkout(revision, destination) 25: scm :get, verbose, "--repo-name=#{destination}", "--to-match='hash #{revision}'", repository 26: end
Returns the command that will check out the given revision to the given destination. The ‘revision’ parameter must be the ‘hash’ value for the revision in question, as given by ‘darcs changes —xml-output’.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 24 24: def checkout(revision, destination) 25: scm :get, verbose, "--repo-name=#{destination}", "--to-match='hash #{revision}'", repository 26: end
Returns the command that will do a "darcs diff" for the two revisions. Each revision must be the ‘hash’ identifier of a darcs revision.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 46 46: def diff(from, to=nil) 47: scm :diff, "--from-match 'hash #{from}'", to && "--to-match 'hash #{to}'" 48: end
Returns the command that will do a "darcs diff" for the two revisions. Each revision must be the ‘hash’ identifier of a darcs revision.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 46 46: def diff(from, to=nil) 47: scm :diff, "--from-match 'hash #{from}'", to && "--to-match 'hash #{to}'" 48: end
Darcs does not have a real ‘export’ option; there is ‘darcs dist’, but that presupposes a utility that can untar and ungzip the dist file. We‘ll cheat and just do a get, followed by a deletion of the _darcs metadata directory.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 40 40: def export(revision, destination) 41: [checkout(revision, destination), "rm -rf #{destination}/_darcs"].join(" && ") 42: end
Darcs does not have a real ‘export’ option; there is ‘darcs dist’, but that presupposes a utility that can untar and ungzip the dist file. We‘ll cheat and just do a get, followed by a deletion of the _darcs metadata directory.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 40 40: def export(revision, destination) 41: [checkout(revision, destination), "rm -rf #{destination}/_darcs"].join(" && ") 42: end
Because darcs does not have any support for pseudo-ids, we‘ll just return something here that we can use in the helpers below for determining whether we need to look up the latest revision.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 17 17: def head 18: :head 19: end
Because darcs does not have any support for pseudo-ids, we‘ll just return something here that we can use in the helpers below for determining whether we need to look up the latest revision.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 17 17: def head 18: :head 19: end
Returns the log of changes between the two revisions. Each revision must be the ‘hash’ identifier of a darcs revision.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 52 52: def log(from, to=nil) 53: scm :changes, "--from-match 'hash #{from}'", to && "--to-match 'hash #{to}'", "--repo=#{repository}" 54: end
Returns the log of changes between the two revisions. Each revision must be the ‘hash’ identifier of a darcs revision.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 52 52: def log(from, to=nil) 53: scm :changes, "--from-match 'hash #{from}'", to && "--to-match 'hash #{to}'", "--repo=#{repository}" 54: end
Attempts to translate the given revision identifier to a "real" revision. If the identifier is a symbol, it is assumed to be a pseudo-id. Otherwise, it will be immediately returned. If it is a pseudo-id, a set of commands to execute will be yielded, and the result of executing those commands must be returned by the block. This method will then extract the actual revision hash from the returned data.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 63 63: def query_revision(revision) 64: case revision 65: when :head 66: xml = yield(scm(:changes, "--last 1", "--xml-output", "--repo=#{repository}")) 67: return xml[/hash='(.*?)'/, 1] 68: else return revision 69: end 70: end
Attempts to translate the given revision identifier to a "real" revision. If the identifier is a symbol, it is assumed to be a pseudo-id. Otherwise, it will be immediately returned. If it is a pseudo-id, a set of commands to execute will be yielded, and the result of executing those commands must be returned by the block. This method will then extract the actual revision hash from the returned data.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 63 63: def query_revision(revision) 64: case revision 65: when :head 66: xml = yield(scm(:changes, "--last 1", "--xml-output", "--repo=#{repository}")) 67: return xml[/hash='(.*?)'/, 1] 68: else return revision 69: end 70: end
Tries to update the destination repository in-place, to bring it up to the given revision. Note that because darcs’ "pull" operation does not support a "to-match" argument (or similar), this basically nukes the destination directory and re-gets it.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 32 32: def sync(revision, destination) 33: ["rm -rf #{destination}", checkout(revision, destination)].join(" && ") 34: end
Tries to update the destination repository in-place, to bring it up to the given revision. Note that because darcs’ "pull" operation does not support a "to-match" argument (or similar), this basically nukes the destination directory and re-gets it.
# File lib/capistrano/recipes/deploy/scm/darcs.rb, line 32 32: def sync(revision, destination) 33: ["rm -rf #{destination}", checkout(revision, destination)].join(" && ") 34: end