Bug 4376 - import --exact --no-commit breaks
Summary: import --exact --no-commit breaks
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 3.0.1
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-19 14:59 UTC by Ulf Zibis
Modified: 2015-01-22 15:04 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulf Zibis 2014-09-19 14:59 UTC
hg --version
Mercurial Distributed SCM (version 3.0.1)

I can not disable qct, as it is not in .hgrc :
# Generated by TortoiseHg settings dialog
[extensions]
inotify = 
mq = 
histedit = 
[ui]
username = Ulf Zibis
[diff]
git = True

Here the command and output I got:

hg import --exact --no-commit --encoding ISO-8859-1 KomPrüfStand_111_b49d09f9920d.patch
Wende KomPrüfStand_111_b49d09f9920d.patch an
** Unknown exception encountered with possibly-broken third-party extension qct
** which supports versions unknown of Mercurial.
** Please disable qct and try your action again.
** If that fixes the bug please report it to Der Autor der Erweiterung
** Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2]
** Mercurial Distributed SCM (Version 3.0.1)
** Erweiterungen geladen: qct, strip, mq, histedit
Traceback (most recent call last):
  File "/usr/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 69, in dispatch
    ret = _runcatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 138, in _runcatch
    return _dispatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 819, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 599, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 910, in _runcommand
    return checkargs()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 881, in checkargs
    return cmdfunc()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 816, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 151, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/hgext/mq.py", line 3387, in mqcommand
    return orig(ui, repo, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 151, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/hgext/mq.py", line 3359, in mqimport
    return orig(ui, repo, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 3815, in import_
    opts, msgs, hg.clean)
  File "/usr/lib/python2.7/dist-packages/mercurial/cmdutil.py", line 661, in tryimportone
    if opts.get('exact') and hex(n) != nodeid:
TypeError: must be string or buffer, not None
Comment 1 Pierre-Yves David 2014-09-19 15:27 UTC
This can happen is --exact is used while no Node is specified in the header.
Comment 2 Matt Mackall 2014-09-19 15:52 UTC
Making the "please don't report this to us" message the summary line was an entertaining choice.

Qct is probably part of the TortoiseHg package and thus lives in your global hgrc file. See hg config --debug.

But the actual problem here is not part of qct. The real problem is that --no-commit and --exact (check the result hash after commit) don't make much sense together, so we'd never considered it before. I've queued a fix.
Comment 3 Ulf Zibis 2014-09-19 16:00 UTC
The import seemed to be processed correctly anyway, even the file paths in the patch file were encoded in UTF-8.

I wanted to see the effect of --encoding, if I force a invalid encoding, but such setting seems to be ignored.
It's not obvious, for what purpose the --encoding option is designed for from:
hg -v help import.
Comment 4 Ulf Zibis 2014-09-19 16:10 UTC
The patch was originally exported with hg export.
Is was wondering, that 2 different encodings were produced:
- ISO-8859-1  for the diff content
- UTF-8       for the file paths

On another system, Windows, the file paths were encoded with windows-1250.

So how to import a diff patch from another machine, if --encoding doesn't affect the adoption of the file paths encoding?
Comment 5 Matt Mackall 2014-09-19 16:48 UTC
A bug report has one global state, designed to reflect one topic. So, please, discuss only one topic per report.
Comment 6 HG Bot 2014-09-19 17:15 UTC
Fixed by http://selenic.com/repo/hg/rev/efedda4aed49
Matt Mackall <mpm@selenic.com>
import: let --exact 'work' with --no-commit (issue4376)

(please test the fix)
Comment 7 Ulf Zibis 2014-09-20 19:51 UTC
(In reply to comment #5)
> A bug report has one global state, designed to reflect one topic. So, please, discuss only one topic per report.
Done: http://www.selenic.com/pipermail/mercurial/2014-September/047527.html
Comment 8 Matt Mackall 2015-01-22 15:04 UTC
Bulk testing -> fixed