SHA256
1
0
forked from pool/git-deps

Compare commits

...

4 Commits

Author SHA256 Message Date
Git SCM Staging
73f7bfc8d4 Merge pull request 'Fix dont-use-st-markdown.patch (don't list packages explicitly,' (#2) from mcepl_pkgs/git-deps:fix_setup-cfg into factory 2024-07-31 13:55:31 +02:00
9d9fee934c
Fix dont-use-st-markdown.patch (don't list packages explicitly,
generate the list)
2024-07-30 00:37:24 +02:00
Git SCM Staging
d75a4b0fdf Merge pull request 'Update to version 1.1.0+git.1696898573.89d51e8:' (#1) from mcepl_pkgs/git-deps:update_1.1.0 into factory 2024-07-24 10:03:13 +02:00
031f5590d6
Update to version 1.1.0+git.1696898573.89d51e8:
Some checks failed
obs/scm/build
* Only use pygit2's blame via opt-in
  * Blame via pygit2 instead of subprocess
  * Fix deps fetching on the root commit
  * Start test suite of running git-deps on itself
  * Remove dependency to six. Closes #115
  * Remove Travis config
  * Upgrade setuptools
  * Create CI.yml
  * Import `safe_join` from `werkzeug.security`
  * Drop support for Python 3.6
  * Drop setuptools-markdown
  * Handle server port in use error more gracefully (#88)
  * Fix publishing procedure
  * Expand AUTHORS.rst
  * Remove sphinx.ext.pngmath
  * Add maintainer-guide to the docs
  * Be stricter with docs
  * Update sphinx docs location
  * Update CHANGES.rst
  * Add flake8 to Travis
  * Fix some flake8 issues
  * Don't totally ignore KeyboardInterrupt
  * Improve HTML installation instructions slightly
  * Update INSTALL.md for Python 3.x (#98)
  * Update tox.ini for newer Pythons
  * Fix Travis builds (#73)
  * Use line-buffering on output (#87)
  * Bump jquery from 3.0.0 to 3.5.0 in /git_deps/html
Remove upstreamed patches:
  - Fix-issue-with-unbuffered-text-I-O-under-python3.patch
Add compatibility patches:
  - no-pkg-resources.patch
  - pygit2-1.15.0.patch (from gh#aspiers/git-deps!129)
Update to version 1.1.0+git.1655802074.8cafb5c:
  * Import `safe_join` from `werkzeug.security`
  * Drop support for Python 3.6
  * Drop setuptools-markdown
  * Handle server port in use error more gracefully (#88)
  * Fix publishing procedure
  * Expand AUTHORS.rst
  * Remove sphinx.ext.pngmath
  * Add maintainer-guide to the docs
  * Be stricter with docs
  * Update sphinx docs location
  * Update CHANGES.rst
  * Add flake8 to Travis
  * Fix some flake8 issues
  * Don't totally ignore KeyboardInterrupt
  * Improve HTML installation instructions slightly
  * Update INSTALL.md for Python 3.x (#98)
  * Update tox.ini for newer Pythons
  * Fix Travis builds (#73)
  * Use line-buffering on output (#87)
  * Bump jquery from 3.0.0 to 3.5.0 in /git_deps/html
Remove upstreamed Fix-issue-with-unbuffered-text-I-O-under-python3.patch
Switch package to be managed by SCM.
2024-07-19 12:35:11 +02:00
12 changed files with 454 additions and 112 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.osc
git-deps/

View File

@ -1,29 +0,0 @@
From 8d9a7d6dacad4a033f2a4c800ff32137e6e894da Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Wed, 28 Oct 2020 18:09:24 -0600
Subject: [PATCH] Fix issue with unbuffered text I/O under python3
This fix is in an upstream pull request, as shown here:
https://github.com/aspiers/git-deps/pull/93/commits/6beebe034b5c6fd19d73edd774dbf424ea183fee
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
git_deps/cli.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git_deps/cli.py b/git_deps/cli.py
index 9e8b0ab..7882088 100755
--- a/git_deps/cli.py
+++ b/git_deps/cli.py
@@ -135,7 +135,7 @@ def main(args):
if options.serve:
serve(options)
else:
- sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
+ sys.stdout = os.fdopen(sys.stdout.fileno(), 'w')
try:
cli(options, args)
except InvalidCommitish as e:
--
2.29.0

4
_scmsync.obsinfo Normal file
View File

@ -0,0 +1,4 @@
mtime: 1664210914
commit: 4aba29c2c888e72219aa01679b079ed328365d7457df75e4df5465df75979418
url: https://src.opensuse.org/pool/git-deps.git
revision: factory

View File

@ -1,15 +1,15 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="versionprefix">1.0.2+git</param>
<service name="tar_scm" mode="manual">
<param name="versionprefix">1.1.0+git</param>
<param name="url">https://github.com/aspiers/git-deps</param>
<param name="scm">git</param>
<param name="exclude">.git*</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">mcepl@cepl.eu</param>
</service>
<service mode="disabled" name="recompress">
<service mode="manual" name="recompress">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service mode="disabled" name="set_version"/>
<service mode="manual" name="set_version"/>
</services>

View File

@ -1,4 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/aspiers/git-deps</param>
<param name="changesrevision">7c7553151dda8f9abd4c1dc9f0aa8a4c05f65d9a</param></service></servicedata>
<param name="changesrevision">89d51e87a3fe4bdcb1efabbe7a4923958998a61c</param></service></servicedata>

View File

@ -1,68 +1,84 @@
---
setup.cfg | 8 +++++---
setup.py | 25 +------------------------
tests/create-repo.sh | 1 -
3 files changed, 6 insertions(+), 28 deletions(-)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,11 +1,13 @@
[metadata]
name = git-deps
+version = 1.1.0
summary = automatically detect dependencies between git commits
author = Adam Spiers
author_email = git@adamspiers.org
license = GPL-2+
home_page = https://github.com/aspiers/git-deps
-description_file = README.md
+long_description = file: README.md
+long_description_content_type = text/markdown
classifier =
Development Status :: 4 - Beta
Environment :: Console
@@ -32,7 +34,8 @@ data_files =
[options]
packages =
- git_deps
+ find:
+requires = Sphinx
[options.entry_points]
console_scripts =
@@ -48,7 +51,6 @@ addopts = tests
# e.g. --cov-report html (or xml) for html/xml output or --junitxml junit.xml
# in order to write a coverage file that can be read by Jenkins.
addopts =
- --cov git_deps --cov-report term-missing
--verbose
[aliases]
--- a/setup.py
+++ b/setup.py
@@ -8,21 +8,50 @@
http://pyscaffold.readthedocs.org/
"""
+import os
import sys
@@ -1,29 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-"""
- Setup file for git_deps.
-
- This file was generated with PyScaffold, a tool that easily
- puts up a scaffold for your new Python project. Learn more under:
- http://pyscaffold.readthedocs.org/
-"""
-
-import sys
from setuptools import setup
+def read(fname):
+ with open(os.path.join(os.path.dirname(__file__), fname)) as inf:
+ return "\n" + inf.read().replace("\r\n", "\n")
def setup_package():
needs_sphinx = {'build_sphinx', 'upload_docs'}.intersection(sys.argv)
sphinx = ['sphinx'] if needs_sphinx else []
setup(
+ name = "git-deps",
+ description = "automatically detect dependencies between git commits",
+ author = "Adam Spiers",
+ author_email = "git@adamspiers.org",
+ license = "GPL-2+",
+ url = "https://github.com/aspiers/git-deps",
+ long_description = read("README.md"),
+ classifiers = [
+ "Development Status :: 4 - Beta",
+ "Environment :: Console",
+ "Environment :: Web Environment",
+ "Framework :: Flask",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
+ "Natural Language :: English",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ "Topic :: Software Development :: Version Control",
+ "Topic :: Utilities"
+ ],
+ scripts = ["bin/git-fixup"],
+ packages = ["git_deps", "git_deps/listener"],
+ # data_files = "share/git_deps = share/gitfile-handler.desktop",
setup_requires=[
'six',
- 'pyscaffold>=2.5.10,<2.6a0',
- 'setuptools-markdown',
] + sphinx,
- long_description_markdown_filename='README.md',
-def setup_package():
- needs_sphinx = {'build_sphinx', 'upload_docs'}.intersection(sys.argv)
- sphinx = ['sphinx'] if needs_sphinx else []
- setup(
- setup_requires=[
- 'pyscaffold',
- ] + sphinx,
- long_description='README.md',
- long_description_content_type="text/markdown",
- use_pyscaffold=True
+ entry_points = {
+ "console_scripts" : [
+ "git-deps = git_deps.cli:run",
+ "gitfile-handler = git_deps.handler:run"
+ ]
+ }
)
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -45,7 +45,7 @@ if on_rtd:
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo',
'sphinx.ext.autosummary', 'sphinx.ext.viewcode', 'sphinx.ext.coverage',
- 'sphinx.ext.doctest', 'sphinx.ext.ifconfig', 'sphinx.ext.pngmath',
+ 'sphinx.ext.doctest', 'sphinx.ext.ifconfig', 'sphinx.ext.imgmath',
'sphinx.ext.napoleon']
# Add any paths that contain templates here, relative to this directory.
- )
-
-
-if __name__ == "__main__":
- setup_package()
+setup()
--- a/tests/create-repo.sh
+++ b/tests/create-repo.sh
@@ -10,7 +10,6 @@ two
three
four
five
-six
seven
eight
nine

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bfddab6458cb09216f33079bed9cb9754f231617589054839acde0161e0cbdc3
size 591372

BIN
git-deps-1.1.0+git.1696898573.89d51e8.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,74 @@
-------------------------------------------------------------------
Mon Jul 29 22:36:44 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Fix dont-use-st-markdown.patch (don't list packages explicitly,
generate the list)
-------------------------------------------------------------------
Thu Jul 18 14:49:09 UTC 2024 - mcepl@cepl.eu
- Update to version 1.1.0+git.1696898573.89d51e8:
* Only use pygit2's blame via opt-in
* Blame via pygit2 instead of subprocess
* Fix deps fetching on the root commit
* Start test suite of running git-deps on itself
* Remove dependency to six. Closes #115
* Remove Travis config
* Upgrade setuptools
* Create CI.yml
* Import `safe_join` from `werkzeug.security`
* Drop support for Python 3.6
* Drop setuptools-markdown
* Handle server port in use error more gracefully (#88)
* Fix publishing procedure
* Expand AUTHORS.rst
* Remove sphinx.ext.pngmath
* Add maintainer-guide to the docs
* Be stricter with docs
* Update sphinx docs location
* Update CHANGES.rst
* Add flake8 to Travis
* Fix some flake8 issues
* Don't totally ignore KeyboardInterrupt
* Improve HTML installation instructions slightly
* Update INSTALL.md for Python 3.x (#98)
* Update tox.ini for newer Pythons
* Fix Travis builds (#73)
* Use line-buffering on output (#87)
* Bump jquery from 3.0.0 to 3.5.0 in /git_deps/html
- Remove upstreamed patches:
- Fix-issue-with-unbuffered-text-I-O-under-python3.patch
- Add compatibility patches:
- no-pkg-resources.patch
- pygit2-1.15.0.patch (from gh#aspiers/git-deps!129)
-------------------------------------------------------------------
Tue Jul 18 09:45:54 UTC 2023 - mcepl@cepl.eu
- Update to version 1.1.0+git.1655802074.8cafb5c:
* Import `safe_join` from `werkzeug.security`
* Drop support for Python 3.6
* Drop setuptools-markdown
* Handle server port in use error more gracefully (#88)
* Fix publishing procedure
* Expand AUTHORS.rst
* Remove sphinx.ext.pngmath
* Add maintainer-guide to the docs
* Be stricter with docs
* Update sphinx docs location
* Update CHANGES.rst
* Add flake8 to Travis
* Fix some flake8 issues
* Don't totally ignore KeyboardInterrupt
* Improve HTML installation instructions slightly
* Update INSTALL.md for Python 3.x (#98)
* Update tox.ini for newer Pythons
* Fix Travis builds (#73)
* Use line-buffering on output (#87)
* Bump jquery from 3.0.0 to 3.5.0 in /git_deps/html
- Remove upstreamed Fix-issue-with-unbuffered-text-I-O-under-python3.patch
- Switch package to be managed by SCM.
-------------------------------------------------------------------
Fri Sep 23 08:19:58 UTC 2022 - pgajdos@suse.com

View File

@ -16,29 +16,40 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: git-deps
Version: 1.0.2+git.1559732444.7c75531
Version: 1.1.0+git.1696898573.89d51e8
Release: 0
Summary: Tool to analyze git deps
License: GPL-2.0-only
Group: Development/Tools/Version Control
URL: https://github.com/aspiers/git-deps
Source: %{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM dont-use-st-markdown.patch gh#aspiers/git-deps!118 mcepl@suse.com
# update syntax to the current levels and eliminate (almost) setup.py
Patch0: dont-use-st-markdown.patch
Patch1: Fix-issue-with-unbuffered-text-I-O-under-python3.patch
# PATCH-FIX-UPSTREAM pygit2-1.15.0.patch gh#aspiers/git-deps!129 mcepl@suse.com
# make compatible with pygit2 1.15.0
Patch1: pygit2-1.15.0.patch
# PATCH-FIX-UPSTREAM no-pkg-resources.patch gh#aspiers/git-deps!131 mcepl@suse.com
# Don't depend on pkg_resources
Patch2: no-pkg-resources.patch
BuildRequires: fdupes
BuildRequires: git
BuildRequires: python-rpm-macros
BuildRequires: python3-pip
BuildRequires: python3-pygit2
BuildRequires: python3-setuptools
# Because of version = attr: package.__version__
BuildRequires: python3-setuptools >= 46.4.0
BuildRequires: python3-wheel
BuildRequires: python3-pytest
# BuildRequires: python3-certifi
Requires: python3-pygit2
# for html subpackage
Requires: python3-Flask
#Requires: nodejs-browserify # broken/missing
Requires: npm
Requires: git
BuildArch: noarch
%description
@ -57,22 +68,30 @@ Documentation for git-deps.
%autosetup -p1 -n %{name}-%{version}
%build
# https://github.com/aspiers/git-deps/issues/115
sed -i '/six/d' setup.py
python3 -s setup.py build
%python3_pyproject_wheel
%install
python3 -s setup.py install -O1 --skip-build --force --root %{buildroot} --prefix %{_prefix}
%python_expand %fdupes %{buildroot}%{python_sitelib}
%python3_pyproject_install
install -D -m 755 %{buildroot}%{python3_sitelib}/git_deps/handler.py \
%{buildroot}%{_bindir}/gitfile-handler
%python3_fix_shebang
%fdupes %{buildroot}%{python3_sitelib}
%check
# Test doesn't work with tarball, requires .git/ directory with full history
# # because of gh#libgit2/pygit2$1311
# export PYTEST_ADDOPTS="--ignore tests/test_GitUtils.py"
# %%python3_pytest
%files
%{_bindir}/git-deps
%{_bindir}/git-fixup
%{_bindir}/gitfile-handler
%{python_sitelib}/git_deps*
%license LICENSE.txt
%doc AUTHORS.rst CONTRIBUTING.md CHANGES.rst README.md USAGE.md
%doc HISTORY.md USE-CASES.md
%{_bindir}/git-deps
# %%{_bindir}/git-fixup
%{_bindir}/gitfile-handler
%{python3_sitelib}/git_deps
%{python3_sitelib}/git_deps-1.1.0*-info
%files html
%doc docs

25
no-pkg-resources.patch Normal file
View File

@ -0,0 +1,25 @@
---
git_deps/__init__.py | 7 +------
setup.cfg | 2 +-
2 files changed, 2 insertions(+), 7 deletions(-)
--- a/git_deps/__init__.py
+++ b/git_deps/__init__.py
@@ -1,6 +1 @@
-import pkg_resources
-
-try:
- __version__ = pkg_resources.get_distribution(__name__).version
-except pkg_resources.DistributionNotFound:
- __version__ = 'unknown'
+__version__ = '1.1.0'
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = git-deps
-version = 1.1.0
+version = attr: git_deps.__version__
summary = automatically detect dependencies between git commits
author = Adam Spiers
author_email = git@adamspiers.org

235
pygit2-1.15.0.patch Normal file
View File

@ -0,0 +1,235 @@
From a1c990c8419ef4d03de86ae7ef7ea94b32fce1c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20Koutn=C3=BD?= <mkoutny@suse.com>
Date: Wed, 3 Jul 2024 19:25:40 +0200
Subject: [PATCH 1/3] pygit2 update: Use id when indexing into repo objects
---
git_deps/detector.py | 36 ++++++++++++++++++------------------
git_deps/gitutils.py | 4 ++--
git_deps/listener/cli.py | 6 +++---
git_deps/listener/json.py | 8 ++++----
git_deps/server.py | 2 +-
5 files changed, 28 insertions(+), 28 deletions(-)
--- a/git_deps/detector.py
+++ b/git_deps/detector.py
@@ -95,19 +95,19 @@ class DependencyDetector(object):
abort(e.message())
self.todo.append(dependent)
- self.todo_d[dependent.hex] = True
+ self.todo_d[str(dependent.id)] = True
first_time = True
while self.todo:
- sha1s = [commit.hex[:8] for commit in self.todo]
+ sha1s = [str(commit.id)[:8] for commit in self.todo]
if first_time:
self.logger.info("Initial TODO list: %s" % " ".join(sha1s))
first_time = False
else:
self.logger.info(" TODO list now: %s" % " ".join(sha1s))
dependent = self.todo.pop(0)
- dependent_sha1 = dependent.hex
+ dependent_sha1 = str(dependent.id)
del self.todo_d[dependent_sha1]
self.logger.info(" Processing %s from TODO list" %
dependent_sha1[:8])
@@ -140,7 +140,7 @@ class DependencyDetector(object):
merge commits which have multiple parents.
"""
self.logger.info(" Finding dependencies of %s via parent %s" %
- (dependent.hex[:8], parent.hex[:8]))
+ (str(dependent.id)[:8], str(parent.id)[:8]))
diff = self.repo.diff(parent, dependent,
context_lines=self.options.context_lines)
for patch in diff:
@@ -159,7 +159,7 @@ class DependencyDetector(object):
line_range_before = "-%d,%d" % (hunk.old_start, hunk.old_lines)
line_range_after = "+%d,%d" % (hunk.new_start, hunk.new_lines)
self.logger.info(" Blaming hunk %s @ %s (listed below)" %
- (line_range_before, parent.hex[:8]))
+ (line_range_before, str(parent.id)[:8]))
if not self.tree_lookup(path, parent):
# This is probably because dependent added a new directory
@@ -168,7 +168,7 @@ class DependencyDetector(object):
blame = self.run_blame(hunk, parent, path)
- dependent_sha1 = dependent.hex
+ dependent_sha1 = str(dependent.id)
self.register_new_dependent(dependent, dependent_sha1)
line_to_culprit = {}
@@ -185,14 +185,14 @@ class DependencyDetector(object):
orig_line_num = blame_hunk.orig_start_line_number
line_num = blame_hunk.final_start_line_number
- dependency_sha1 = blame_hunk.orig_commit_id.hex
+ dependency_sha1 = str(blame_hunk.orig_commit_id.hex)
line_representation = f"{dependency_sha1} {orig_line_num} {line_num}"
self.logger.debug(f" ! {line_representation}")
dependency = self.get_commit(dependency_sha1)
for i in range(blame_hunk.lines_in_hunk):
- line_to_culprit[line_num + i] = dependency.hex
+ line_to_culprit[line_num + i] = str(dependency.id)
if self.is_excluded(dependency):
self.logger.debug(
@@ -239,12 +239,12 @@ class DependencyDetector(object):
def run_blame(self, hunk, parent, path):
if self.options.pygit2_blame:
return self.repo.blame(path,
- newest_commit=parent.hex,
+ newest_commit=str(parent.id),
min_line=hunk.old_start,
max_line=hunk.old_start + hunk.old_lines - 1)
else:
return blame_via_subprocess(path,
- parent.hex,
+ str(parent.id),
hunk.old_start,
hunk.old_lines)
@@ -285,9 +285,9 @@ class DependencyDetector(object):
if dependency_sha1 not in self.dependencies:
if self.options.recurse:
self.todo.append(dependency)
- self.todo_d[dependency.hex] = True
+ self.todo_d[str(dependency.id)] = True
self.logger.info(" + Added %s to TODO" %
- dependency.hex[:8])
+ str(dependency.id)[:8])
def record_dependency_source(self, parent,
dependent, dependent_sha1,
@@ -304,7 +304,7 @@ class DependencyDetector(object):
abort("line %d already found when blaming %s:%s\n"
"old:\n %s\n"
"new:\n %s" %
- (line_num, parent.hex[:8], path,
+ (line_num, str(parent.id)[:8], path,
dep_sources[path][line_num], line))
dep_sources[path][line_num] = line
@@ -314,9 +314,9 @@ class DependencyDetector(object):
dependent, dependency, path, line_num)
def branch_contains(self, commit, branch):
- sha1 = commit.hex
+ sha1 = str(commit.id)
branch_commit = self.get_commit(branch)
- branch_sha1 = branch_commit.hex
+ branch_sha1 = str(branch_commit.id)
self.logger.debug(" Does %s (%s) contain %s?" %
(branch, branch_sha1[:8], sha1[:8]))
@@ -349,7 +349,7 @@ class DependencyDetector(object):
dirent = segments.pop(0)
if isinstance(tree_or_blob, pygit2.Tree):
if dirent in tree_or_blob:
- tree_or_blob = self.repo[tree_or_blob[dirent].oid]
+ tree_or_blob = self.repo[tree_or_blob[dirent].id]
# self.logger.debug(" %s in %s" % (dirent, path))
if path:
path += '/'
@@ -358,11 +358,11 @@ class DependencyDetector(object):
# This is probably because we were called on a
# commit whose parent added a new directory.
self.logger.debug(" %s not in %s in %s" %
- (dirent, path, commit.hex[:8]))
+ (dirent, path, str(commit.id)[:8]))
return None
else:
self.logger.debug(" %s not a tree in %s" %
- (tree_or_blob, commit.hex[:8]))
+ (tree_or_blob, str(commit.id)[:8]))
return None
return tree_or_blob
--- a/git_deps/gitutils.py
+++ b/git_deps/gitutils.py
@@ -63,7 +63,7 @@ class GitUtils(object):
@classmethod
def commit_summary(cls, commit):
- return "%s %s" % (commit.hex[:8], cls.oneline(commit))
+ return "%s %s" % (str(commit.id)[:8], cls.oneline(commit))
@classmethod
def refs_to(cls, sha1, repo):
@@ -74,7 +74,7 @@ class GitUtils(object):
dref = symref.resolve()
oid = dref.target
commit = repo.get(oid)
- if commit.hex == sha1:
+ if str(commit.id) == sha1:
matching.append(symref.shorthand)
return matching
--- a/git_deps/listener/cli.py
+++ b/git_deps/listener/cli.py
@@ -20,14 +20,14 @@ class CLIDependencyListener(DependencyLi
self._revs = {}
def new_commit(self, commit):
- rev = commit.hex
+ rev = str(commit.id)
if rev not in self._revs:
self._revs[rev] = 0
self._revs[rev] += 1
def new_dependency(self, dependent, dependency, path, line_num):
- dependent_sha1 = dependent.hex
- dependency_sha1 = dependency.hex
+ dependent_sha1 = str(dependent.id)
+ dependency_sha1 = str(dependency.id)
if self.options.multi:
if self.options.log:
--- a/git_deps/listener/json.py
+++ b/git_deps/listener/json.py
@@ -31,7 +31,7 @@ class JSONDependencyListener(DependencyL
"""Adds the commit to the commits array if it doesn't already exist,
and returns the commit's index in the array.
"""
- sha1 = commit.hex
+ sha1 = str(commit.id)
if sha1 in self._commits:
return self._commits[sha1]
title, separator, body = commit.message.partition("\n")
@@ -62,8 +62,8 @@ class JSONDependencyListener(DependencyL
self.add_commit(commit)
def new_dependency(self, parent, child, path, line_num):
- ph = parent.hex
- ch = child.hex
+ ph = str(parent.id)
+ ch = str(child.id)
new_dep = {
'parent': ph,
@@ -76,7 +76,7 @@ class JSONDependencyListener(DependencyL
self._json['dependencies'].append(new_dep)
def dependent_done(self, dependent, dependencies):
- commit = self.get_commit(dependent.hex)
+ commit = self.get_commit(str(dependent.id))
commit['explored'] = True
def json(self):
--- a/git_deps/server.py
+++ b/git_deps/server.py
@@ -105,7 +105,7 @@ def serve(options):
detector.find_dependencies(rev)
tip_commit = detector.get_commit(revisions[0])
- tip_sha1 = tip_commit.hex
+ tip_sha1 = str(tip_commit.id)
json = listener.json()
json['query'] = {