Closed Bug 1049893 Opened 7 years ago Closed 7 years ago

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


(Firefox Build System :: General, defect)

34 Branch
Not set


(Not tracked)



(Reporter: NinjaTrappeur, Assigned: NinjaTrappeur)



(Keywords: regression)


(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:


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

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/", line 32, in mercurial_bootstrap
    result =, config_paths))
  File "/home/***/mozilla-central/tools/mercurial/hgsetup/", line 192, in run
    c = MercurialConfig(config_paths)
  File "/home/***/mozilla-central/tools/mercurial/hgsetup/", 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.
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 - 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 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/
@@ +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+
Assignee: nobody → baylac.felix
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.