1861 displayer.show(changenode=n) |
1861 displayer.show(changenode=n) |
1862 |
1862 |
1863 def parents(ui, repo, file_=None, **opts): |
1863 def parents(ui, repo, file_=None, **opts): |
1864 """show the parents of the working dir or revision |
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 rev = opts.get('rev') |
1872 rev = opts.get('rev') |
1869 if rev: |
1873 if file_: |
1870 if file_: |
1874 ctx = repo.filectx(file_, changeid=rev) |
1871 ctx = repo.filectx(file_, changeid=rev) |
1875 elif rev: |
1872 else: |
1876 ctx = repo.changectx(rev) |
1873 ctx = repo.changectx(rev) |
|
1874 p = [cp.node() for cp in ctx.parents()] |
|
1875 else: |
1877 else: |
1876 p = repo.dirstate.parents() |
1878 ctx = repo.workingctx() |
|
1879 p = [cp.node() for cp in ctx.parents()] |
1877 |
1880 |
1878 displayer = cmdutil.show_changeset(ui, repo, opts) |
1881 displayer = cmdutil.show_changeset(ui, repo, opts) |
1879 for n in p: |
1882 for n in p: |
1880 if n != nullid: |
1883 if n != nullid: |
1881 displayer.show(changenode=n) |
1884 displayer.show(changenode=n) |