##// END OF EJS Templates
Merge with crew-stable
Alexis S. L. Carvalho -
r5248:5517aa5a merge default
parent child Browse files
Show More
@@ -0,0 +1,27 b''
1 #!/bin/sh
2
3 hg init repo
4 cd repo
5 echo foo > foo
6 hg ci -qAm 'add foo' -d '0 0'
7 echo >> foo
8 hg ci -m 'change foo' -d '0 0'
9 hg up -qC 0
10 echo bar > bar
11 hg ci -qAm 'add bar' -d '0 0'
12 hg log
13 cd ..
14 hg init copy
15 cd copy
16
17 echo '% pull -r 0'
18 hg pull -qr 0 ../repo
19 hg log
20
21 echo '% pull -r 1'
22 hg pull -qr 1 ../repo
23 hg log
24
25 # this used to abort: received changelog group is empty
26 echo '% pull -r 1 again'
27 hg pull -qr 1 ../repo
@@ -0,0 +1,37 b''
1 changeset: 2:effea6de0384
2 tag: tip
3 parent: 0:bbd179dfa0a7
4 user: test
5 date: Thu Jan 01 00:00:00 1970 +0000
6 summary: add bar
7
8 changeset: 1:ed1b79f46b9a
9 user: test
10 date: Thu Jan 01 00:00:00 1970 +0000
11 summary: change foo
12
13 changeset: 0:bbd179dfa0a7
14 user: test
15 date: Thu Jan 01 00:00:00 1970 +0000
16 summary: add foo
17
18 % pull -r 0
19 changeset: 0:bbd179dfa0a7
20 tag: tip
21 user: test
22 date: Thu Jan 01 00:00:00 1970 +0000
23 summary: add foo
24
25 % pull -r 1
26 changeset: 1:ed1b79f46b9a
27 tag: tip
28 user: test
29 date: Thu Jan 01 00:00:00 1970 +0000
30 summary: change foo
31
32 changeset: 0:bbd179dfa0a7
33 user: test
34 date: Thu Jan 01 00:00:00 1970 +0000
35 summary: add foo
36
37 % pull -r 1 again
@@ -0,0 +1,83 b''
1 #!/bin/sh
2 # test basic functionality of url#rev syntax
3
4 hg init repo
5 cd repo
6 echo a > a
7 hg ci -qAm 'add a' -d '0 0'
8 hg branch foo
9 echo >> a
10 hg ci -m 'change a' -d '0 0'
11 cd ..
12
13 echo '% clone repo#foo'
14 hg clone 'repo#foo' clone
15 echo '% heads'
16 hg --cwd clone heads
17 echo '% parents'
18 hg --cwd clone parents
19 sed -e 's/default.*#/default = #/' clone/.hg/hgrc
20 echo
21
22 echo '% changing original repo'
23 cd repo
24 echo >> a
25 hg ci -m 'new head of branch foo' -d '0 0'
26 hg up -qC default
27 echo bar > bar
28 hg ci -qAm 'add bar' -d '0 0'
29 hg log
30 echo
31
32 echo '% outgoing'
33 hg -q outgoing '../clone#foo'
34 echo
35
36 echo '% push'
37 hg -q push '../clone#foo'
38 hg --cwd ../clone heads
39 cd ..
40 echo
41
42 echo '% rolling back'
43 cd clone
44 hg rollback
45
46 echo '% incoming'
47 hg -q incoming
48
49 echo '% pull'
50 hg -q pull
51 hg heads
52 echo
53
54 echo '% pull should not have updated'
55 hg parents -q
56 echo '% going back to the default branch'
57 hg up -C 0
58 hg parents
59 echo '% no new revs, no update'
60 hg pull -qu
61 hg parents -q
62 echo '% rollback'
63 hg rollback
64 hg up -C 0
65 hg parents -q
66 echo '% pull -u takes us back to branch foo'
67 hg pull -qu
68 hg parents
69
70 echo '% rollback'
71 hg rollback
72 hg up -C 0
73 echo '% parents'
74 hg parents -q
75 echo '% heads'
76 hg heads -q
77 echo '% pull -u -r otherrev url#rev updates to rev'
78 hg pull -qur default default
79 echo '% parents'
80 hg parents
81 echo '% heads'
82 hg heads
83
@@ -0,0 +1,130 b''
1 marked working directory as branch foo
2 % clone repo#foo
3 requesting all changes
4 adding changesets
5 adding manifests
6 adding file changes
7 added 2 changesets with 2 changes to 1 files
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9 % heads
10 changeset: 1:cd2a86ecc814
11 branch: foo
12 tag: tip
13 user: test
14 date: Thu Jan 01 00:00:00 1970 +0000
15 summary: change a
16
17 % parents
18 changeset: 1:cd2a86ecc814
19 branch: foo
20 tag: tip
21 user: test
22 date: Thu Jan 01 00:00:00 1970 +0000
23 summary: change a
24
25 [paths]
26 default = #foo
27
28 % changing original repo
29 changeset: 3:4cd725637392
30 tag: tip
31 parent: 0:1f0dee641bb7
32 user: test
33 date: Thu Jan 01 00:00:00 1970 +0000
34 summary: add bar
35
36 changeset: 2:faba9097cad4
37 branch: foo
38 user: test
39 date: Thu Jan 01 00:00:00 1970 +0000
40 summary: new head of branch foo
41
42 changeset: 1:cd2a86ecc814
43 branch: foo
44 user: test
45 date: Thu Jan 01 00:00:00 1970 +0000
46 summary: change a
47
48 changeset: 0:1f0dee641bb7
49 user: test
50 date: Thu Jan 01 00:00:00 1970 +0000
51 summary: add a
52
53
54 % outgoing
55 2:faba9097cad4
56
57 % push
58 changeset: 2:faba9097cad4
59 branch: foo
60 tag: tip
61 user: test
62 date: Thu Jan 01 00:00:00 1970 +0000
63 summary: new head of branch foo
64
65
66 % rolling back
67 rolling back last transaction
68 % incoming
69 2:faba9097cad4
70 % pull
71 changeset: 2:faba9097cad4
72 branch: foo
73 tag: tip
74 user: test
75 date: Thu Jan 01 00:00:00 1970 +0000
76 summary: new head of branch foo
77
78
79 % pull should not have updated
80 1:cd2a86ecc814
81 % going back to the default branch
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 changeset: 0:1f0dee641bb7
84 user: test
85 date: Thu Jan 01 00:00:00 1970 +0000
86 summary: add a
87
88 % no new revs, no update
89 0:1f0dee641bb7
90 % rollback
91 rolling back last transaction
92 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
93 0:1f0dee641bb7
94 % pull -u takes us back to branch foo
95 changeset: 2:faba9097cad4
96 branch: foo
97 tag: tip
98 user: test
99 date: Thu Jan 01 00:00:00 1970 +0000
100 summary: new head of branch foo
101
102 % rollback
103 rolling back last transaction
104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
105 % parents
106 0:1f0dee641bb7
107 % heads
108 1:cd2a86ecc814
109 % pull -u -r otherrev url#rev updates to rev
110 % parents
111 changeset: 2:faba9097cad4
112 branch: foo
113 user: test
114 date: Thu Jan 01 00:00:00 1970 +0000
115 summary: new head of branch foo
116
117 % heads
118 changeset: 3:4cd725637392
119 tag: tip
120 parent: 0:1f0dee641bb7
121 user: test
122 date: Thu Jan 01 00:00:00 1970 +0000
123 summary: add bar
124
125 changeset: 2:faba9097cad4
126 branch: foo
127 user: test
128 date: Thu Jan 01 00:00:00 1970 +0000
129 summary: new head of branch foo
130
@@ -1516,13 +1516,18 b' def clone(ui, source, dest=None, **opts)'
1516 1516 The patch directory must be a nested mercurial repository, as
1517 1517 would be created by qinit -c.
1518 1518 '''
1519 def patchdir(repo):
1520 url = repo.url()
1521 if url.endswith('/'):
1522 url = url[:-1]
1523 return url + '/.hg/patches'
1519 1524 cmdutil.setremoteconfig(ui, opts)
1520 1525 if dest is None:
1521 1526 dest = hg.defaultdest(source)
1522 1527 sr = hg.repository(ui, ui.expandpath(source))
1523 patchdir = opts['patches'] or (sr.url() + '/.hg/patches')
1528 patchespath = opts['patches'] or patchdir(sr)
1524 1529 try:
1525 pr = hg.repository(ui, patchdir)
1530 pr = hg.repository(ui, patchespath)
1526 1531 except hg.RepoError:
1527 1532 raise util.Abort(_('versioned patch repository not found'
1528 1533 ' (see qinit -c)'))
@@ -1543,10 +1548,8 b' def clone(ui, source, dest=None, **opts)'
1543 1548 update=False,
1544 1549 stream=opts['uncompressed'])
1545 1550 ui.note(_('cloning patch repo\n'))
1546 spr, dpr = hg.clone(ui, opts['patches'] or (sr.url() + '/.hg/patches'),
1547 dr.url() + '/.hg/patches',
1548 pull=opts['pull'],
1549 update=not opts['noupdate'],
1551 spr, dpr = hg.clone(ui, opts['patches'] or patchdir(sr), patchdir(dr),
1552 pull=opts['pull'], update=not opts['noupdate'],
1550 1553 stream=opts['uncompressed'])
1551 1554 if dr.local():
1552 1555 if qbase:
@@ -335,7 +335,7 b' def bundle(ui, repo, fname, dest=None, *'
335 335 visit.append(p)
336 336 else:
337 337 cmdutil.setremoteconfig(ui, opts)
338 dest, revs = hg.parseurl(
338 dest, revs, checkout = hg.parseurl(
339 339 ui.expandpath(dest or 'default-push', dest or 'default'), revs)
340 340 other = hg.repository(ui, dest)
341 341 o = repo.findoutgoing(other, force=opts['force'])
@@ -1474,7 +1474,7 b' def identify(ui, repo, source=None,'
1474 1474 output = []
1475 1475
1476 1476 if source:
1477 source, revs = hg.parseurl(ui.expandpath(source), [])
1477 source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
1478 1478 srepo = hg.repository(ui, source)
1479 1479 if not rev and revs:
1480 1480 rev = revs[0]
@@ -1639,7 +1639,7 b' def incoming(ui, repo, source="default",'
1639 1639
1640 1640 See pull for valid source format details.
1641 1641 """
1642 source, revs = hg.parseurl(ui.expandpath(source), opts['rev'])
1642 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
1643 1643 cmdutil.setremoteconfig(ui, opts)
1644 1644
1645 1645 other = hg.repository(ui, source)
@@ -1950,7 +1950,7 b' def outgoing(ui, repo, dest=None, **opts'
1950 1950
1951 1951 See pull for valid destination format details.
1952 1952 """
1953 dest, revs = hg.parseurl(
1953 dest, revs, checkout = hg.parseurl(
1954 1954 ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
1955 1955 cmdutil.setremoteconfig(ui, opts)
1956 1956 if revs:
@@ -2018,12 +2018,12 b' def paths(ui, repo, search=None):'
2018 2018 for name, path in ui.configitems("paths"):
2019 2019 ui.write("%s = %s\n" % (name, path))
2020 2020
2021 def postincoming(ui, repo, modheads, optupdate):
2021 def postincoming(ui, repo, modheads, optupdate, checkout):
2022 2022 if modheads == 0:
2023 2023 return
2024 2024 if optupdate:
2025 if modheads <= 1:
2026 return hg.update(repo, None)
2025 if modheads <= 1 or checkout:
2026 return hg.update(repo, checkout)
2027 2027 else:
2028 2028 ui.status(_("not updating, since new heads added\n"))
2029 2029 if modheads > 1:
@@ -2072,7 +2072,7 b' def pull(ui, repo, source="default", **o'
2072 2072 Alternatively specify "ssh -C" as your ssh command in your hgrc or
2073 2073 with the --ssh command line option.
2074 2074 """
2075 source, revs = hg.parseurl(ui.expandpath(source), opts['rev'])
2075 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
2076 2076 cmdutil.setremoteconfig(ui, opts)
2077 2077
2078 2078 other = hg.repository(ui, source)
@@ -2085,7 +2085,7 b' def pull(ui, repo, source="default", **o'
2085 2085 raise util.Abort(error)
2086 2086
2087 2087 modheads = repo.pull(other, heads=revs, force=opts['force'])
2088 return postincoming(ui, repo, modheads, opts['update'])
2088 return postincoming(ui, repo, modheads, opts['update'], checkout)
2089 2089
2090 2090 def push(ui, repo, dest=None, **opts):
2091 2091 """push changes to the specified destination
@@ -2117,7 +2117,7 b' def push(ui, repo, dest=None, **opts):'
2117 2117 Pushing to http:// and https:// URLs is only possible, if this
2118 2118 feature is explicitly enabled on the remote Mercurial server.
2119 2119 """
2120 dest, revs = hg.parseurl(
2120 dest, revs, checkout = hg.parseurl(
2121 2121 ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
2122 2122 cmdutil.setremoteconfig(ui, opts)
2123 2123
@@ -2663,7 +2663,7 b' def unbundle(ui, repo, fname1, *fnames, '
2663 2663 gen = changegroup.readbundle(f, fname)
2664 2664 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
2665 2665
2666 return postincoming(ui, repo, modheads, opts['update'])
2666 return postincoming(ui, repo, modheads, opts['update'], None)
2667 2667
2668 2668 def update(ui, repo, node=None, rev=None, clean=False, date=None):
2669 2669 """update working directory
@@ -22,10 +22,10 b' def parseurl(url, revs):'
22 22 '''parse url#branch, returning url, branch + revs'''
23 23
24 24 if '#' not in url:
25 return url, (revs or None)
25 return url, (revs or None), None
26 26
27 27 url, rev = url.split('#', 1)
28 return url, revs + [rev]
28 return url, revs + [rev], rev
29 29
30 30 schemes = {
31 31 'bundle': bundlerepo,
@@ -106,7 +106,7 b' def clone(ui, source, dest=None, pull=Fa'
106 106 """
107 107
108 108 origsource = source
109 source, rev = parseurl(ui.expandpath(source), rev)
109 source, rev, checkout = parseurl(ui.expandpath(source), rev)
110 110
111 111 if isinstance(source, str):
112 112 src_repo = repository(ui, source)
@@ -149,7 +149,7 b' def clone(ui, source, dest=None, pull=Fa'
149 149 abspath = origsource
150 150 copy = False
151 151 if src_repo.local() and islocal(dest):
152 abspath = os.path.abspath(origsource)
152 abspath = os.path.abspath(util.drop_scheme('file', origsource))
153 153 copy = not pull and not rev
154 154
155 155 if copy:
@@ -226,10 +226,11 b' def clone(ui, source, dest=None, pull=Fa'
226 226 fp.close()
227 227
228 228 if update:
229 try:
230 checkout = dest_repo.lookup("default")
231 except:
232 checkout = dest_repo.changelog.tip()
229 if not checkout:
230 try:
231 checkout = dest_repo.lookup("default")
232 except:
233 checkout = dest_repo.changelog.tip()
233 234 _update(dest_repo, checkout)
234 235
235 236 return src_repo, dest_repo
@@ -1352,7 +1352,7 b' class localrepository(repo.repository):'
1352 1352 def pull(self, remote, heads=None, force=False):
1353 1353 lock = self.lock()
1354 1354 try:
1355 fetch = self.findincoming(remote, force=force)
1355 fetch = self.findincoming(remote, heads=heads, force=force)
1356 1356 if fetch == [nullid]:
1357 1357 self.ui.status(_("requesting all changes\n"))
1358 1358
@@ -25,3 +25,11 b' cd ../d'
25 25 hg clone ../a
26 26 cd a
27 27 hg cat a
28
29 # check that we drop the file:// from the path before
30 # writing the .hgrc
31 cd ../..
32 hg clone file://a e
33 grep 'file:' e/.hg/hgrc
34
35 exit 0
@@ -14,3 +14,4 b' 1 files, 1 changesets, 1 total revisions'
14 14 destination directory: a
15 15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
16 16 a
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
General Comments 0
You need to be logged in to leave comments. Login now