Show More
@@ -0,0 +1,27 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | # test parents command | |||
|
3 | ||||
|
4 | hg init a | |||
|
5 | cd a | |||
|
6 | echo % no working directory | |||
|
7 | hg parents | |||
|
8 | ||||
|
9 | echo a > a | |||
|
10 | echo b > b | |||
|
11 | hg ci -Amab -d '0 0' | |||
|
12 | echo a >> a | |||
|
13 | hg ci -Ama -d '1 0' | |||
|
14 | echo b >> b | |||
|
15 | hg ci -Amb -d '2 0' | |||
|
16 | ||||
|
17 | echo % hg parents | |||
|
18 | hg parents | |||
|
19 | ||||
|
20 | echo % hg parents a | |||
|
21 | hg parents a | |||
|
22 | ||||
|
23 | echo % hg parents -r 2 | |||
|
24 | hg parents -r 2 | |||
|
25 | ||||
|
26 | echo % hg parents -r 2 a | |||
|
27 | hg parents -r 2 a |
@@ -0,0 +1,28 b'' | |||||
|
1 | % no working directory | |||
|
2 | adding a | |||
|
3 | adding b | |||
|
4 | % hg parents | |||
|
5 | changeset: 2:6cfac479f009 | |||
|
6 | tag: tip | |||
|
7 | user: test | |||
|
8 | date: Thu Jan 01 00:00:02 1970 +0000 | |||
|
9 | summary: b | |||
|
10 | ||||
|
11 | % hg parents a | |||
|
12 | changeset: 0:b6a1406d8886 | |||
|
13 | user: test | |||
|
14 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
15 | summary: ab | |||
|
16 | ||||
|
17 | % hg parents -r 2 | |||
|
18 | changeset: 1:d786049f033a | |||
|
19 | user: test | |||
|
20 | date: Thu Jan 01 00:00:01 1970 +0000 | |||
|
21 | summary: a | |||
|
22 | ||||
|
23 | % hg parents -r 2 a | |||
|
24 | changeset: 0:b6a1406d8886 | |||
|
25 | user: test | |||
|
26 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
27 | summary: ab | |||
|
28 |
@@ -1877,17 +1877,20 b' def outgoing(ui, repo, dest=None, **opts' | |||||
1877 | def parents(ui, repo, file_=None, **opts): |
|
1877 | def parents(ui, repo, file_=None, **opts): | |
1878 | """show the parents of the working dir or revision |
|
1878 | """show the parents of the working dir or revision | |
1879 |
|
1879 | |||
1880 | Print the working directory's parent revisions. |
|
1880 | Print the working directory's parent revisions. If a | |
|
1881 | revision is given via --rev, the parent of that revision | |||
|
1882 | will be printed. If a file argument is given, revision in | |||
|
1883 | which the file was last changed (before the working directory | |||
|
1884 | revision or the argument to --rev if given) is printed. | |||
1881 | """ |
|
1885 | """ | |
1882 | rev = opts.get('rev') |
|
1886 | rev = opts.get('rev') | |
1883 |
if |
|
1887 | if file_: | |
1884 | if file_: |
|
1888 | ctx = repo.filectx(file_, changeid=rev) | |
1885 | ctx = repo.filectx(file_, changeid=rev) |
|
1889 | elif rev: | |
1886 | else: |
|
1890 | ctx = repo.changectx(rev) | |
1887 | ctx = repo.changectx(rev) |
|
|||
1888 | p = [cp.node() for cp in ctx.parents()] |
|
|||
1889 | else: |
|
1891 | else: | |
1890 |
|
|
1892 | ctx = repo.workingctx() | |
|
1893 | p = [cp.node() for cp in ctx.parents()] | |||
1891 |
|
1894 | |||
1892 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
1895 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
1893 | for n in p: |
|
1896 | for n in p: |
General Comments 0
You need to be logged in to leave comments.
Login now