hgext/mq.py
changeset 2940 b1e6d701a03a
parent 2939 abd0be815c9c
child 2941 d32df6452323
equal deleted inserted replaced
2939:abd0be815c9c 2940:b1e6d701a03a
  1433     q.new(repo, patch, msg=message, force=opts['force'])
  1433     q.new(repo, patch, msg=message, force=opts['force'])
  1434     q.save_dirty()
  1434     q.save_dirty()
  1435     return 0
  1435     return 0
  1436 
  1436 
  1437 def refresh(ui, repo, *pats, **opts):
  1437 def refresh(ui, repo, *pats, **opts):
  1438     """update the current patch"""
  1438     """update the current patch
       
  1439 
       
  1440     If any file patterns are provided, the refreshed patch will contain only
       
  1441     the modifications that match those patterns; the remaining modifications
       
  1442     will remain in the working directory.
       
  1443     """
  1439     q = repo.mq
  1444     q = repo.mq
  1440     message = commands.logmessage(opts)
  1445     message = commands.logmessage(opts)
  1441     if opts['edit']:
  1446     if opts['edit']:
  1442         if message:
  1447         if message:
  1443             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
  1448             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
  1513     q.save_dirty()
  1518     q.save_dirty()
  1514 
  1519 
  1515 def guard(ui, repo, *args, **opts):
  1520 def guard(ui, repo, *args, **opts):
  1516     '''set or print guards for a patch
  1521     '''set or print guards for a patch
  1517 
  1522 
  1518     guards control whether a patch can be pushed.  a patch with no
  1523     Guards control whether a patch can be pushed. A patch with no
  1519     guards is aways pushed.  a patch with posative guard ("+foo") is
  1524     guards is always pushed. A patch with a positive guard ("+foo") is
  1520     pushed only if qselect command enables guard "foo".  a patch with
  1525     pushed only if the qselect command has activated it. A patch with
  1521     nagative guard ("-foo") is never pushed if qselect command enables
  1526     a negative guard ("-foo") is never pushed if the qselect command
  1522     guard "foo".
  1527     has activated it.
  1523 
  1528 
  1524     with no arguments, default is to print current active guards.
  1529     With no arguments, print the currently active guards.
  1525     with arguments, set active guards for patch.
  1530     With arguments, set guards for the named patch.
  1526 
  1531 
  1527     to set nagative guard "-foo" on topmost patch ("--" is needed so
  1532     To set a negative guard "-foo" on topmost patch ("--" is needed so
  1528     hg will not interpret "-foo" as argument):
  1533     hg will not interpret "-foo" as an option):
  1529       hg qguard -- -foo
  1534       hg qguard -- -foo
  1530 
  1535 
  1531     to set guards on other patch:
  1536     To set guards on another patch:
  1532       hg qguard other.patch +2.6.17 -stable    
  1537       hg qguard other.patch +2.6.17 -stable    
  1533     '''
  1538     '''
  1534     def status(idx):
  1539     def status(idx):
  1535         guards = q.series_guards[idx] or ['unguarded']
  1540         guards = q.series_guards[idx] or ['unguarded']
  1536         ui.write('%s: %s\n' % (q.series[idx], ' '.join(guards)))
  1541         ui.write('%s: %s\n' % (q.series[idx], ' '.join(guards)))
  1732     return 0
  1737     return 0
  1733 
  1738 
  1734 def select(ui, repo, *args, **opts):
  1739 def select(ui, repo, *args, **opts):
  1735     '''set or print guarded patches to push
  1740     '''set or print guarded patches to push
  1736 
  1741 
  1737     use qguard command to set or print guards on patch.  then use
  1742     Use the qguard command to set or print guards on patch, then use
  1738     qselect to tell mq which guards to use.  example:
  1743     qselect to tell mq which guards to use. A patch will be pushed if it
  1739 
  1744     has no guards or any positive guards match the currently selected guard,
  1740         qguard foo.patch -stable    (nagative guard)
  1745     but will not be pushed if any negative guards match the current guard.
  1741         qguard bar.patch +stable    (posative guard)
  1746     For example:
       
  1747 
       
  1748         qguard foo.patch -stable    (negative guard)
       
  1749         qguard bar.patch +stable    (positive guard)
  1742         qselect stable
  1750         qselect stable
  1743 
  1751 
  1744     this sets "stable" guard.  mq will skip foo.patch (because it has
  1752     This activates the "stable" guard. mq will skip foo.patch (because
  1745     nagative match) but push bar.patch (because it has posative
  1753     it has a negative match) but push bar.patch (because it
  1746     match).  patch is pushed if any posative guards match and no
  1754     has a positive match).
  1747     nagative guards match.
  1755 
  1748 
  1756     With no arguments, prints the currently active guards.
  1749     with no arguments, default is to print current active guards.
  1757     With one argument, sets the active guard.
  1750     with arguments, set active guards as given.
       
  1751     
  1758     
  1752     use -n/--none to deactivate guards (no other arguments needed).
  1759     Use -n/--none to deactivate guards (no other arguments needed).
  1753     when no guards active, patches with posative guards are skipped,
  1760     When no guards are active, patches with positive guards are skipped
  1754     patches with nagative guards are pushed.
  1761     and patches with negative guards are pushed.
  1755 
  1762 
  1756     qselect can change guards of applied patches. it does not pop
  1763     qselect can change the guards on applied patches. It does not pop
  1757     guarded patches by default.  use --pop to pop back to last applied
  1764     guarded patches by default. Use --pop to pop back to the last applied
  1758     patch that is not guarded.  use --reapply (implies --pop) to push
  1765     patch that is not guarded. Use --reapply (which implies --pop) to push
  1759     back to current patch afterwards, but skip guarded patches.
  1766     back to the current patch afterwards, but skip guarded patches.
  1760 
  1767 
  1761     use -s/--series to print list of all guards in series file (no
  1768     Use -s/--series to print a list of all guards in the series file (no
  1762     other arguments needed).  use -v for more information.'''
  1769     other arguments needed). Use -v for more information.'''
  1763 
  1770 
  1764     q = repo.mq
  1771     q = repo.mq
  1765     guards = q.active()
  1772     guards = q.active()
  1766     if args or opts['none']:
  1773     if args or opts['none']:
  1767         old_unapplied = q.unapplied(repo)
  1774         old_unapplied = q.unapplied(repo)