##// END OF EJS Templates
config: use the same hgrc for a cloned repo as for an uninitted repo...
Jordi Gutiérrez Hermoso -
r22837:2be7d5eb default
parent child Browse files
Show More
@@ -22,6 +22,7 b' import dagparser, context, simplemerge, '
22 22 import random
23 23 import setdiscovery, treediscovery, dagutil, pvec, localrepo
24 24 import phases, obsolete, exchange
25 import ui as uimod
25 26
26 27 table = {}
27 28
@@ -1558,14 +1559,12 b' def config(ui, repo, *values, **opts):'
1558 1559 if os.path.exists(f):
1559 1560 break
1560 1561 else:
1561 from ui import samplehgrcs
1562
1563 1562 if opts.get('global'):
1564 samplehgrc = samplehgrcs['global']
1563 samplehgrc = uimod.samplehgrcs['global']
1565 1564 elif opts.get('local'):
1566 samplehgrc = samplehgrcs['local']
1565 samplehgrc = uimod.samplehgrcs['local']
1567 1566 else:
1568 samplehgrc = samplehgrcs['user']
1567 samplehgrc = uimod.samplehgrcs['user']
1569 1568
1570 1569 f = paths[0]
1571 1570 fp = open(f, "w")
@@ -9,9 +9,11 b''
9 9 from i18n import _
10 10 from lock import release
11 11 from node import nullid
12
12 13 import localrepo, bundlerepo, unionrepo, httppeer, sshpeer, statichttprepo
13 14 import bookmarks, lock, util, extensions, error, node, scmutil, phases, url
14 15 import cmdutil, discovery, repoview, exchange
16 import ui as uimod
15 17 import merge as mergemod
16 18 import verify as verifymod
17 19 import errno, os, shutil
@@ -429,18 +431,7 b' def clone(ui, peeropts, source, dest=Non'
429 431
430 432 destrepo = destpeer.local()
431 433 if destrepo:
432 template = (
433 '# You may want to set your username here if it is not set\n'
434 "# globally, or this repository requires a different\n"
435 '# username from your usual configuration. If you want to\n'
436 '# set something for all of your repositories on this\n'
437 '# computer, try running the command\n'
438 "# 'hg config --edit --global'\n"
439 '# [ui]\n'
440 '# username = Jane Doe <jdoe@example.com>\n'
441 '[paths]\n'
442 'default = %s\n'
443 )
434 template = uimod.samplehgrcs['cloned']
444 435 fp = destrepo.opener("hgrc", "w", text=True)
445 436 u = util.url(abspath)
446 437 u.passwd = None
@@ -26,6 +26,23 b' username ='
26 26 # progress =
27 27 # color =""",
28 28
29 'cloned':
30 """# example repository config (see "hg help config" for more info)
31 [paths]
32 default = %s
33
34 # path aliases to other clones of this repo in URLs or filesystem paths
35 # (see "hg help config.paths" for more info)
36 #
37 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
38 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
39 # my-clone = /home/jdoe/jdoes-clone
40
41 [ui]
42 # name and email (local to this repository, optional), e.g.
43 # username = Jane Doe <jdoe@example.com>
44 """,
45
29 46 'local':
30 47 """# example repository config (see "hg help config" for more info)
31 48 [paths]
@@ -37,6 +37,7 b" Push should push to 'default' when 'defa"
37 37
38 38 Push should push to 'default-push' when set:
39 39
40 $ echo '[paths]' >> b/.hg/hgrc
40 41 $ echo 'default-push = ../c' >> b/.hg/hgrc
41 42 $ hg --cwd b push
42 43 pushing to $TESTTMP/c (glob)
@@ -45,4 +46,3 b" Push should push to 'default-push' when "
45 46 adding manifests
46 47 adding file changes
47 48 added 1 changesets with 1 changes to 1 files
48
@@ -28,16 +28,20 b" Issue1199: Can't use '%' in hgrc (eg url"
28 28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 29 $ cd foobar
30 30 $ cat .hg/hgrc
31 # You may want to set your username here if it is not set
32 # globally, or this repository requires a different
33 # username from your usual configuration. If you want to
34 # set something for all of your repositories on this
35 # computer, try running the command
36 # 'hg config --edit --global'
37 # [ui]
31 # example repository config (see "hg help config" for more info)
32 [paths]
33 default = $TESTTMP/foo%bar
34
35 # path aliases to other clones of this repo in URLs or filesystem paths
36 # (see "hg help config.paths" for more info)
37 #
38 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
39 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
40 # my-clone = /home/jdoe/jdoes-clone
41
42 [ui]
43 # name and email (local to this repository, optional), e.g.
38 44 # username = Jane Doe <jdoe@example.com>
39 [paths]
40 default = $TESTTMP/foo%bar (glob)
41 45 $ hg paths
42 46 default = $TESTTMP/foo%bar (glob)
43 47 $ hg showconfig
@@ -26,16 +26,20 b' Cloning with a password in the URL shoul'
26 26 updating to branch default
27 27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 28 $ cat test3/.hg/hgrc
29 # You may want to set your username here if it is not set
30 # globally, or this repository requires a different
31 # username from your usual configuration. If you want to
32 # set something for all of your repositories on this
33 # computer, try running the command
34 # 'hg config --edit --global'
35 # [ui]
36 # username = Jane Doe <jdoe@example.com>
29 # example repository config (see "hg help config" for more info)
37 30 [paths]
38 31 default = http://foo@localhost:$HGPORT/
32
33 # path aliases to other clones of this repo in URLs or filesystem paths
34 # (see "hg help config.paths" for more info)
35 #
36 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
37 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
38 # my-clone = /home/jdoe/jdoes-clone
39
40 [ui]
41 # name and email (local to this repository, optional), e.g.
42 # username = Jane Doe <jdoe@example.com>
39 43 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
40 44
41 45 expect error, cloning not allowed
@@ -36,16 +36,20 b''
36 36
37 37 $ cd b
38 38 $ cat .hg/hgrc
39 # You may want to set your username here if it is not set
40 # globally, or this repository requires a different
41 # username from your usual configuration. If you want to
42 # set something for all of your repositories on this
43 # computer, try running the command
44 # 'hg config --edit --global'
45 # [ui]
39 # example repository config (see "hg help config" for more info)
40 [paths]
41 default = $TESTTMP/a#stable
42
43 # path aliases to other clones of this repo in URLs or filesystem paths
44 # (see "hg help config.paths" for more info)
45 #
46 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
47 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
48 # my-clone = /home/jdoe/jdoes-clone
49
50 [ui]
51 # name and email (local to this repository, optional), e.g.
46 52 # username = Jane Doe <jdoe@example.com>
47 [paths]
48 default = $TESTTMP/a#stable (glob)
49 53
50 54 $ echo red >> a
51 55 $ hg ci -qm3
@@ -84,24 +88,29 b''
84 88 $ echo "green = ../a#default" >> .hg/hgrc
85 89
86 90 $ cat .hg/hgrc
87 # You may want to set your username here if it is not set
88 # globally, or this repository requires a different
89 # username from your usual configuration. If you want to
90 # set something for all of your repositories on this
91 # computer, try running the command
92 # 'hg config --edit --global'
93 # [ui]
91 # example repository config (see "hg help config" for more info)
92 [paths]
93 default = $TESTTMP/a#stable
94
95 # path aliases to other clones of this repo in URLs or filesystem paths
96 # (see "hg help config.paths" for more info)
97 #
98 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
99 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
100 # my-clone = /home/jdoe/jdoes-clone
101
102 [ui]
103 # name and email (local to this repository, optional), e.g.
94 104 # username = Jane Doe <jdoe@example.com>
95 [paths]
96 default = $TESTTMP/a#stable (glob)
97 105 green = ../a#default
98 106
99 107 $ hg tout green
100 comparing with $TESTTMP/a (glob)
101 searching for changes
102 3:f0461977a3db: '4'
108 comparing with green
109 abort: repository green not found!
110 [255]
103 111
104 112 $ hg tlog -r 'outgoing("green")'
105 3:f0461977a3db: '4'
113 abort: repository green not found!
114 [255]
106 115
107 116 $ cd ..
@@ -41,16 +41,20 b' Test basic functionality of url#rev synt'
41 41 summary: change a
42 42
43 43 $ cat clone/.hg/hgrc
44 # You may want to set your username here if it is not set
45 # globally, or this repository requires a different
46 # username from your usual configuration. If you want to
47 # set something for all of your repositories on this
48 # computer, try running the command
49 # 'hg config --edit --global'
50 # [ui]
44 # example repository config (see "hg help config" for more info)
45 [paths]
46 default = $TESTTMP/repo#foo
47
48 # path aliases to other clones of this repo in URLs or filesystem paths
49 # (see "hg help config.paths" for more info)
50 #
51 # default-push = ssh://jdoe@example.net/hg/jdoes-fork
52 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
53 # my-clone = /home/jdoe/jdoes-clone
54
55 [ui]
56 # name and email (local to this repository, optional), e.g.
51 57 # username = Jane Doe <jdoe@example.com>
52 [paths]
53 default = $TESTTMP/repo#foo (glob)
54 58
55 59 Changing original repo:
56 60
General Comments 0
You need to be logged in to leave comments. Login now