I try to make the Mercurial work with my existing Bugzilla setup. however, it didn't work. The local hgrc is attached below for reference.
My question is, how I can trace whether the bugzilla is called/executed once I submit a "hg commit"?
Every time I do a commit, the following error is presented, and I suspect the bugzilla is not executed.
[root test01]# hg -v com -m "BZ 686" file
could not import hgext.hgext.bugzilla (No module named hgext.bugzilla): trying hgext.bugzilla
file
committed changeset 57:0c26a22fc01f
If I configured the extension as below, there is no error, but there is no comment insert into the Bugzilla DB. So it means this also does not work.
[extensions]
bugzilla = /usr/local/lib64/python2.5/site-packages/hgext/bugzilla.py
please help!
paul
P.S. below is the content of the hgrc file.
============
[extensions]
hgext.bugzilla =
[ui]
debug = true
verbose = True
[web]
contact = Admin <db#127.0.0.1>
description = Testing
allow_push = account01
push_ssl = False
baseurl = /HG001/DEV/test01
[hooks]
incoming.bugzilla = python:hgext.bugzilla.hook
[bugzilla]
host = 127.0.0.1
db = bugs
password = db
version = 3.0
strip = 4
bzuser = db#1.0.0.127
hgweb = http://127.0.0.1
bzdir = /var/www/html/bugzilla
template = Changeset {node|short}, made by {author} in the {webroot} repos, refers to this bug.\n
For complete details, see
{hgweb}{webroot}?cmd=changeset;node={node|short}\n
Changeset Description:\n
\t{desc|tabindent}
[usermap]
hguser=bugzilla.user#domain.com
Thanks. BTW, I tried to use the debug mode during the "hg commit". it is found that the hooks are really not being called to execute. any idea?
[root test01]# hg --verbose --debug --traceback --debugger com -m "BZ 686:a" file
entering debugger - type c to continue starting hg or h for help
/HG001/PD/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(86)_runcatch()
(Pdb) b 3
End of file
(Pdb) r
d
committed changeset 75:4b90f38e600ac153ec305413345d2836c6358c50
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(89)_runcatch()->None
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(64)dispatch()->None
(Pdb) r
SystemExit: None
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()->None
(Pdb) r
SystemExit: None
/usr/local/bin/hg(38)()
-> mercurial.dispatch.run()
(Pdb)
if I run a simple hooks [running hook pretxncommit], I can see it is being executed. but the "incoming.bugzilla" seems not being called.
I also use the "hg help extensions" in my execeution path, the bugzilla extension id enabled.
enabled extensions:
bugzilla
hooks for integrating with the Bugzilla bug tracker
[root# test01]# hg --verbose --debug --traceback --debugger com -m "BZ 686:a" d
entering debugger - type c to continue starting hg or h for help
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(86)_runcatch()
-> try:
(Pdb) r
rd
running hook pretxncommit.bug_id_required: ./check_bug_id $HG_NODE
rcommitted changeset 82:dcadb6ed6c0a28a76d25473ab2f5346967e9b103
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(89)_runcatch()->None
-> ui.flush()
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(64)dispatch()->None
-> return _runcatch(req)
(Pdb) r
SystemExit: None
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()
-> sys.exit(dispatch(request(sys.argv[1:])))
(Pdb) r
--Return--
/HG001/DEV/test01/usr/local/lib64/python2.5/site-packages/mercurial/dispatch.py(27)run()->None
-> sys.exit(dispatch(request(sys.argv[1:])))
(Pdb) r
SystemExit: None
/usr/local/bin/hg(38)()
-> mercurial.dispatch.run()
(Pdb) r
--Return--
/usr/local/bin/hg(38)()->None
-> mercurial.dispatch.run()
(Pdb) r
The extension should be just bugzilla, as far as I remember.
[extensions]
bugzilla =
And probably the hook should also be plain bugzilla.hook instead of hgext.bugzilla.hook.
Related
I have a package build in https://copr.fedoraproject.org. My spec for rpkg is here. The build is failing with the following
Generated rpkg config:
[rpkg]
preprocess_spec = True
[git]
anon_clone_url = https://github.com/%(repo_path)s
[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
Writing config into /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
rc: 1
stdout: Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date: Sat Apr 9 01:04:32 2022 +0200
add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory
Copr build error: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date: Sat Apr 9 01:04:32 2022 +0200
add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory
(full log at https://download.copr.fedorainfracloud.org/results/jdanek/skupper-router/srpm-builds/04126008/builder-live.log.gz)
On my machine, running rpkg srpm succeeds.
I searched around and it seems to me that COPR should be willing to download sources if they are distributed over https, which mine are.
Can I use the lookaside cache feature, somehow, for my sources?
Normally, downloading the qpid-proton file by https would work in Copr. It's done by rpmbuild (being invoked by rpkg) if there is %_disable_source_fetch 0 defined in rpm macros somewhere.
The problem is that one of the lines in the spec file is: %undefine _disable_source_fetch which disables this behavior for the given spec file.
Your build fails on the git_dir_pack (rpkg-util, aka rpkg failure). This happened before the rpmbuild process even started.
A few weeks ago we migrated the Copr builders to Fedora 35,
and thus also to rpkg-util v3. Feel free to take a look how
to fix similar issues.
Or perhaps contact the rpkg-util upstream for a guidance.
The problem is that the sources file apparently must be downloaded from the lookaside cache. So, let's create ourselves one. Or at least, the appearance of one.
First, download the required source archive to your computer, to the git repo checkout dir, and do an "offline upload" using rpkg
wget https://www.apache.org/dist/qpid/proton/0.37.0/qpid-proton-0.37.0.tar.gz
rpkg upload --offline qpid-proton-0.37.0.tar.gz
This creates sources file. Commit that to the repo. Undo the edit to .gitignore that this also did. (If that rpkg command fails, ignore that as long as the sources file got created.)
Create new file rpkg.conf with the following content, and commit it to repo.
[lookaside]
download_url = https://www.apache.org/dist/qpid/proton/0.37.0/%(filename)s
Now push that and build it in COPR.
(Don't get confused by the obviously wrong download_url printed below; our rpkg.conf in the repo directory is overriding that.)
Running: git checkout jd_2022_03_15_rpm_cstdint
cmd: ['git', 'checkout', 'jd_2022_03_15_rpm_cstdint']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: branch 'jd_2022_03_15_rpm_cstdint' set up to track 'origin/jd_2022_03_15_rpm_cstdint'.
stderr: Switched to a new branch 'jd_2022_03_15_rpm_cstdint'
Generated rpkg config:
[rpkg]
preprocess_spec = True
[git]
anon_clone_url = https://github.com/%(repo_path)s
[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s
Writing config into /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: Downloading qpid-proton-0.37.0.tar.gz from jiridanek/skupper-router at www.apache.org:
Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
Wrote: /var/lib/copr-rpmbuild/results/skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router:
commit d7714b9cac0641d4e34c0774b875fcb67cee8793 (HEAD -> jd_2022_03_15_rpm_cstdint, origin/jd_2022_03_15_rpm_cstdint)
Author: Jiri Daněk <jdanek#redhat.com>
Date: Wed Apr 13 17:13:22 2022 +0200
add autopack
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-d7714b9c.tar.gz
Output: ['skupper-router.spec', 'qpid-proton-0.37.0.tar.gz', 'skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm', 'skupper-router-d7714b9c.tar.gz']
Success!
I have added an extension evolve = into .hgrc and it throws
extension 'evolve' overrides commands: uncommit
I also commented ; uncommit = extension but when I do that cmder gets confused by that error because it shows C:\dev\WebApp 'evolve' instead of C:\dev\WebApp (dev)
How to fix/suppress this evolve-related warning (or error) in mercurial?
I'm trying to get a bitbake file to pull down the latest revision of a mercurial repo when it builds. It's unfortunately undocumented (https://www.yoctoproject.org/docs/1.6/bitbake-user-manual/bitbake-user-manual.html#auto-revisions), though there are a few mailing list posts on the topic. None of my attempts to recreate their methods have panned out.
This is what the .bb file looks like:
###############################################################################
# Variables for locations.
###############################################################################
SRC_URI = "hg://foo//bar/foobar/test;rev=${SRCREV};protocol=ssh;branch=default;module=root"
SRCREV = "${AUTOREV}"
# Sources are downloaded to an hg subdirectory when pulling a repo.
S = "${WORKDIR}/hg"
###############################################################################
# The version of the library we're going to install.
###############################################################################
# Set PV to SRCPV so bitbake knows it should always check SRC_URI for a new
# version of the application.
PV = "${SRCPV}"
PR = "r0"
PE = "1"
And here's the relevant part of the output error:
/usr/bin/env hg up -C -r AUTOINC
| DEBUG: Python function base_do_unpack finished
| DEBUG: Python function do_unpack finished
| ERROR: Function failed: Fetcher failure: Fetch command failed with exit code 255, output:
| abort: unknown revision 'AUTOINC'!
|
NOTE: recipe test-1_AUTOINC+AUTOINC-r0: task do_unpack: Failed
DEBUG: Teardown for bitbake-worker
NOTE: Tasks Summary: Attempted 361 tasks of which 359 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/intern/git/poky/meta/recipes-core/test/test_0.0.1.bb, do_unpack
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
The problem seems to be that AUTOREV is resolving to AUTOINC instead of a hash number. Any thoughts on what I can change to fix this?
You can use "tip" as source revision like:
SRCREV = "tip"
SRCMODULE = "myapp"
SRC_URI = "hg://hg_server_url;rev=${SRCREV};protocol=http;branch=${SRCBRANCH};module=${SRCMODULE}"
Keep only in mind (found that hard way) that hg_server_url shouldn't include target repo subname, but include it as SRCMODULE !
Machine Env: Windows7 box with Cygwin/TortoiseHg, Linux box (RHEL).
Mercurial/Hg - 3.0.1 version
I'm trying to integrate mercurial_keyring to perform username/password less operations. Mercurial keyring prompts first time per user / per repository link but after that, it doesn't prompt.
Our Hg repository code recently migrated to RhodeCode.
I have mercurial_keyring.py (python) file available on my machine (provided by this link): https://pypi.python.org/pypi/mercurial_keyring and https://bitbucket.org/Mekk/mercurial_keyring/src/tip/mercurial_keyring.py
While doing hg clone or any hg command, I'm getting the following error when used at command prompt (either in Linux or Windows machine via Cygwin).
*** failed to import extension hgext.mercurial_keyring from /root/AKS/goga/mercurial_keyring.py: 'module' object has no attribute 'NullHandler'
My ~/.hgrc file looks like:
# example config (see "hg help config" for more info)
[ui]
# name and email, e.g.
# username = Jane Doe <jdoe#example.com>
username=koba <koba.loki#shenzi.com>
[extensions]
# uncomment these lines to enable some popular extensions
# (see "hg help extensions" for more info)
# pager =
# progress =
# color =
hgext.mercurial_keyring = /root/AKS/goga/mercurial_keyring.py
[paths]
default = http://hg-server.cm.shenzi.com:8082
[auth]
default1.schemes = http https
default1.prefix = hg-server:8082
default1.username = koba
default.schemes = http https
default.prefix = hg-server.cm.shenzi.com:8082
default.username = koba
default3.schemes = http https
default3.prefix = 12.112.91.112
default3.username = koba
In Cygwin, I also got another error:
*** failed to import extension hgext.mercurial_keyring from ~/MerKeyRing/mercurial_keyring.py: No module named keyring
Could someone tell me what is incorrect in my .hgrc configuration? I am trying to use gmail to send a e-mail after each push and/or commit.
.hgrc
[paths]
default = ssh://www.domain.com/repo/hg
[ui]
username = intern <user#domain.com>
ssh="C:\Program Files (x86)\Mercurial\plink.exe" -ssh -i "C:\Program Files (x86)\Mercurial\key.pub"
[extensions]
hgext.notify =
[hooks]
changegroup.notify = python:hgext.notify.hook
incoming.notify = python:hgext.notify.hook
[email]
from = user#domain.com
[smtp]
host = smtp.gmail.com
username = user#gmail.com
password = sure
port = 587
tls = true
[web]
baseurl = http://dev/...
[notify]
sources = serve push pull bundle
test = False
config = /path/to/subscription/file
template = \ndetails: {baseurl}{webroot}/rev/{node|short}\nchangeset: {rev}:{node|short}\nuser: {author}\ndate: {date|date}\ndescription:\n{desc}\n
maxdiff = 300
Error
Incoming comand failed for P/project. running ""C:\Program Files (x86)\Mercurial\plink.exe" -ssh -i "C:\Program Files (x86)\Mercurial\key.pub" user#domain.com "hg -R repo/hg serve --stdio""
sending hello command
sending between command
remote: FATAL ERROR: Server unexpectedly closed network connection
abort: no suitable response from remote hg!
, error code: -1
running ""C:\Program Files (x86)\Mercurial\plink.exe" -ssh -i "C:\Program Files (x86)\Mercurial\key.pub" user#domain.com "hg -R repo/hg serve --stdio""
sending hello command
sending between command
remote: FATAL ERROR: Server unexpectedly closed network connection
abort: no suitable response from remote hg!
Did you follow the steps detailled in "AccessingSshRepositoriesFromWindows"?
If yes, you still can try:
Plink.exe also has a -batch argument which tells plink to run non-interactively.
Any activity that would normally require user interaction (a new host key, for instance) will cause plink to exit immediately rather than stall.
When an ssh operation fails, you can use the --debug argument to figure out what went wrong.
I believe you have to have the private key locally, and the public key goes on the target machine. It does seem strange that it would connect at all though.
The problem can be with the push not with the send email using notify extension.
If you followed the instructions correctly, maybe you have a problem if the public key and private key.
You need to edit the authorized_keys, at your server, inside .ssh folder of your user, and put your public key of your key inside this file.
The private key of your key you will use at client with pageant (Add Key button).
I recommend to use another email service instead gmail, maybe, if you send a lot of automatic email. gmail can put your ip to black list and block the emails.