Closed Bug 1049893 Opened 10 years ago Closed 10 years ago

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

Categories

(Firefox Build System :: General, defect)

34 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla34

People

(Reporter: NinjaTrappeur, Assigned: NinjaTrappeur)

References

Details

(Keywords: regression)

Attachments

(1 file)

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
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.
Attached patch Possible patchSplinter Review
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: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
QA Whiteboard: [qa-]
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.