PEP-8 and pyflakes cleanups
Add support dch's --security option
Print number of tries left
Fix  testsuite failure if DEB_VENDOR != Debian

The package fails to build from source if the DEB_VENDOR is not Debian,
as the test output from git-dch expects Debian distribution specific
behaviour.

You can see the failed build log with DEB_VENDOR=Ubuntu here:
https://launchpadlibrarian.net/121690052/buildlog_ubuntu-raring-i386.git-buildpackage_0.6.0~git20120822_FAILEDTOBUILD.txt.gz

Closes: #692289

Signed-off-by: Guido Günther <agx@sigxcpu.org>
GitRepository.find_tag: change deprecated _git_getoutput to _git_inout

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/rev_parse: use _git_inout()

instead of the deprecated _git_getoutput() method.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: implement _cmd_has_feature() method

This method is intended for checking if the local git (client) command
supports a certain feature. The "feature" is considered to be a
command line option. E.g. does "merge" command have the "edit" feature
translates to does git-merge support the '--edit' command line option.

To figure this out, _cmd_has_feature() parses through the "OPTIONS"
section of the man page of the git command.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: fix merge() for older git versions

Utilize _cmd_has_feature() in GitRepository.merge() to not give
edit/no-edit option for older versions of git-merge, that don't support
it. Fixes a regression (with git-version < 1.7.8) caused by commit
f3aa87fa0361a.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Support unit tests on Ubuntu: allow "ubuntu" as part of version

In tests/11_test_dch_main.py, there are checks for package names. This
change adds "ubuntu" and related strings ORed in regexp match to the
patterns that are expecteds in assert statements.

Signed-off-by: Olev Kartau <olev.kartau@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/diff: add 'paths' argument

Makes the diff function more versatile. I.e. makes diffing only certain
paths possible. Also, add basic unittests for the diff() method.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/diff: catch git error

Raise an exception if the git command fails. Also, utilize _git_inout()
instead of the deprecated _git_getoutput().

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: Implement status method

Simple wrapper to the git-status command.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/get_submodules: use correct path

By default, run git in the repo path, not current cwd. Also, now returns
submodule paths without leading './'.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: allow repo inititialization from subdir

This allows initialization of a GitRepository object, even if the
current working directory (or path given to GitRepository) is not the
top level directory of the git repository.

Don't guess the git meta data dir, but, take it as reported by git
itself.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/has_submodules: use correct .gitmodules file

Examine .gitmodules from the "root directory" of the repo, not the
current working directory. Fixes has_submodules() method, when called
from arbitrary cwd.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Logger: Add COLOR_YELLOW for warning message

and use 'warning' as prefix instead of 'warn' abbreviation, this is
more consistent.

Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Logger: Change color of debug messages to magenta

Signed-off-by: Huang Hao <hao.h.huang@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp.git: Reimplement rfc822 date parsing without dateutil

In order to get rid of dependency to dateutil.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
tests: add test for archiving without git submodules

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
common/buildpackage: support for different archive formats

Adds support for defining the archive format of the output of
git_archive_single(), e.g. 'zip'. Defaults to 'tar', as before.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>