comparison hgext/githelp.py @ 42397:7752cd3a2f83

githelp: translate git stash show and clear actions and --patch flag Differential Revision: https://phab.mercurial-scm.org/D6461
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 30 May 2019 16:42:38 +0800
parents 37ff80505dfd
children 2372284d9457
comparison
equal deleted inserted replaced
42396:37ff80505dfd 42397:7752cd3a2f83
921 921
922 ui.status((bytes(cmd)), "\n") 922 ui.status((bytes(cmd)), "\n")
923 923
924 def stash(ui, repo, *args, **kwargs): 924 def stash(ui, repo, *args, **kwargs):
925 cmdoptions = [ 925 cmdoptions = [
926 ('p', 'patch', None, ''),
926 ] 927 ]
927 args, opts = parseoptions(ui, cmdoptions, args) 928 args, opts = parseoptions(ui, cmdoptions, args)
928 929
929 cmd = Command('shelve') 930 cmd = Command('shelve')
930 action = args[0] if len(args) > 0 else None 931 action = args[0] if len(args) > 0 else None
931 932
932 if action == 'list': 933 if action == 'list':
933 cmd['-l'] = None 934 cmd['-l'] = None
935 if opts.get('patch'):
936 cmd['-p'] = None
937 elif action == 'show':
938 if opts.get('patch'):
939 cmd['-p'] = None
940 else:
941 cmd['--stat'] = None
942 if len(args) > 1:
943 cmd.append(args[1])
944 elif action == 'clear':
945 cmd['--cleanup'] = None
934 elif action == 'drop': 946 elif action == 'drop':
935 cmd['-d'] = None 947 cmd['-d'] = None
936 if len(args) > 1: 948 if len(args) > 1:
937 cmd.append(args[1]) 949 cmd.append(args[1])
938 else: 950 else:
941 cmd = Command('unshelve') 953 cmd = Command('unshelve')
942 if len(args) > 1: 954 if len(args) > 1:
943 cmd.append(args[1]) 955 cmd.append(args[1])
944 if action == 'apply': 956 if action == 'apply':
945 cmd['--keep'] = None 957 cmd['--keep'] = None
946 elif (action == 'branch' or action == 'show' or action == 'clear' 958 elif action == 'branch' or action == 'create':
947 or action == 'create'):
948 ui.status(_("note: Mercurial doesn't have equivalents to the " 959 ui.status(_("note: Mercurial doesn't have equivalents to the "
949 "git stash branch, show, clear, or create actions\n\n")) 960 "git stash branch or create actions\n\n"))
950 return 961 return
951 else: 962 else:
952 if len(args) > 0: 963 if len(args) > 0:
953 if args[0] != 'save': 964 if args[0] != 'save':
954 cmd['--name'] = args[0] 965 cmd['--name'] = args[0]