hgext/mq.py
changeset 40295 fa88170c10bb
parent 40293 c303d65d2e34
child 40360 dee73a97e132
equal deleted inserted replaced
40294:fabbf9310025 40295:fa88170c10bb
  2431             r.wvfs('series', 'w').close()
  2431             r.wvfs('series', 'w').close()
  2432         r[None].add(['.hgignore', 'series'])
  2432         r[None].add(['.hgignore', 'series'])
  2433         commands.add(ui, r)
  2433         commands.add(ui, r)
  2434     return 0
  2434     return 0
  2435 
  2435 
  2436 @command("^qinit",
  2436 @command("qinit",
  2437          [('c', 'create-repo', None, _('create queue repository'))],
  2437          [('c', 'create-repo', None, _('create queue repository'))],
  2438          _('hg qinit [-c]'),
  2438          _('hg qinit [-c]'),
  2439          helpcategory=command.CATEGORY_REPO_CREATION)
  2439          helpcategory=command.CATEGORY_REPO_CREATION,
       
  2440          helpbasic=True)
  2440 def init(ui, repo, **opts):
  2441 def init(ui, repo, **opts):
  2441     """init a new queue repository (DEPRECATED)
  2442     """init a new queue repository (DEPRECATED)
  2442 
  2443 
  2443     The queue repository is unversioned by default. If
  2444     The queue repository is unversioned by default. If
  2444     -c/--create-repo is specified, qinit will create a separate nested
  2445     -c/--create-repo is specified, qinit will create a separate nested
  2538         if not opts.get('noupdate'):
  2539         if not opts.get('noupdate'):
  2539             ui.note(_('updating destination repository\n'))
  2540             ui.note(_('updating destination repository\n'))
  2540             hg.update(repo, repo.changelog.tip())
  2541             hg.update(repo, repo.changelog.tip())
  2541 
  2542 
  2542 @command("qcommit|qci",
  2543 @command("qcommit|qci",
  2543          commands.table["^commit|ci"][1],
  2544          commands.table["commit|ci"][1],
  2544          _('hg qcommit [OPTION]... [FILE]...'),
  2545          _('hg qcommit [OPTION]... [FILE]...'),
  2545          helpcategory=command.CATEGORY_COMMITTING,
  2546          helpcategory=command.CATEGORY_COMMITTING,
  2546          inferrepo=True)
  2547          inferrepo=True)
  2547 def commit(ui, repo, *pats, **opts):
  2548 def commit(ui, repo, *pats, **opts):
  2548     """commit changes in the queue repository (DEPRECATED)
  2549     """commit changes in the queue repository (DEPRECATED)
  2621     if not opts.get('user') and opts.get('currentuser'):
  2622     if not opts.get('user') and opts.get('currentuser'):
  2622         opts['user'] = ui.username()
  2623         opts['user'] = ui.username()
  2623     if not opts.get('date') and opts.get('currentdate'):
  2624     if not opts.get('date') and opts.get('currentdate'):
  2624         opts['date'] = "%d %d" % dateutil.makedate()
  2625         opts['date'] = "%d %d" % dateutil.makedate()
  2625 
  2626 
  2626 @command("^qnew",
  2627 @command("qnew",
  2627          [('e', 'edit', None, _('invoke editor on commit messages')),
  2628          [('e', 'edit', None, _('invoke editor on commit messages')),
  2628           ('f', 'force', None, _('import uncommitted changes (DEPRECATED)')),
  2629           ('f', 'force', None, _('import uncommitted changes (DEPRECATED)')),
  2629           ('g', 'git', None, _('use git extended diff format')),
  2630           ('g', 'git', None, _('use git extended diff format')),
  2630           ('U', 'currentuser', None, _('add "From: <current user>" to patch')),
  2631           ('U', 'currentuser', None, _('add "From: <current user>" to patch')),
  2631           ('u', 'user', '',
  2632           ('u', 'user', '',
  2633           ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
  2634           ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
  2634           ('d', 'date', '',
  2635           ('d', 'date', '',
  2635            _('add "Date: <DATE>" to patch'), _('DATE'))
  2636            _('add "Date: <DATE>" to patch'), _('DATE'))
  2636           ] + cmdutil.walkopts + cmdutil.commitopts,
  2637           ] + cmdutil.walkopts + cmdutil.commitopts,
  2637          _('hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...'),
  2638          _('hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...'),
  2638          helpcategory=command.CATEGORY_COMMITTING,
  2639          helpcategory=command.CATEGORY_COMMITTING, helpbasic=True,
  2639          inferrepo=True)
  2640          inferrepo=True)
  2640 def new(ui, repo, patch, *args, **opts):
  2641 def new(ui, repo, patch, *args, **opts):
  2641     """create a new patch
  2642     """create a new patch
  2642 
  2643 
  2643     qnew creates a new patch on top of the currently-applied patch (if
  2644     qnew creates a new patch on top of the currently-applied patch (if
  2669     setupheaderopts(ui, opts)
  2670     setupheaderopts(ui, opts)
  2670     q.new(repo, patch, *args, **pycompat.strkwargs(opts))
  2671     q.new(repo, patch, *args, **pycompat.strkwargs(opts))
  2671     q.savedirty()
  2672     q.savedirty()
  2672     return 0
  2673     return 0
  2673 
  2674 
  2674 @command("^qrefresh",
  2675 @command("qrefresh",
  2675          [('e', 'edit', None, _('invoke editor on commit messages')),
  2676          [('e', 'edit', None, _('invoke editor on commit messages')),
  2676           ('g', 'git', None, _('use git extended diff format')),
  2677           ('g', 'git', None, _('use git extended diff format')),
  2677           ('s', 'short', None,
  2678           ('s', 'short', None,
  2678            _('refresh only files already in the patch and specified files')),
  2679            _('refresh only files already in the patch and specified files')),
  2679           ('U', 'currentuser', None,
  2680           ('U', 'currentuser', None,
  2684            _('add/update date field in patch with current date')),
  2685            _('add/update date field in patch with current date')),
  2685           ('d', 'date', '',
  2686           ('d', 'date', '',
  2686            _('add/update date field in patch with given date'), _('DATE'))
  2687            _('add/update date field in patch with given date'), _('DATE'))
  2687           ] + cmdutil.walkopts + cmdutil.commitopts,
  2688           ] + cmdutil.walkopts + cmdutil.commitopts,
  2688          _('hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'),
  2689          _('hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'),
  2689          helpcategory=command.CATEGORY_COMMITTING,
  2690          helpcategory=command.CATEGORY_COMMITTING, helpbasic=True,
  2690          inferrepo=True)
  2691          inferrepo=True)
  2691 def refresh(ui, repo, *pats, **opts):
  2692 def refresh(ui, repo, *pats, **opts):
  2692     """update the current patch
  2693     """update the current patch
  2693 
  2694 
  2694     If any file patterns are provided, the refreshed patch will
  2695     If any file patterns are provided, the refreshed patch will
  2716     with repo.wlock():
  2717     with repo.wlock():
  2717         ret = q.refresh(repo, pats, msg=message, **pycompat.strkwargs(opts))
  2718         ret = q.refresh(repo, pats, msg=message, **pycompat.strkwargs(opts))
  2718         q.savedirty()
  2719         q.savedirty()
  2719         return ret
  2720         return ret
  2720 
  2721 
  2721 @command("^qdiff",
  2722 @command("qdiff",
  2722          cmdutil.diffopts + cmdutil.diffopts2 + cmdutil.walkopts,
  2723          cmdutil.diffopts + cmdutil.diffopts2 + cmdutil.walkopts,
  2723          _('hg qdiff [OPTION]... [FILE]...'),
  2724          _('hg qdiff [OPTION]... [FILE]...'),
  2724          helpcategory=command.CATEGORY_FILE_CONTENTS,
  2725          helpcategory=command.CATEGORY_FILE_CONTENTS, helpbasic=True,
  2725          inferrepo=True)
  2726          inferrepo=True)
  2726 def diff(ui, repo, *pats, **opts):
  2727 def diff(ui, repo, *pats, **opts):
  2727     """diff of the current patch and subsequent modifications
  2728     """diff of the current patch and subsequent modifications
  2728 
  2729 
  2729     Shows a diff which includes the current patch as well as any
  2730     Shows a diff which includes the current patch as well as any
  2954     if last is None:
  2955     if last is None:
  2955         index = 0
  2956         index = 0
  2956     newpath = path + ".%d" % (index + 1)
  2957     newpath = path + ".%d" % (index + 1)
  2957     return newpath
  2958     return newpath
  2958 
  2959 
  2959 @command("^qpush",
  2960 @command("qpush",
  2960          [('', 'keep-changes', None,
  2961          [('', 'keep-changes', None,
  2961            _('tolerate non-conflicting local changes')),
  2962            _('tolerate non-conflicting local changes')),
  2962           ('f', 'force', None, _('apply on top of local changes')),
  2963           ('f', 'force', None, _('apply on top of local changes')),
  2963           ('e', 'exact', None,
  2964           ('e', 'exact', None,
  2964            _('apply the target patch to its recorded parent')),
  2965            _('apply the target patch to its recorded parent')),
  2969            _('merge queue name (DEPRECATED)'), _('NAME')),
  2970            _('merge queue name (DEPRECATED)'), _('NAME')),
  2970           ('', 'move', None,
  2971           ('', 'move', None,
  2971            _('reorder patch series and apply only the patch')),
  2972            _('reorder patch series and apply only the patch')),
  2972           ('', 'no-backup', None, _('do not save backup copies of files'))],
  2973           ('', 'no-backup', None, _('do not save backup copies of files'))],
  2973          _('hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]'),
  2974          _('hg qpush [-f] [-l] [-a] [--move] [PATCH | INDEX]'),
  2974          helpcategory=command.CATEGORY_CHANGE_ORGANIZATION)
  2975          helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
       
  2976          helpbasic=True)
  2975 def push(ui, repo, patch=None, **opts):
  2977 def push(ui, repo, patch=None, **opts):
  2976     """push the next patch onto the stack
  2978     """push the next patch onto the stack
  2977 
  2979 
  2978     By default, abort if the working directory contains uncommitted
  2980     By default, abort if the working directory contains uncommitted
  2979     changes. With --keep-changes, abort only if the uncommitted files
  2981     changes. With --keep-changes, abort only if the uncommitted files
  3001                  mergeq=mergeq, all=opts.get('all'), move=opts.get('move'),
  3003                  mergeq=mergeq, all=opts.get('all'), move=opts.get('move'),
  3002                  exact=opts.get('exact'), nobackup=opts.get('no_backup'),
  3004                  exact=opts.get('exact'), nobackup=opts.get('no_backup'),
  3003                  keepchanges=opts.get('keep_changes'))
  3005                  keepchanges=opts.get('keep_changes'))
  3004     return ret
  3006     return ret
  3005 
  3007 
  3006 @command("^qpop",
  3008 @command("qpop",
  3007          [('a', 'all', None, _('pop all patches')),
  3009          [('a', 'all', None, _('pop all patches')),
  3008           ('n', 'name', '',
  3010           ('n', 'name', '',
  3009            _('queue name to pop (DEPRECATED)'), _('NAME')),
  3011            _('queue name to pop (DEPRECATED)'), _('NAME')),
  3010           ('', 'keep-changes', None,
  3012           ('', 'keep-changes', None,
  3011            _('tolerate non-conflicting local changes')),
  3013            _('tolerate non-conflicting local changes')),
  3012           ('f', 'force', None, _('forget any local changes to patched files')),
  3014           ('f', 'force', None, _('forget any local changes to patched files')),
  3013           ('', 'no-backup', None, _('do not save backup copies of files'))],
  3015           ('', 'no-backup', None, _('do not save backup copies of files'))],
  3014          _('hg qpop [-a] [-f] [PATCH | INDEX]'),
  3016          _('hg qpop [-a] [-f] [PATCH | INDEX]'),
  3015          helpcategory=command.CATEGORY_CHANGE_ORGANIZATION)
  3017          helpcategory=command.CATEGORY_CHANGE_ORGANIZATION,
       
  3018          helpbasic=True)
  3016 def pop(ui, repo, patch=None, **opts):
  3019 def pop(ui, repo, patch=None, **opts):
  3017     """pop the current patch off the stack
  3020     """pop the current patch off the stack
  3018 
  3021 
  3019     Without argument, pops off the top of the patch stack. If given a
  3022     Without argument, pops off the top of the patch stack. If given a
  3020     patch name, keeps popping off patches until the named patch is at
  3023     patch name, keeps popping off patches until the named patch is at