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 |
@@ -1863,17 +1863,20 b' def outgoing(ui, repo, dest=None, **opts' | |||
|
1863 | 1863 | def parents(ui, repo, file_=None, **opts): |
|
1864 | 1864 | """show the parents of the working dir or revision |
|
1865 | 1865 | |
|
1866 | Print the working directory's parent revisions. | |
|
1866 | Print the working directory's parent revisions. If a | |
|
1867 | revision is given via --rev, the parent of that revision | |
|
1868 | will be printed. If a file argument is given, revision in | |
|
1869 | which the file was last changed (before the working directory | |
|
1870 | revision or the argument to --rev if given) is printed. | |
|
1867 | 1871 | """ |
|
1868 | 1872 | rev = opts.get('rev') |
|
1869 |
if |
|
|
1870 | if file_: | |
|
1871 | ctx = repo.filectx(file_, changeid=rev) | |
|
1872 | else: | |
|
1873 | ctx = repo.changectx(rev) | |
|
1874 | p = [cp.node() for cp in ctx.parents()] | |
|
1873 | if file_: | |
|
1874 | ctx = repo.filectx(file_, changeid=rev) | |
|
1875 | elif rev: | |
|
1876 | ctx = repo.changectx(rev) | |
|
1875 | 1877 | else: |
|
1876 |
|
|
|
1878 | ctx = repo.workingctx() | |
|
1879 | p = [cp.node() for cp in ctx.parents()] | |
|
1877 | 1880 | |
|
1878 | 1881 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
1879 | 1882 | for n in p: |
General Comments 0
You need to be logged in to leave comments.
Login now