mach mercurial-setup fail if ~/.hgrc doesn't exist

RESOLVED FIXED in mozilla34

Status

defect
RESOLVED FIXED
5 years ago
Last year

People

(Reporter: NinjaTrappeur, Assigned: NinjaTrappeur)

Tracking

({regression})

34 Branch
mozilla34
x86_64
Linux
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Assignee

Description

5 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release)
Build ID: 20140722064054

Steps to reproduce:

./mach mercurial-setup without and existing ~/.hgrc


Actual results:

Error running mach:

    ['mercurial-setup']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

IOError: [Errno 2] No such file or directory: u'/home/***/.hgrc'

  File "/home/***/mozilla-central/tools/mercurial/mach_commands.py", line 32, in mercurial_bootstrap
    result = wizard.run(map(os.path.expanduser, config_paths))
  File "/home/***/mozilla-central/tools/mercurial/hgsetup/wizard.py", line 192, in run
    c = MercurialConfig(config_paths)
  File "/home/***/mozilla-central/tools/mercurial/hgsetup/config.py", line 45, in __init__
    with open(infile, 'r') as f:
Gah. This is a regression from bug 1047592. Should be a one-liner to check for os.path.exists() before opening the file.
Status: UNCONFIRMED → NEW
Depends on: 1047592
Ever confirmed: true
Keywords: regression
Assignee

Comment 2

5 years ago
Yes, I fixed it. Since it's the first time I use mercurial I experience some troubles making the patch. Coming soon :)
If you have any questions, ping me on irc.mozilla.org - I'm gps.
Assignee

Comment 4

5 years ago
Comment on attachment 8468801 [details] [diff] [review]
Possible patch

Review of attachment 8468801 [details] [diff] [review]:
-----------------------------------------------------------------

Great first patch! I love when people come to the project and fix our tools :)

Note for next time: the commit message should conform to the standards documented at https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities. tl;dr "Bug 1049893 - Fix mach mercurial-setup when no ~/.hgrc file exists"

You also need to explicitly request review from someone by setting the "review" flag to ? and typing the name of a reviewer.

These processes are far from intuitive and most people get part of them wrong. So don't feel bad.

I'll land this in the next few minutes. You should see a URL added to the bug corresponding to the landing. You won't need to do anything else.

::: tools/mercurial/hgsetup/config.py
@@ +41,5 @@
>  
>          # Mercurial configuration files allow an %include directive to include
>          # other files, this is not supported by ConfigObj, so throw a useful
>          # error saying this.
> +        if(os.path.isfile(infile)):

Nit: you don't need braces in Python.

Other than that, this diff is correct!
Attachment #8468801 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/b2f6e935e1f2
Assignee: nobody → baylac.felix
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
QA Whiteboard: [qa-]

Updated

Last year
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.