##// 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 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
@@ -1558,14 +1559,12 b' def config(ui, repo, *values, **opts):'
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")
@@ -9,9 +9,11 b''
9 from i18n import _
9 from i18n import _
10 from lock import release
10 from lock import release
11 from node import nullid
11 from node import nullid
12
12 import localrepo, bundlerepo, unionrepo, httppeer, sshpeer, statichttprepo
13 import localrepo, bundlerepo, unionrepo, httppeer, sshpeer, statichttprepo
13 import bookmarks, lock, util, extensions, error, node, scmutil, phases, url
14 import bookmarks, lock, util, extensions, error, node, scmutil, phases, url
14 import cmdutil, discovery, repoview, exchange
15 import cmdutil, discovery, repoview, exchange
16 import ui as uimod
15 import merge as mergemod
17 import merge as mergemod
16 import verify as verifymod
18 import verify as verifymod
17 import errno, os, shutil
19 import errno, os, shutil
@@ -429,18 +431,7 b' def clone(ui, peeropts, source, dest=Non'
429
431
430 destrepo = destpeer.local()
432 destrepo = destpeer.local()
431 if destrepo:
433 if destrepo:
432 template = (
434 template = uimod.samplehgrcs['cloned']
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 )
444 fp = destrepo.opener("hgrc", "w", text=True)
435 fp = destrepo.opener("hgrc", "w", text=True)
445 u = util.url(abspath)
436 u = util.url(abspath)
446 u.passwd = None
437 u.passwd = None
@@ -26,6 +26,23 b' username ='
26 # progress =
26 # progress =
27 # color =""",
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 'local':
46 'local':
30 """# example repository config (see "hg help config" for more info)
47 """# example repository config (see "hg help config" for more info)
31 [paths]
48 [paths]
@@ -37,6 +37,7 b" Push should push to 'default' when 'defa"
37
37
38 Push should push to 'default-push' when set:
38 Push should push to 'default-push' when set:
39
39
40 $ echo '[paths]' >> b/.hg/hgrc
40 $ echo 'default-push = ../c' >> b/.hg/hgrc
41 $ echo 'default-push = ../c' >> b/.hg/hgrc
41 $ hg --cwd b push
42 $ hg --cwd b push
42 pushing to $TESTTMP/c (glob)
43 pushing to $TESTTMP/c (glob)
@@ -45,4 +46,3 b" Push should push to 'default-push' when "
45 adding manifests
46 adding manifests
46 adding file changes
47 adding file changes
47 added 1 changesets with 1 changes to 1 files
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 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 $ cd foobar
29 $ cd foobar
30 $ cat .hg/hgrc
30 $ cat .hg/hgrc
31 # You may want to set your username here if it is not set
31 # example repository config (see "hg help config" for more info)
32 # globally, or this repository requires a different
32 [paths]
33 # username from your usual configuration. If you want to
33 default = $TESTTMP/foo%bar
34 # set something for all of your repositories on this
34
35 # computer, try running the command
35 # path aliases to other clones of this repo in URLs or filesystem paths
36 # 'hg config --edit --global'
36 # (see "hg help config.paths" for more info)
37 # [ui]
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 # username = Jane Doe <jdoe@example.com>
44 # username = Jane Doe <jdoe@example.com>
39 [paths]
40 default = $TESTTMP/foo%bar (glob)
41 $ hg paths
45 $ hg paths
42 default = $TESTTMP/foo%bar (glob)
46 default = $TESTTMP/foo%bar (glob)
43 $ hg showconfig
47 $ hg showconfig
@@ -26,16 +26,20 b' Cloning with a password in the URL shoul'
26 updating to branch default
26 updating to branch default
27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 $ cat test3/.hg/hgrc
28 $ cat test3/.hg/hgrc
29 # You may want to set your username here if it is not set
29 # example repository config (see "hg help config" for more info)
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>
37 [paths]
30 [paths]
38 default = http://foo@localhost:$HGPORT/
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 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
43 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
40
44
41 expect error, cloning not allowed
45 expect error, cloning not allowed
@@ -36,16 +36,20 b''
36
36
37 $ cd b
37 $ cd b
38 $ cat .hg/hgrc
38 $ cat .hg/hgrc
39 # You may want to set your username here if it is not set
39 # example repository config (see "hg help config" for more info)
40 # globally, or this repository requires a different
40 [paths]
41 # username from your usual configuration. If you want to
41 default = $TESTTMP/a#stable
42 # set something for all of your repositories on this
42
43 # computer, try running the command
43 # path aliases to other clones of this repo in URLs or filesystem paths
44 # 'hg config --edit --global'
44 # (see "hg help config.paths" for more info)
45 # [ui]
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 # username = Jane Doe <jdoe@example.com>
52 # username = Jane Doe <jdoe@example.com>
47 [paths]
48 default = $TESTTMP/a#stable (glob)
49
53
50 $ echo red >> a
54 $ echo red >> a
51 $ hg ci -qm3
55 $ hg ci -qm3
@@ -84,24 +88,29 b''
84 $ echo "green = ../a#default" >> .hg/hgrc
88 $ echo "green = ../a#default" >> .hg/hgrc
85
89
86 $ cat .hg/hgrc
90 $ cat .hg/hgrc
87 # You may want to set your username here if it is not set
91 # example repository config (see "hg help config" for more info)
88 # globally, or this repository requires a different
92 [paths]
89 # username from your usual configuration. If you want to
93 default = $TESTTMP/a#stable
90 # set something for all of your repositories on this
94
91 # computer, try running the command
95 # path aliases to other clones of this repo in URLs or filesystem paths
92 # 'hg config --edit --global'
96 # (see "hg help config.paths" for more info)
93 # [ui]
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 # username = Jane Doe <jdoe@example.com>
104 # username = Jane Doe <jdoe@example.com>
95 [paths]
96 default = $TESTTMP/a#stable (glob)
97 green = ../a#default
105 green = ../a#default
98
106
99 $ hg tout green
107 $ hg tout green
100 comparing with $TESTTMP/a (glob)
108 comparing with green
101 searching for changes
109 abort: repository green not found!
102 3:f0461977a3db: '4'
110 [255]
103
111
104 $ hg tlog -r 'outgoing("green")'
112 $ hg tlog -r 'outgoing("green")'
105 3:f0461977a3db: '4'
113 abort: repository green not found!
114 [255]
106
115
107 $ cd ..
116 $ cd ..
@@ -41,16 +41,20 b' Test basic functionality of url#rev synt'
41 summary: change a
41 summary: change a
42
42
43 $ cat clone/.hg/hgrc
43 $ cat clone/.hg/hgrc
44 # You may want to set your username here if it is not set
44 # example repository config (see "hg help config" for more info)
45 # globally, or this repository requires a different
45 [paths]
46 # username from your usual configuration. If you want to
46 default = $TESTTMP/repo#foo
47 # set something for all of your repositories on this
47
48 # computer, try running the command
48 # path aliases to other clones of this repo in URLs or filesystem paths
49 # 'hg config --edit --global'
49 # (see "hg help config.paths" for more info)
50 # [ui]
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 # username = Jane Doe <jdoe@example.com>
57 # username = Jane Doe <jdoe@example.com>
52 [paths]
53 default = $TESTTMP/repo#foo (glob)
54
58
55 Changing original repo:
59 Changing original repo:
56
60
General Comments 0
You need to be logged in to leave comments. Login now