Show More
@@ -1985,16 +1985,30 b' def parents(ui, repo, file_=None, **opts' | |||||
1985 | revision or the argument to --rev if given) is printed. |
|
1985 | revision or the argument to --rev if given) is printed. | |
1986 | """ |
|
1986 | """ | |
1987 | rev = opts.get('rev') |
|
1987 | rev = opts.get('rev') | |
|
1988 | if rev: | |||
|
1989 | ctx = repo.changectx(rev) | |||
|
1990 | else: | |||
|
1991 | ctx = repo.workingctx() | |||
|
1992 | ||||
1988 | if file_: |
|
1993 | if file_: | |
1989 | files, match, anypats = cmdutil.matchpats(repo, (file_,), opts) |
|
1994 | files, match, anypats = cmdutil.matchpats(repo, (file_,), opts) | |
1990 | if anypats or len(files) != 1: |
|
1995 | if anypats or len(files) != 1: | |
1991 | raise util.Abort(_('can only specify an explicit file name')) |
|
1996 | raise util.Abort(_('can only specify an explicit file name')) | |
1992 | ctx = repo.filectx(files[0], changeid=rev) |
|
1997 | file_ = files[0] | |
1993 | elif rev: |
|
1998 | filenodes = [] | |
1994 | ctx = repo.changectx(rev) |
|
1999 | for cp in ctx.parents(): | |
|
2000 | if not cp: | |||
|
2001 | continue | |||
|
2002 | try: | |||
|
2003 | filenodes.append(cp.filenode(file_)) | |||
|
2004 | except revlog.LookupError: | |||
|
2005 | pass | |||
|
2006 | if not filenodes: | |||
|
2007 | raise util.Abort(_("'%s' not found in manifest!") % file_) | |||
|
2008 | fl = repo.file(file_) | |||
|
2009 | p = [repo.lookup(fl.linkrev(fn)) for fn in filenodes] | |||
1995 | else: |
|
2010 | else: | |
1996 | ctx = repo.workingctx() |
|
2011 | p = [cp.node() for cp in ctx.parents()] | |
1997 | p = [cp.node() for cp in ctx.parents()] |
|
|||
1998 |
|
2012 | |||
1999 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
2013 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
2000 | for n in p: |
|
2014 | for n in p: |
General Comments 0
You need to be logged in to leave comments.
Login now