mercurial/commands.py
branchstable
changeset 13477 0fb2ff949790
parent 13473 bbdd858e3229
child 13568 0b79cf616e65
child 13620 8ee4b00ddfd8
equal deleted inserted replaced
13476:b85a09f368bd 13477:0fb2ff949790
  2238                                              initindent=initindent,
  2238                                              initindent=initindent,
  2239                                              hangindent=hangindent)))
  2239                                              hangindent=hangindent)))
  2240             else:
  2240             else:
  2241                 ui.write("%s\n" % opt)
  2241                 ui.write("%s\n" % opt)
  2242 
  2242 
  2243 def identify(ui, repo, source=None,
  2243 def identify(ui, repo, source=None, rev=None,
  2244              rev=None, num=None, id=None, branch=None, tags=None):
  2244              num=None, id=None, branch=None, tags=None, bookmarks=None):
  2245     """identify the working copy or specified revision
  2245     """identify the working copy or specified revision
  2246 
  2246 
  2247     With no revision, print a summary of the current state of the
  2247     With no revision, print a summary of the current state of the
  2248     repository.
  2248     repository.
  2249 
  2249 
  2261     if not repo and not source:
  2261     if not repo and not source:
  2262         raise util.Abort(_("there is no Mercurial repository here "
  2262         raise util.Abort(_("there is no Mercurial repository here "
  2263                            "(.hg not found)"))
  2263                            "(.hg not found)"))
  2264 
  2264 
  2265     hexfunc = ui.debugflag and hex or short
  2265     hexfunc = ui.debugflag and hex or short
  2266     default = not (num or id or branch or tags)
  2266     default = not (num or id or branch or tags or bookmarks)
  2267     output = []
  2267     output = []
  2268 
  2268 
  2269     revs = []
  2269     revs = []
  2270     if source:
  2270     if source:
  2271         source, branches = hg.parseurl(ui.expandpath(source))
  2271         source, branches = hg.parseurl(ui.expandpath(source))
  2275     if not repo.local():
  2275     if not repo.local():
  2276         if not rev and revs:
  2276         if not rev and revs:
  2277             rev = revs[0]
  2277             rev = revs[0]
  2278         if not rev:
  2278         if not rev:
  2279             rev = "tip"
  2279             rev = "tip"
  2280         if num or branch or tags:
  2280         if num or branch or tags or bookmarks:
  2281             raise util.Abort(
  2281             raise util.Abort(_("can't query remote revision number,"
  2282                 _("can't query remote revision number, branch, or tags"))
  2282                              " branch, tags, or bookmarks"))
  2283         output = [hexfunc(repo.lookup(rev))]
  2283         output = [hexfunc(repo.lookup(rev))]
  2284     elif not rev:
  2284     elif not rev:
  2285         ctx = repo[None]
  2285         ctx = repo[None]
  2286         parents = ctx.parents()
  2286         parents = ctx.parents()
  2287         changed = False
  2287         changed = False
  2308         # multiple tags for a single parent separated by '/'
  2308         # multiple tags for a single parent separated by '/'
  2309         t = "/".join(ctx.tags())
  2309         t = "/".join(ctx.tags())
  2310         if t:
  2310         if t:
  2311             output.append(t)
  2311             output.append(t)
  2312 
  2312 
       
  2313         # multiple bookmarks for a single parent separated by '/'
       
  2314         bm = '/'.join(ctx.bookmarks())
       
  2315         if bm:
       
  2316             output.append(bm)
       
  2317 
  2313     if branch:
  2318     if branch:
  2314         output.append(ctx.branch())
  2319         output.append(ctx.branch())
  2315 
  2320 
  2316     if tags:
  2321     if tags:
  2317         output.extend(ctx.tags())
  2322         output.extend(ctx.tags())
       
  2323 
       
  2324     if bookmarks:
       
  2325         output.extend(ctx.bookmarks())
  2318 
  2326 
  2319     ui.write("%s\n" % ' '.join(output))
  2327     ui.write("%s\n" % ' '.join(output))
  2320 
  2328 
  2321 def import_(ui, repo, patch1, *patches, **opts):
  2329 def import_(ui, repo, patch1, *patches, **opts):
  2322     """import an ordered set of patches
  2330     """import an ordered set of patches
  4458          [('r', 'rev', '',
  4466          [('r', 'rev', '',
  4459            _('identify the specified revision'), _('REV')),
  4467            _('identify the specified revision'), _('REV')),
  4460           ('n', 'num', None, _('show local revision number')),
  4468           ('n', 'num', None, _('show local revision number')),
  4461           ('i', 'id', None, _('show global revision id')),
  4469           ('i', 'id', None, _('show global revision id')),
  4462           ('b', 'branch', None, _('show branch')),
  4470           ('b', 'branch', None, _('show branch')),
  4463           ('t', 'tags', None, _('show tags'))],
  4471           ('t', 'tags', None, _('show tags')),
  4464          _('[-nibt] [-r REV] [SOURCE]')),
  4472           ('B', 'bookmarks', None, _('show bookmarks'))],
       
  4473          _('[-nibtB] [-r REV] [SOURCE]')),
  4465     "import|patch":
  4474     "import|patch":
  4466         (import_,
  4475         (import_,
  4467          [('p', 'strip', 1,
  4476          [('p', 'strip', 1,
  4468            _('directory strip option for patch. This has the same '
  4477            _('directory strip option for patch. This has the same '
  4469              'meaning as the corresponding patch option'),
  4478              'meaning as the corresponding patch option'),