Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 22837:2be7d5ebd4d0
config: use the same hgrc for a cloned repo as for an uninitted repo
This just copies the same local sample hgrc, except it sets the
default path to the repo it was cloned from.
This is cut-and-paste from the local sample hgrc, but I think it's
acceptable, since the two pieces of code are right next to each other
and they're small. There is danger of them going out of synch, but it
would complicate the code too much to get rid of this C&P.
I also add ui as an import to hg.py, but with demandimport, this
should not be a noticeable performance hit.
author | Jordi Guti?rrez Hermoso <jordigh@octave.org> |
---|---|
date | Mon, 06 Oct 2014 16:35:02 -0400 |
parents | 9271630f4720 |
children | 40f46fd7c50e |
comparison
equal
deleted
inserted
replaced
22836:5a831e4e6d7a | 22837:2be7d5ebd4d0 |
---|---|
20 import minirst, revset, fileset | 20 import minirst, revset, fileset |
21 import dagparser, context, simplemerge, graphmod | 21 import dagparser, context, simplemerge, graphmod |
22 import random | 22 import random |
23 import setdiscovery, treediscovery, dagutil, pvec, localrepo | 23 import setdiscovery, treediscovery, dagutil, pvec, localrepo |
24 import phases, obsolete, exchange | 24 import phases, obsolete, exchange |
25 import ui as uimod | |
25 | 26 |
26 table = {} | 27 table = {} |
27 | 28 |
28 command = cmdutil.command(table) | 29 command = cmdutil.command(table) |
29 | 30 |
1556 | 1557 |
1557 for f in paths: | 1558 for f in paths: |
1558 if os.path.exists(f): | 1559 if os.path.exists(f): |
1559 break | 1560 break |
1560 else: | 1561 else: |
1561 from ui import samplehgrcs | |
1562 | |
1563 if opts.get('global'): | 1562 if opts.get('global'): |
1564 samplehgrc = samplehgrcs['global'] | 1563 samplehgrc = uimod.samplehgrcs['global'] |
1565 elif opts.get('local'): | 1564 elif opts.get('local'): |
1566 samplehgrc = samplehgrcs['local'] | 1565 samplehgrc = uimod.samplehgrcs['local'] |
1567 else: | 1566 else: |
1568 samplehgrc = samplehgrcs['user'] | 1567 samplehgrc = uimod.samplehgrcs['user'] |
1569 | 1568 |
1570 f = paths[0] | 1569 f = paths[0] |
1571 fp = open(f, "w") | 1570 fp = open(f, "w") |
1572 fp.write(samplehgrc) | 1571 fp.write(samplehgrc) |
1573 fp.close() | 1572 fp.close() |