Commit graph

165 commits

Author SHA1 Message Date
Rene Moser
1f92e77650 git: fix status to use porcelain, ignore user configuration
From the git status doc:

    --porcelain

        Give the output in an easy-to-parse format for scripts. This is similar to the short output, but will remain stable across Git versions and regardless of user configuration. See below for details.

User configuration can break the git module from working as expected.
2016-04-21 10:41:03 +02:00
Toshio Kuratomi
98322a777f Merge pull request #3466 from robinro/git-full-clone-with-hash
git: fall back to full clone if version is hash
2016-04-19 07:42:06 -07:00
Robin Roth
b67d15f385 fall back to full clone if version is hash
if version is not a branch or tag (i.e. a hash), we need a full checkout to be able to switch to it
2016-04-19 13:45:43 +02:00
Robin Roth
c398eb5399 with depth only fetch actual version
* don't use refs/heads/branchname for branches
* for tags it's needed thou
* fixes #3456
2016-04-19 12:47:36 +02:00
Kyle Dyroff
2b003a2773 Log git error stdout/stderr to fail_json (#3022) 2016-04-19 08:56:48 +02:00
Robin Roth
f1bacc1d3f make git updates respect depth (#3254)
* make git updates respect depth

until now `fetch` gets all tags and heads at full depth, this change
* uses `depth` argument for `fetch`
* only get the specified `version` in `fetch`

* fixes #14954

* treat combination of refspec and depth correctly

* be more conservative for non-depth fetch
2016-04-14 09:40:23 -07:00
Petrox
99cd31140d Missing documentation fix (#2516)
Extending the documentation to state, that this module does not handle externals well.
2016-04-12 22:12:30 +02:00
Toshio Kuratomi
ee90762388 git still needs to have abspath applied to dest 2016-04-06 14:03:17 -07:00
Thomas Quinot
99456fbc98 Reset all locale environment variables before running svn commands
We screenscrape the output of svn(1), so better ensure it is using the

C locale.



Fixes #3255
2016-04-05 10:23:33 -07:00
Michael Scherer
870311748f Use type='path' for path arguments for git module 2016-03-29 08:50:09 +02:00
Brian Coca
7461feb737 Merge pull request #934 from jbgo/git-depth-switch-version
git: set remote branch before switching versions when using depth arg
2016-03-11 10:37:12 -05:00
Toshio Kuratomi
0019a89d14 change a parameter to type=path 2016-02-29 00:26:56 -08:00
Toshio Kuratomi
2e46c086ae Since we screenscrape output from git to tell us information we need to use the C locale when running commands.
Using another locale would mean that we get information that may have
the strings that we are looking for.

Fixes #2449
Fixes #2462
2016-02-07 12:48:41 -08:00
Brian Coca
2a33599698 Merge pull request #2528 from jordiecometrica/hg-discard
hg: discard changes without changing the current revision
2016-01-12 09:34:29 -05:00
Jan Duzinkiewicz
b77bf7a9aa forcing git fetch if sha1 are equal between repos but branch exists only at remote
Add an explanatory comment to the code
2016-01-11 17:09:51 -08:00
Dmitry Labutin
0f21a9316d Github uses both HTTP and HTTPS protocols 2015-12-29 09:58:38 +03:00
Jordi Gutiérrez Hermoso
c038e7013a hg: discard changes without changing the current revision
The command `hg up -C` by default moves to the latest revision on the
current branch. The `discard` function was trying to update to a
different branch, in case it was provided, by passing a `-r REVISION`
argument. Not only is this not the intended effect of the `discard`
function, but this also could update to a different branch that hasn't
been pulled yet, which is how we were experiencing trouble.

Instead, we unconditionally do `hg up -C -r .` to "update" to the
current revision (i.e. to "."), while `-C/--clean`ing the current
directory. This is similar to `hg revert --all`, except that it also
undoes the merge state of the working directory, in case there was
any.
2015-11-23 14:35:06 -05:00
Chris Streeter
13343a8888 Fix name of ssh_opts arg 2015-11-19 14:00:35 -08:00
Brian Coca
4908d4a019 Merge pull request #2235 from tdbabas/devel
Fixing issue with subversion module whereby the module was reporting local modifications being present when externals were being used
2015-10-15 10:25:54 -04:00
Tim Barnes
f0ac28490d fixing issue with subversion module whereby the module was reporting local modifications being present when externals were being used 2015-10-09 15:15:53 +01:00
Andrew Widdersheim
e36e1339e8 Fix detached head detection in is_not_a_branch()
Detached head detection seems to have broken somewhere a long the way
because git decided to change how that situation looks when doing a 'git
branch -a' which is performed by get_branches().

This is how git 1.7.1 displays this situation (which works):

shell> git branch -a
* (no branch)
  master

This is the output from git 1.8.3.1 (which does not work):

shell> git branch -a
* (detached from e132711)
  master

It looks like this same wording is used in the most recent version of
git (2.6.1 as of writing this).
2015-10-06 15:37:45 -04:00
James Cammarata
4de4bd0be6 Merge pull request #465 from bbaumer/devel
SVN 1.7 Support, ignore svn:externals on local mod check and new switch toggle
2015-09-11 13:10:33 -04:00
Brian Coca
57c0b86db4 Merge pull request #721 from jinowolski/devel
update git remote url before ls-remote
2015-09-04 12:46:51 -04:00
Brian Coca
42ccb25182 Merge pull request #1149 from catlee/hg_update
Add support for 'update' parameter to hg module
2015-07-21 20:17:28 -04:00
Benjamin Baumer
8255657ac9 version_added for switch Parameter changed to 2.0
Add comment to explain check_rc Parameter in _exec Function
Optimize code and clean up is_svn_repo Function
2015-07-07 13:38:19 +02:00
Benjamin Baumer
20f76d76a8 Fix: Calling svn info to determine if dest is an svn Working Copy,
to support updates in Subfolders with Subversion > 1.8
Fix: Ignoring svn:externals on local Modification Check.
Add: Added Argument switch to alow skipping the svn switch call.
2015-07-07 12:08:04 +02:00
Matt Martz
4f43c4c09c Replaced tabbed indentation with spaces for subversion module 2015-07-01 09:39:19 -05:00
Brian Coca
2d3e93e558 added doc to note that git the command line tool is required for this moduel to function
fixes http://github.com/ansible/ansible/issues/11358
2015-06-27 00:36:55 -04:00
Greg DeKoenigsberg
2a5f0bde87 Proper author info for all remaining modules 2015-06-15 15:53:30 -04:00
Brian Coca
74e40b5fe1 fixed doc issue with git 2015-06-10 12:42:15 -04:00
Brian Coca
118b00968c Merge pull request #783 from Gugli/fix-svn-has-local-mods-with-externals
Fix subversion module for repos with svn:externals files
2015-06-10 11:12:03 -04:00
Dionysis Grigoropoulos
a9e68692b7
git: Add option to verify GPG signature of commit 2015-06-09 01:51:40 +03:00
Chris AtLee
85cff6699e Add support for 'update' parameter to hg module 2015-04-16 17:06:19 -04:00
Jordan Bach
e4193da47e git: set remote branch before switching versions when using depth argument 2015-03-12 17:06:44 -05:00
Gugli
bec0f06665 Add support for repos with svn:externals files
When a SVN repository has some svn:externals properties, files will be
reported with the X attribute, and lines will be added at the end to
list externals statuses with a text looking like
"Performing status on external item at ....".
Such lines were counted as a local modification by the regex, and the
module returned a change, even though they were none.

To have a clean (and parsable) "svn status" output, it is recommended
to use the --quiet option. The externals will only appear if they have
been modified. With this option on, it seems even safer to consider
there are local modifications when "svn status" outputs anything.
2015-02-13 15:06:15 +01:00
Toshio Kuratomi
be744ce5e7 Reverse the force parameter for the hg module 2015-01-29 18:27:35 -08:00
Jan Inowolski
d7efb2635c update git remote url before ls-remote
related to #8177
2015-01-29 12:40:24 +01:00
Toshio Kuratomi
256ce9dd4d Change the git force parameter to default to no as a safety change.
Fixes #306
2015-01-28 16:26:44 -08:00
Toshio Kuratomi
e2c1a0d2dd Make documentation list when force changed defaults 2015-01-28 16:25:56 -08:00
Toshio Kuratomi
6350e6a4cc Update force documentation to reflect default=no 2015-01-28 16:19:00 -08:00
Toshio Kuratomi
31a56e23f2 Merge pull request #506 from mscherer/fix_370
Fix #370
2015-01-28 16:03:40 -08:00
Toshio Kuratomi
4cf6725cab Merge pull request #93 from natefoo/hg-bugfix
Fix numerous bugs in the hg module
2015-01-07 16:37:58 -08:00
Toshio Kuratomi
8f6ae92cf8 git fetch --tags overwrites normal fetching with git < 1.8.x so do a normal fetch followed by using the refspec format for fetching tags 2014-12-22 15:08:25 -08:00
Toshio Kuratomi
8a03af6608 Fix typo in git refspec code. Change lists to tuples 2014-12-22 12:11:49 -08:00
Toshio Kuratomi
2cbe13a21d Merge pull request #371 from rohanpm/git_refspec
git: add 'refspec' argument
2014-12-22 11:31:12 -08:00
Toshio Kuratomi
ee324fc3ad Make documentation clear about update=no vs clone=no 2014-12-19 08:55:41 -08:00
Rohan McGovern
cf85047284 git: add 'refspec' argument
This argument may be used to fetch additional refs beyond the default
refs/heads/* and refs/tags/*.  Checking out GitHub pull requests or Gerrit
patch sets are two examples where this is useful.

Without this, specifying version=<sha1> with a SHA1 unreachable from any
tag or branch can't work.
2014-12-19 13:13:08 +10:00
Rohan McGovern
c242de1a39 git: clean up "fetch" method
De-duplicate repetitive code checking the exit code.

Include the stdout/stderr of the failed process in all cases.

Remove the returned values because no caller uses them.

Combine git commands where possible.  There is no need to fetch branches
and tags as two separate operations.
2014-12-19 13:13:08 +10:00
Toshio Kuratomi
dfe7f6c6d6 Probably would make clone a 1.9 feature rather than 1.8.3 2014-12-17 13:45:49 -08:00
Toshio Kuratomi
b650ad1671 Make git's update parameter revert to its old behaviour and add new clone parameter to take its place.
Fixes #426
Fixes https://github.com/ansible/ansible/issues/8630
2014-12-17 13:45:49 -08:00