Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hg repo_tree implementation #1856

Merged
merged 1 commit into from
Mar 4, 2017
Merged

Fix hg repo_tree implementation #1856

merged 1 commit into from
Mar 4, 2017

Conversation

mattbrictson
Copy link
Member

hg archive does not write to standard out, so Capistrano's git implementation of the :repo_tree option does not work for hg. As a workaround, generate a temporary tar file, extract it, and then remove it. This is not as efficient or elegant as doing it via stdout and pipes in a single line, but it should work.

Fixes #1849.

@zebastiane can you test the branch to see if it works? Do you have any concerns about the implementation? Thanks!

@zebastiane
Copy link

Hi,

I tested but unfortunately it doesn't work.
The archive can't be extracted because the directory doesn't exists (how does git handle this?).

00:03 hg:create_release
      01 hg archive -p . -I htdocs --rev develop/4.0.0 /tmp/a3d6575bc38316c79133.tar
      02 tar -x --strip-components 1 -f /tmp/a3d6575bc38316c79133.tar -C /var/www/html/releases/20170302141707
      02 tar: /var/www/html/releases/20170302141707: Cannot open: No such file or directory
      02 tar: Error is not recoverable: exiting now

The archive content is good.

@mattbrictson
Copy link
Member Author

mattbrictson commented Mar 2, 2017

Hmm. Interesting. Thanks for checking! I am not sure why in git's case tar is able to create the directory. I'll look into it further.

@mattbrictson
Copy link
Member Author

Ah, git.rake runs execute :mkdir, "-p", release_path first. Should be an easy fix.

`hg archive` does not write to standard out, so Capistrano's `git`
implementation of the `:repo_tree` option does not work for `hg`. As a
workaround, generate a temporary tar file, extract it, and then remove
it. This is not as efficient or elegant as doing it via stdout and pipes
in a single line, but it should work.
@mattbrictson
Copy link
Member Author

@zebastiane I've force-pushed a fix. Can you try it again?

@zebastiane
Copy link

@mattbrictson It works!

@mattbrictson
Copy link
Member Author

Great! Thanks for testing. I'll merge it.

@mattbrictson mattbrictson merged commit 1f96cad into master Mar 4, 2017
@mattbrictson mattbrictson deleted the fix-hg-repo-tree branch March 16, 2017 16:17
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Mar 20, 2017
## `3.8.0` (2017-03-10)

capistrano/capistrano@v3.7.2...v3.8.0

### Potentially breaking changes:

* [#1846](capistrano/capistrano#1846): add_host will add a new host in a case where it used to incorrectly update an existing one (potentially breaking) [(@dbenamy)](https://github.com/dbenamy)

### New features:

* [#1860](capistrano/capistrano#1860): Allow cap to be run within subdir and still work - [@mattbrictson](https://github.com/mattbrictson)

### Fixes:

* [#1835](capistrano/capistrano#1835): Stopped printing parenthesis in ask prompt if no default or nil was passed as argument [(@chamini2)](https://github.com/chamini2)
* [#1840](capistrano/capistrano#1840): Git plugin: shellescape git_wrapper_path [(@olleolleolle)](https://github.com/olleolleolle)
* [#1843](capistrano/capistrano#1843): Properly shell escape git:wrapper steps - [@mattbrictson](https://github.com/mattbrictson)
* [#1846](capistrano/capistrano#1846): Defining a role is now O(hosts) instead of O(hosts^2) [(@dbenamy)](https://github.com/dbenamy)
* Run `svn switch` to work with svn branches if repo_url is changed
* [#1856](capistrano/capistrano#1856): Fix hg repo_tree implementation - [@mattbrictson](https://github.com/mattbrictson)
* [#1857](capistrano/capistrano#1857): Don't emit doctor warning when repo_tree is set - [@mattbrictson](https://github.com/mattbrictson)

### Other changes:

* [capistrano-harrow#4](https://github.com/harrowio/capistrano-harrow/issues/4): Drop dependency on `capistrano-harrow` gem. Gem can still be installed separately [(@leehambley)](https://github.com/leehambley)
* [#1859](capistrano/capistrano#1859): Move git-specific repo_url logic into git plugin - [@mattbrictson](https://github.com/mattbrictson)
* [#1858](capistrano/capistrano#1858): Unset the :scm variable when an SCM plugin is used - [@mattbrictson](https://github.com/mattbrictson)

## `3.7.2` (2017-01-27)

capistrano/capistrano@v3.7.1...v3.7.2

### Potentially breaking changes:

* None

### Other changes:

* Suppress log messages of `git ls-remote` by filtering remote refs (@aeroastro)
* The Git SCM now allows the repo_url to be changed without manually wiping out the mirror on each target host first (@javanthropus)
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Apr 22, 2017
## `3.8.1` (2017-04-21)

capistrano/capistrano@v3.8.0...v3.8.1

### Breaking changes:

* None

### Fixes:

* [#1867](capistrano/capistrano#1867): Allow `cap -T` to run without Capfile present - [@mattbrictson](https://github.com/mattbrictson)

## `3.8.0` (2017-03-10)

capistrano/capistrano@v3.7.2...v3.8.0

### Potentially breaking changes:

* [#1846](capistrano/capistrano#1846): add_host will add a new host in a case where it used to incorrectly update an existing one (potentially breaking) [(@dbenamy)](https://github.com/dbenamy)

### New features:

* [#1860](capistrano/capistrano#1860): Allow cap to be run within subdir and still work - [@mattbrictson](https://github.com/mattbrictson)

### Fixes:

* [#1835](capistrano/capistrano#1835): Stopped printing parenthesis in ask prompt if no default or nil was passed as argument [(@chamini2)](https://github.com/chamini2)
* [#1840](capistrano/capistrano#1840): Git plugin: shellescape git_wrapper_path [(@olleolleolle)](https://github.com/olleolleolle)
* [#1843](capistrano/capistrano#1843): Properly shell escape git:wrapper steps - [@mattbrictson](https://github.com/mattbrictson)
* [#1846](capistrano/capistrano#1846): Defining a role is now O(hosts) instead of O(hosts^2) [(@dbenamy)](https://github.com/dbenamy)
* Run `svn switch` to work with svn branches if repo_url is changed
* [#1856](capistrano/capistrano#1856): Fix hg repo_tree implementation - [@mattbrictson](https://github.com/mattbrictson)
* [#1857](capistrano/capistrano#1857): Don't emit doctor warning when repo_tree is set - [@mattbrictson](https://github.com/mattbrictson)

### Other changes:

* [capistrano-harrow#4](https://github.com/harrowio/capistrano-harrow/issues/4): Drop dependency on `capistrano-harrow` gem. Gem can still be installed separately [(@leehambley)](https://github.com/leehambley)
* [#1859](capistrano/capistrano#1859): Move git-specific repo_url logic into git plugin - [@mattbrictson](https://github.com/mattbrictson)
* [#1858](capistrano/capistrano#1858): Unset the :scm variable when an SCM plugin is used - [@mattbrictson](https://github.com/mattbrictson)

## `3.7.2` (2017-01-27)

capistrano/capistrano@v3.7.1...v3.7.2

### Potentially breaking changes:

* None

### Other changes:

* Suppress log messages of `git ls-remote` by filtering remote refs (@aeroastro)
* The Git SCM now allows the repo_url to be changed without manually wiping out the mirror on each target host first (@javanthropus)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants