summaryrefslogtreecommitdiff
path: root/gbp/git/repository.py
AgeCommit message (Collapse)AuthorFilesLines
2024-07-22Fix some build errors on ubuntu 24.04HEADmasterdevelxuhy1-2/+2
sgml2x is not available on ubuntu 24.04. version is slower than that from ubuntu 24.04 mirrors. Change-Id: I209cf79a219d016c40e6ec71d80879572bb6ec97 Signed-off-by: xuhy <huayong.xu@samsung.com>
2023-09-14Fix gbs export errorŁukasz Stelmach1-3/+3
Decode second file paths for R and C statuses too Change-Id: I27dd3ef66039ae15229d38509a18dfe2ea025c81 Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
2023-06-13fix build error during gbs funtion testbiao716.wang1-5/+5
https://github.com/agx/git-buildpackage/commit/1b5a47f4bda5d8809998750c3a35b4e02c8b2851 https://github.com/agx/git-buildpackage/commit/1b5a47f4bda5d8809998750c3a35b4e02c8b2851 modify patch file wrong encoding. https://github.com/agx/git-buildpackage/commit/c4bc6561c788f71b5131d0bd8e92478e83808200 pq: don't eagerly encode email headers https://github.com/agx/git-buildpackage/commit/9dc2129c4448416f43300ce859f1e1f4a1070048 pq: properly retry non-ascii charset on patch body encode https://github.com/agx/git-buildpackage/commit/04ae7d5654684d8077a4125c90e36f4195057fa9 git: Don't decode diff output https://github.com/agx/git-buildpackage/commit/c159d0ba16636bc3692b89555b258a3bc7907902 pq export: Write out patches as UTF-8 if necessary Change-Id: I6982c800361b8cc1ad4c16211fca450803e5eb02 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
2022-12-02fix run error for gbpbiao716.wang1-1/+1
Change-Id: If8a7cfbd61cea46af63612c76b2934774468130a Signed-off-by: biao716.wang <biao716.wang@samsung.com>
2022-11-30fix run error for re.sub(): KeyError: '\S'biao716.wang1-9/+9
It seems backslash handling changed in Python3.8: https://docs.python.org/3.8/library/re.html Change-Id: I43c9e9baa13598015fb9ef801bd435e78945c309 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
2022-11-28porting code to python3.x with os patchbiao716.wang1-128/+146
Change-Id: I3deda71d6bde7c3363800d79d2e9ae6998bdb9e7 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
2022-10-28port code from python2.x to python3.xbiao716.wang1-5/+5
Change-Id: I798c72d07e44839cc5d1e25ec75fca0bd8068567 Signed-off-by: biao716.wang <biao716.wang@samsung.com>
2016-12-26Adapt git-merge option when git version greater then 2.9Jun Wang1-0/+7
Change-Id: Icd9cb9edc8517095984c0a0f497173e2f068aa20
2016-12-26GitRepository: Fix diff_status() for renames and copiesJiankang Fan1-1/+2
When file has been renamed or copied git places two filepaths in a status line. Previously, we concatenated them (with additional \x00) and put into a single record in results dictionary. This leads to records like: 'libusbg.pc.in\x00libusbgx.pc.in' and result in a exception while trying to invoke git diff on such record: error: Traceback (most recent call last): File "/usr/bin/gbs", line 628, in <module> sys.exit(main(sys.argv)) File "/usr/bin/gbs", line 622, in main return module.main(args) File "/usr/lib/pymodules/python2.7/gitbuildsys/cmd_export.py", line 302, in main export_sources(repo, commit, export_dir, main_spec, args) File "/usr/lib/pymodules/python2.7/gitbuildsys/cmd_export.py", line 222, in export_sources ret = gbp_build(gbp_args) File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage_rpm.py", line 588, in main export_patches(repo, spec, patch_tree, options) File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage_rpm.py", line 283, in export_patches update_patch_series(repo, spec, upstream_tree, export_treeish, options) File "/usr/lib/python2.7/dist-packages/gbp/scripts/pq_rpm.py", line 211, in update_patch_series spec.specdir, options) File "/usr/lib/python2.7/dist-packages/gbp/scripts/pq_rpm.py", line 144, in generate_patches options.patch_export_ignore_path) File "/usr/lib/python2.7/dist-packages/gbp/scripts/common/pq.py", line 290, in format_diff text=True) File "/usr/lib/python2.7/dist-packages/gbp/git/repository.py", line 1813, in diff output, stderr, ret = self._git_inout('diff', options.args) File "/usr/lib/python2.7/dist-packages/gbp/git/repository.py", line 187, in _git_inout capture_stdout): File "/usr/lib/python2.7/dist-packages/gbp/git/repository.py", line 245, in __git_inout cwd=cwd) File "/usr/lib/python2.7/subprocess.py", line 679, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1252, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings To fix this let's add each filepath as a seprate record as git diff command will understand our intentions perfectly. Change-Id: I4955bf341147d84880fb2aac49b19a290f1465e5 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2016-01-29fix bugsJun Wang1-18/+0
Change-Id: I406d49bdbfb8b978b62a6bb1fb770df37043f81c
2016-01-28GitRepository.create_tag: add 'annotate' argumentMarkus Lehtonen1-2/+6
For forcing the creation of annotated tags. Causes the an editor to be spawned if no message is given. Change-Id: I8ec7e195cf7ae997606af1d887f04e84a14b2abc Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-01-28GitRepository.create_tag: use GitArgs classMarkus Lehtonen1-7/+7
Change-Id: I8ead4dda504152bde4c35ee0c03d6e3295820fd6 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-01-28GitRepository/__git_inout: correctly handle input errorMarkus Lehtonen1-1/+6
Change-Id: I3c9b8851490c05719f77a9519418a98f572d68e3 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-01-27GitRepository: implement create_tree methodMarkus Lehtonen1-0/+18
New method for creating tree objects from a directory content. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-01-27GitRepository.archive: add 'paths' optionMarkus Lehtonen1-1/+3
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-01-27GitRepository.archive: drop the '**kwargs' argumentMarkus Lehtonen1-3/+1
Unused and misleading. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Conflicts: gbp/git/repository.py
2014-06-30GitRepository/has_submodules: add treeish argumentMarkus Lehtonen1-4/+9
For defining a Git treeish which to look into, instead of the current working copy. Change-Id: I27abd99f0416bd4300953d3c1bae2d99de3ab6c0 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository/get_remote_repos: return URLs, tooMarkus Lehtonen1-3/+18
In addition to the remote name, return remote URLs. Return value is now a dict with remote name as the key and a list of URLs as the value. The first value in the list is the effective fetch URL, the rest of the values are push URLs. NOTE! This patch is to be dropped, not going for upstream. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05CentOS compatibility: fix GitRepository.diffMarkus Lehtonen1-1/+1
Remove the "all" parameter from --ignore-submodules which is not supported by the old Git version of CentOS 6 (besides, it's the default, anyway) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05CentOS compatibility: fix GitRepository._cmd_has_feature()Markus Lehtonen1-1/+2
Make it work in CentOS 6.3 with older git by removing backspace characters when examining man page section names. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository/add_files: add new option 'untracked'Markus Lehtonen1-2/+4
With this option you can either only update already tracked files to index the (untracked=False) or add new files, too. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository: add diff_status methodMarkus Lehtonen1-0/+27
This is a method of getting the filename and status information of a diff. That is, a list of files that changed and their status, "added", "modified" etc. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.add_files: consistently update ALL tracked filesMarkus Lehtonen1-0/+1
Use the --all option of git-add so that all tracked files are updated in all conditions. Previously deletion of tracked files was not staged, for example. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.add_files: use GitArgsMarkus Lehtonen1-5/+4
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository: allow repo inititialization from subdirMarkus Lehtonen1-12/+30
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>
2014-06-05GitRepository: Implement status methodEd Bartosh1-0/+33
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>
2014-06-05GitRepository: raise GitRepositoryError instead of GbpErrorMarkus Lehtonen1-3/+3
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository/rev_parse: use _git_inout()Markus Lehtonen1-2/+3
instead of the deprecated _git_getoutput() method. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository/git_command: strip stderr output in case of errorMarkus Lehtonen1-1/+2
In order to get rid of extra line feeds in exception message. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.archive: add 'paths' optionMarkus Lehtonen1-1/+5
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.create_branch: add 'force' optionMarkus Lehtonen1-1/+3
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.commit_files: add edit argumentMarkus Lehtonen1-5/+8
In order to be able to spawn an editor, similarly to other commitX methods in GitRepository. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.commit_all: add committer_info argumentMarkus Lehtonen1-2/+6
For setting the committer name/email/date - similarly to author_info. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.commit_files: add committer_info argumentMarkus Lehtonen1-3/+9
For setting the committer name/email/date - similarly to author_info. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository: implement create_tree methodMarkus Lehtonen1-9/+19
New method for creating tree objects from a directory content. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.archive: drop the '**kwargs' argumentMarkus Lehtonen1-4/+3
Unused and misleading. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository: fix the 'edit' mode in commit methodsMarkus Lehtonen1-8/+6
Previously the editor would not show in the shell because stdout was captured. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository: allow interactive commandsMarkus Lehtonen1-10/+19
Make it possible for git commands to output directly to stdout without redirection (i.e. capturing their stdout stream). Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.archive: support getting tar data as return valueMarkus Lehtonen1-7/+17
Return tar data as a generator object, if the 'output' option is not defined. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository.__git_inout: prevent blocking of stdinMarkus Lehtonen1-6/+12
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-06-05GitRepository: new method for getting git output as generatorMarkus Lehtonen1-25/+86
Add a new _git_inout2() helper method that returns the git output (stdout) as a generator - instead of all stdout data in one string. Useful for handling git commands that are expected to have a lot of stdout data, like git-archive. Also, changes the private __git_inout() method to return a generator. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-05-16Fix comitter vs committer typosGuido Günther1-1/+1
Thanks: Sandro Tosi Closes: #748339
2014-04-02Revert "GitRepository/add_remote_repo: fix the 'tags' argument"Markus Lehtonen1-1/+1
Which caused an unwanted behavior of not fetching refs/heads at all -- only tags were fetched. This reverts commit 5dd598fb8f2a9109189fad6cf631811f12ce2130 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-03-27GitRepository/add_remote_repo: fix the 'tags' argumentMarkus Lehtonen1-1/+1
Explicitly use --tags in git arguments - otherwise tags might not be fetched. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2014-03-27GitRepository/get_commit_info: correctly handle file renames/copiesMarkus Lehtonen1-1/+2
Use the '--no-renames' git command line option in order to prevent two filenames per entry. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2013-10-22gbp-clone: support repo URLs like "host:repo.git"Guan Junchun1-1/+4
Previously, gbp didn't correctly parse this kind of URL and clone failed. Signed-off-by: Guan Junchun <junchunx.guan@intel.com> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2013-10-16Be more robust about git status output changesGuido Günther1-18/+21
by using --porcelain. Heavily based on a patch by rian m. carlson Closes: #726260
2013-09-10GitRepository: deprecate the get_remote_repos methodMarkus Lehtonen1-0/+2
Superceded byt the get_remotes() method. Change-Id: I34f9e8b8188b5a40ce21d2f74e6068f2aaec9e60 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2013-09-10GitRepository.has_remote_repo: use get_remotes methodMarkus Lehtonen1-1/+1
Use the new get_remotes() method Change-Id: Ic34cf590a6f36e6fa0af2ffbe932c8ae3a198944 Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2013-09-10git: new class and method for remote repositoriesMarkus Lehtonen1-0/+61
Add a new GitRemote class for representing git remote repositories. The initial, very limited, version only contains information about the fetch and push URLs of the remote repository. Also, add a new GitRepository.get_remotes() method for getting remote repositories as instances of the new GitRemote class. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>