Show More
@@ -0,0 +1,50 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 | hg --cwd clone heads | |
|
16 | sed -e 's/default.*#/default = #/' clone/.hg/hgrc | |
|
17 | echo | |
|
18 | ||
|
19 | echo '% changing original repo' | |
|
20 | cd repo | |
|
21 | echo >> a | |
|
22 | hg ci -m 'new head of branch foo' -d '0 0' | |
|
23 | hg up -qC default | |
|
24 | echo bar > bar | |
|
25 | hg ci -qAm 'add bar' -d '0 0' | |
|
26 | hg log | |
|
27 | echo | |
|
28 | ||
|
29 | echo '% outgoing' | |
|
30 | hg -q outgoing '../clone#foo' | |
|
31 | echo | |
|
32 | ||
|
33 | echo '% push' | |
|
34 | hg -q push '../clone#foo' | |
|
35 | hg --cwd ../clone heads | |
|
36 | cd .. | |
|
37 | echo | |
|
38 | ||
|
39 | echo '% rolling back' | |
|
40 | cd clone | |
|
41 | hg rollback | |
|
42 | ||
|
43 | echo '% incoming' | |
|
44 | hg -q incoming | |
|
45 | ||
|
46 | echo '% pull' | |
|
47 | hg -q pull | |
|
48 | hg heads | |
|
49 | echo | |
|
50 |
@@ -0,0 +1,69 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 | changeset: 1:cd2a86ecc814 | |
|
10 | branch: foo | |
|
11 | tag: tip | |
|
12 | user: test | |
|
13 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
14 | summary: change a | |
|
15 | ||
|
16 | [paths] | |
|
17 | default = #foo | |
|
18 | ||
|
19 | % changing original repo | |
|
20 | changeset: 3:4cd725637392 | |
|
21 | tag: tip | |
|
22 | parent: 0:1f0dee641bb7 | |
|
23 | user: test | |
|
24 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
25 | summary: add bar | |
|
26 | ||
|
27 | changeset: 2:faba9097cad4 | |
|
28 | branch: foo | |
|
29 | user: test | |
|
30 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
31 | summary: new head of branch foo | |
|
32 | ||
|
33 | changeset: 1:cd2a86ecc814 | |
|
34 | branch: foo | |
|
35 | user: test | |
|
36 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
37 | summary: change a | |
|
38 | ||
|
39 | changeset: 0:1f0dee641bb7 | |
|
40 | user: test | |
|
41 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
42 | summary: add a | |
|
43 | ||
|
44 | ||
|
45 | % outgoing | |
|
46 | 2:faba9097cad4 | |
|
47 | ||
|
48 | % push | |
|
49 | changeset: 2:faba9097cad4 | |
|
50 | branch: foo | |
|
51 | tag: tip | |
|
52 | user: test | |
|
53 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
54 | summary: new head of branch foo | |
|
55 | ||
|
56 | ||
|
57 | % rolling back | |
|
58 | rolling back last transaction | |
|
59 | % incoming | |
|
60 | 2:faba9097cad4 | |
|
61 | % pull | |
|
62 | changeset: 2:faba9097cad4 | |
|
63 | branch: foo | |
|
64 | tag: tip | |
|
65 | user: test | |
|
66 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
67 | summary: new head of branch foo | |
|
68 | ||
|
69 |
@@ -462,10 +462,10 b' def parseurl(url, revs):' | |||
|
462 | 462 | '''parse url#branch, returning url, branch + revs''' |
|
463 | 463 | |
|
464 | 464 | if '#' not in url: |
|
465 | return url, (revs or None) | |
|
465 | return url, (revs or None), None | |
|
466 | 466 | |
|
467 | 467 | url, rev = url.split('#', 1) |
|
468 | return url, revs + [rev] | |
|
468 | return url, revs + [rev], rev | |
|
469 | 469 | |
|
470 | 470 | def revpair(repo, revs): |
|
471 | 471 | '''return pair of nodes, given list of revisions. second item can |
@@ -324,7 +324,7 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
324 | 324 | visit.append(p) |
|
325 | 325 | else: |
|
326 | 326 | cmdutil.setremoteconfig(ui, opts) |
|
327 | dest, revs = cmdutil.parseurl( | |
|
327 | dest, revs, checkout = cmdutil.parseurl( | |
|
328 | 328 | ui.expandpath(dest or 'default-push', dest or 'default'), revs) |
|
329 | 329 | other = hg.repository(ui, dest) |
|
330 | 330 | o = repo.findoutgoing(other, force=opts['force']) |
@@ -1491,7 +1491,7 b' def identify(ui, repo, source=None,' | |||
|
1491 | 1491 | output = [] |
|
1492 | 1492 | |
|
1493 | 1493 | if source: |
|
1494 | source, revs = cmdutil.parseurl(ui.expandpath(source), []) | |
|
1494 | source, revs, checkout = cmdutil.parseurl(ui.expandpath(source), []) | |
|
1495 | 1495 | srepo = hg.repository(ui, source) |
|
1496 | 1496 | if not rev and revs: |
|
1497 | 1497 | rev = revs[0] |
@@ -1649,7 +1649,8 b' def incoming(ui, repo, source="default",' | |||
|
1649 | 1649 | |
|
1650 | 1650 | See pull for valid source format details. |
|
1651 | 1651 | """ |
|
1652 |
source, revs = cmdutil.parseurl(ui.expandpath(source), |
|
|
1652 | source, revs, checkout = cmdutil.parseurl(ui.expandpath(source), | |
|
1653 | opts['rev']) | |
|
1653 | 1654 | cmdutil.setremoteconfig(ui, opts) |
|
1654 | 1655 | |
|
1655 | 1656 | other = hg.repository(ui, source) |
@@ -1952,7 +1953,7 b' def outgoing(ui, repo, dest=None, **opts' | |||
|
1952 | 1953 | |
|
1953 | 1954 | See pull for valid destination format details. |
|
1954 | 1955 | """ |
|
1955 | dest, revs = cmdutil.parseurl( | |
|
1956 | dest, revs, checkout = cmdutil.parseurl( | |
|
1956 | 1957 | ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev']) |
|
1957 | 1958 | cmdutil.setremoteconfig(ui, opts) |
|
1958 | 1959 | if revs: |
@@ -2074,7 +2075,8 b' def pull(ui, repo, source="default", **o' | |||
|
2074 | 2075 | Alternatively specify "ssh -C" as your ssh command in your hgrc or |
|
2075 | 2076 | with the --ssh command line option. |
|
2076 | 2077 | """ |
|
2077 |
source, revs = cmdutil.parseurl(ui.expandpath(source), |
|
|
2078 | source, revs, checkout = cmdutil.parseurl(ui.expandpath(source), | |
|
2079 | opts['rev']) | |
|
2078 | 2080 | cmdutil.setremoteconfig(ui, opts) |
|
2079 | 2081 | |
|
2080 | 2082 | other = hg.repository(ui, source) |
@@ -2119,7 +2121,7 b' def push(ui, repo, dest=None, **opts):' | |||
|
2119 | 2121 | Pushing to http:// and https:// URLs is only possible, if this |
|
2120 | 2122 | feature is explicitly enabled on the remote Mercurial server. |
|
2121 | 2123 | """ |
|
2122 | dest, revs = cmdutil.parseurl( | |
|
2124 | dest, revs, checkout = cmdutil.parseurl( | |
|
2123 | 2125 | ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev']) |
|
2124 | 2126 | cmdutil.setremoteconfig(ui, opts) |
|
2125 | 2127 |
@@ -99,7 +99,7 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
99 | 99 | """ |
|
100 | 100 | |
|
101 | 101 | origsource = source |
|
102 | source, rev = cmdutil.parseurl(ui.expandpath(source), rev) | |
|
102 | source, rev, checkout = cmdutil.parseurl(ui.expandpath(source), rev) | |
|
103 | 103 | |
|
104 | 104 | if isinstance(source, str): |
|
105 | 105 | src_repo = repository(ui, source) |
General Comments 0
You need to be logged in to leave comments.
Login now