mercurial/commands.py
changeset 2083 345107e167a0
parent 2072 74d3f5336b66
parent 2049 f70952384ae7
child 2085 f71e9656524f
equal deleted inserted replaced
2082:856f0ba200bc 2083:345107e167a0
  2388         #   action if in target manifest
  2388         #   action if in target manifest
  2389         #   action if not in target manifest
  2389         #   action if not in target manifest
  2390         #   make backup if in target manifest
  2390         #   make backup if in target manifest
  2391         #   make backup if not in target manifest
  2391         #   make backup if not in target manifest
  2392         (modified, revert, remove, True, True),
  2392         (modified, revert, remove, True, True),
  2393         (added, revert, forget, True, True),
  2393         (added, revert, forget, True, False),
  2394         (removed, undelete, None, False, False),
  2394         (removed, undelete, None, False, False),
  2395         (deleted, revert, remove, False, False),
  2395         (deleted, revert, remove, False, False),
  2396         (unknown, add, None, True, False),
  2396         (unknown, add, None, True, False),
  2397         (target_only, add, None, False, False),
  2397         (target_only, add, None, False, False),
  2398         )
  2398         )
  2755     This command should be used with care. There is only one level of
  2755     This command should be used with care. There is only one level of
  2756     undo and there is no redo.
  2756     undo and there is no redo.
  2757 
  2757 
  2758     This command is not intended for use on public repositories. Once
  2758     This command is not intended for use on public repositories. Once
  2759     a change is visible for pull by other users, undoing it locally is
  2759     a change is visible for pull by other users, undoing it locally is
  2760     ineffective.
  2760     ineffective. Furthemore a race is possible with readers of the
       
  2761     repository, for example an ongoing pull from the repository will
       
  2762     fail and rollback.
  2761     """
  2763     """
  2762     repo.undo()
  2764     repo.undo()
  2763 
  2765 
  2764 def update(ui, repo, node=None, merge=False, clean=False, force=None,
  2766 def update(ui, repo, node=None, merge=False, clean=False, force=None,
  2765            branch=None, **opts):
  2767            branch=None, **opts):
  2990           ('I', 'include', [], _('include names matching the given patterns')),
  2992           ('I', 'include', [], _('include names matching the given patterns')),
  2991           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
  2993           ('X', 'exclude', [], _('exclude names matching the given patterns'))],
  2992          _('hg log [OPTION]... [FILE]')),
  2994          _('hg log [OPTION]... [FILE]')),
  2993     "manifest": (manifest, [], _('hg manifest [REV]')),
  2995     "manifest": (manifest, [], _('hg manifest [REV]')),
  2994     "merge":
  2996     "merge":
  2995     (merge,
  2997         (merge,
  2996      [('b', 'branch', '', _('merge with head of a specific branch')),
  2998          [('b', 'branch', '', _('merge with head of a specific branch')),
  2997       ('', 'style', '', _('display using template map file')),
  2999           ('f', 'force', None, _('force a merge with outstanding changes'))],
  2998       ('f', 'force', None, _('force a merge with outstanding changes')),
  3000          _('hg merge [-b TAG] [-f] [REV]')),
  2999       ('', 'template', '', _('display with template'))],
       
  3000      _('hg merge [-b TAG] [-f] [REV]')),
       
  3001     "outgoing|out": (outgoing,
  3001     "outgoing|out": (outgoing,
  3002          [('M', 'no-merges', None, _('do not show merges')),
  3002          [('M', 'no-merges', None, _('do not show merges')),
  3003           ('f', 'force', None,
  3003           ('f', 'force', None,
  3004            _('run even when remote repository is unrelated')),
  3004            _('run even when remote repository is unrelated')),
  3005           ('p', 'patch', None, _('show patch')),
  3005           ('p', 'patch', None, _('show patch')),
  3121          _('hg unbundle [-u] FILE')),
  3121          _('hg unbundle [-u] FILE')),
  3122     "undo": (undo, [], _('hg undo')),
  3122     "undo": (undo, [], _('hg undo')),
  3123     "^update|up|checkout|co":
  3123     "^update|up|checkout|co":
  3124         (update,
  3124         (update,
  3125          [('b', 'branch', '', _('checkout the head of a specific branch')),
  3125          [('b', 'branch', '', _('checkout the head of a specific branch')),
  3126           ('', 'style', '', _('display using template map file')),
       
  3127           ('m', 'merge', None, _('allow merging of branches')),
  3126           ('m', 'merge', None, _('allow merging of branches')),
  3128           ('C', 'clean', None, _('overwrite locally modified files')),
  3127           ('C', 'clean', None, _('overwrite locally modified files')),
  3129           ('f', 'force', None, _('force a merge with outstanding changes')),
  3128           ('f', 'force', None, _('force a merge with outstanding changes'))],
  3130           ('', 'template', '', _('display with template'))],
       
  3131          _('hg update [-b TAG] [-m] [-C] [-f] [REV]')),
  3129          _('hg update [-b TAG] [-m] [-C] [-f] [REV]')),
  3132     "verify": (verify, [], _('hg verify')),
  3130     "verify": (verify, [], _('hg verify')),
  3133     "version": (show_version, [], _('hg version')),
  3131     "version": (show_version, [], _('hg version')),
  3134 }
  3132 }
  3135 
  3133 
  3155 optionalrepo = ("paths debugconfig")
  3153 optionalrepo = ("paths debugconfig")
  3156 
  3154 
  3157 def findpossible(cmd):
  3155 def findpossible(cmd):
  3158     """
  3156     """
  3159     Return cmd -> (aliases, command table entry)
  3157     Return cmd -> (aliases, command table entry)
  3160     for each matching command
  3158     for each matching command.
       
  3159     Return debug commands (or their aliases) only if no normal command matches.
  3161     """
  3160     """
  3162     choice = {}
  3161     choice = {}
  3163     debugchoice = {}
  3162     debugchoice = {}
  3164     for e in table.keys():
  3163     for e in table.keys():
  3165         aliases = e.lstrip("^").split("|")
  3164         aliases = e.lstrip("^").split("|")
       
  3165         found = None
  3166         if cmd in aliases:
  3166         if cmd in aliases:
  3167             choice[cmd] = (aliases, table[e])
  3167             found = cmd
  3168             continue
  3168         else:
  3169         for a in aliases:
  3169             for a in aliases:
  3170             if a.startswith(cmd):
  3170                 if a.startswith(cmd):
  3171                 if aliases[0].startswith("debug"):
  3171                     found = a
  3172                     debugchoice[a] = (aliases, table[e])
  3172                     break
  3173                 else:
  3173         if found is not None:
  3174                     choice[a] = (aliases, table[e])
  3174             if aliases[0].startswith("debug"):
  3175                 break
  3175                 debugchoice[found] = (aliases, table[e])
       
  3176             else:
       
  3177                 choice[found] = (aliases, table[e])
  3176 
  3178 
  3177     if not choice and debugchoice:
  3179     if not choice and debugchoice:
  3178         choice = debugchoice
  3180         choice = debugchoice
  3179 
  3181 
  3180     return choice
  3182     return choice