Skip to main content

resolve-hash

Allow to resolve a hash to a known URL representation.

Usage

resolve-hash <hash> outputs URL matching the hash

Output: URL matching the hash, if found

Exit code:

  • 0 if the hash has been found
  • 1 if the hash has NOT been found

Example:

$ resolve-hash 8d8645468228
https://devcentral.nasqueron.org/rKERUALD8d8645468228

$ resolve-hash 00000000000000                                                                                                                                               (git)-[main] 
https://github.com/seungwonpark/ghudegy-chain/commit/00000000000000c06d2e8c36f247206a9a4b1c63

$ resolve-hash not_a_hash
$ echo $?
1

Why this package?

Terminator has a comprehensive plugins' system to offer extra features, like resolve console output as links.

Meanwhile, it's sometimes convenient to open a link in a browser, especially if the VCS hash is resolved to the code review system.

Hash sources

VCS

  • Phabricator, browsing your .arcrc file to know the instances you work with
  • Gerrit, if explicitly configured
  • GitHub
  • GitLab, if you provide a token, as search queries must be authenticated

Configuration

You can provide a configuration by creating a $HOME/.config/resolve-hash.conf file.

Configuration is a YAML file.

Variable Description Format
gerrit URL to your Gerrit instances List of strings
gitlab_public_token Personal token for GitLab.com string

Example:

gerrit:
  - https://gerrit.wikimedia.org/r/

gitlab_public_token: glpat-sometoken

Use as a library

You can use the package as a library to resolve hashes in your application:

from resolvehash.vcs import phabricator

url = phabricator.query_phabricator_instances("/home/luser/.arcrc", "8d8645468228")
print(url)

Extend the code

How to add a new VCS source?

If you wish to add a new VCS source, add a method in VcsHashSearch, then add it to get_search_methods.

How to add a hash source?

If you wish to extend this script by searching Foo in addition to VCS, you can create a class FooHashSearch with the following methods:

  • __init__(self, config, needle_hash): constructor called by the script
  • search(self): perform your search, return a URL or None

How can I contribute?

You can commit your changes to the upstream by following instructions at https://agora.nasqueron.org/How_to_contribute_code

The canonical repository is https://devcentral.nasqueron.org/source/resolve-hash.git

License

BSD-2-Clause, see LICENSE file.

Metadata

Release files for resolve-hash 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for resolve-hash 0.1.0
File Size Uploaded
resolve-hash-0.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for resolve-hash 0.1.0
File Interpreter ABI Platform
resolve_hash-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.6 kB

Release files / resolve-hash-0.1.0.tar.gz

Download URL resolve-hash-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
45d179474e9477478bfeea3c10f64d22eba2173d7c1513626a1bb545bf2b2fc3
BLAKE2b-256 checksum
How to use checksums
a5ef715383c39d7b0477608c974eb0132eac28bc288cb510315b8ba9185a0a4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / resolve_hash-0.1.0-py3-none-any.whl

Download URL resolve_hash-0.1.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
230269afdf89c6bc53f6378afeb29ec96fc0ba4e6cfbe51f56dcf785772c4dac
BLAKE2b-256 checksum
How to use checksums
b1c28493baddd4733192bdf803a7402dc392b314287e708cc6a76956d2c839f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page