Closed Bug 534401 Opened 16 years ago Closed 16 years ago

Exception when trying to import a patch with an already existing name

Categories

(Developer Services :: Mercurial: qimportbz, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sgautherie, Assigned: sgautherie)

References

Details

Attachments

(1 file, 1 obsolete file)

Example: { hg qimport bz:500777 [...] Which patches do you want to import? [Default is '1'] 1 adding 500777 to series file hg qimport bz:500777 [...] Which patches do you want to import? [Default is '1'] 1 adding 500777 to series file ** unknown exception encountered, details follow ** report bug details to http://mercurial.selenic.com/bts/ ** or mercurial@selenic.com ** Mercurial Distributed SCM (version 1.4) ** Extensions loaded: extdiff, mq, rebase, qimportbz, transplant Traceback (most recent call last): File "hg", line 36, in <module> File "mercurial\dispatch.pyo", line 16, in run File "mercurial\dispatch.pyo", line 30, in dispatch File "mercurial\dispatch.pyo", line 46, in _runcatch File "mercurial\dispatch.pyo", line 449, in _dispatch File "mercurial\dispatch.pyo", line 319, in runcommand File "mercurial\dispatch.pyo", line 500, in _runcommand File "mercurial\dispatch.pyo", line 454, in checkargs File "mercurial\dispatch.pyo", line 448, in <lambda> File "mercurial\util.pyo", line 386, in check File "mercurial\extensions.pyo", line 116, in wrap File "mercurial\util.pyo", line 386, in check File "E:\Dvlp\Mozilla\Hg\qimportbz\__init__.py", line 160, in qimporthook newpatchname = checkpatchname(patch) File "E:\Dvlp\Mozilla\Hg\qimportbz\__init__.py", line 117, in checkpatchname default='o') File "mercurial\ui.pyo", line 298, in promptchoice TypeError: list indices must be integers } Same error whether 'patch_format' is set or not. Ftr, I noticed it when I tried to import patches 1 and 2 of that bug, because they have the same patch name... NB: I suggest to fix bug 534397 first, only to be less confused here.
I probably got the call wrong in checkpatchname due to change in interface from hg 1.3 to 1.4 on ui objects.
Fixes code from http://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz/rev/c403e5b868de "Removed qimportbz command in favor of "hg qimport bz:dddddd" syntax. Significant refactoring was involved and some features are lost."
Assignee: nobody → sgautherie.bz
Status: NEW → ASSIGNED
Attachment #417321 - Flags: review?(tellrob)
No longer depends on: 534397
Blocks: 534477
Ping for review.
Comment on attachment 417321 [details] [diff] [review] (Av1) Fix checkpatchname() code and use >- prompt = "A patch for bug %d already seems to exist in your patch directory. Rename %s '%s' (%d) (r)/overwrite (o)?" % \ >- (int(patch.bug.num), >+ prompt = "A patch file named '%s' already exists in your patch directory. Rename %s '%s' (%d) (r)/overwrite (o)?" % \ >+ (name, It would be nice to also have the bug number. Some people (myself included) don't have descriptive patch names. >- patch.desc, int(patch.id)) >- choice = prompter(prompt, >- choices = ("&readonly", "&overwrite", "&cancel"), >- default='o') >+ patch.desc, >+ int(patch.id)) >+ if hasPromptchoice: >+ choice = ui.promptchoice(prompt, >+ ("&readonly", "&overwrite"), >+ 0) >+ choice = ["r", "o"][choice] >+ else: >+ choice = ui.prompt(prompt, >+ ("&readonly", "&overwrite"), >+ "o") Are these offering the same default? The first looks like its readonly, the second is overwrite.
Av1, with comment 4 suggestion(s). (In reply to comment #4) > It would be nice to also have the bug number. Bug 540164 may help somewhat. But, other than that, the current message is "optimistic": there is no (reliable) way to know which bug the existing file is for... > Some people (myself included) don't have descriptive patch names. (Maybe you should.) > The first looks like its readonly, the second is overwrite. Right: fixed.
Attachment #417321 - Attachment is obsolete: true
Attachment #422034 - Flags: review?(tellrob)
Attachment #417321 - Flags: review?(tellrob)
Attachment #422034 - Flags: review?(tellrob) → review+
Comment on attachment 422034 [details] [diff] [review] (Av1a) Fix checkpatchname() code and use, Change default to 'readonly' [Checkin: Comment 6] http://hg.mozilla.org/users/robarnold_cmu.edu/qimportbz/rev/aed79040eea2
Attachment #422034 - Attachment description: (Av1a) Fix checkpatchname() code and use, Change default to 'readonly' → (Av1a) Fix checkpatchname() code and use, Change default to 'readonly' [Checkin: Comment 6]
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Product: Other Applications → Developer Services
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: