
    6h                       S r SSKJr  SSKrSSKrSSKJr  SSKJrJ	r	J
r
JrJrJr  SSKJr  Sr0 r\R$                  " \5      rS r\" S	/ \" S
5      \R(                  SS9S 5       rS r " S S5      r " S S5      rS rS rS rS rS rS rS rS r S r!S r"S r#S r$S r%S  r&S! r'S" r(S# r)S$ r*S% r+S& r,S' r-S( r.S) r/S* r0S+ r1S, r2S- r3S. r4S/ r5S0 r6S1 r7S2 r8S3 r9S4 r:S5 r;S6 r<S7 r=S8 r>S9 r?S: r@S; rA0 S<\_S=\_S>\_S?\_S@\_SA\_SB\ _SC\!_SD\"_SE\#_SF\$_SG\&_SH\'_SI\(_SJ\)_SK\*_SL\+_0 SM\,_SN\-_SO\._SP\/_SQ\0_SR\1_SS\2_ST\3_SU\4_SV\5_SW\6_SX\7_SY\8_SZ\9_S[\:_S\\;_S]\<_E\A\%S^.ErB\=\>\?\@S_.rCg)`ztry mapping git commands to Mercurial commands

Tries to map a given git command to a Mercurial command:

  $ hg githelp -- git checkout master
  hg update master

If an unknown command or parameter combination is detected, an error is
produced.
    )annotationsN)_)encodingerror	fancyoptspycompat	registrarscmutil)procutils   ships-with-hg-corec                    U R                  S5      (       a  U SS  $ SU ;   a  U R                  SS5      n [        R                  " SSU 5      n U $ )Ns   origin/   s   HEAD   .s   ~$s   ~1)
startswithreplaceresub)ss    //usr/lib/python3/dist-packages/hgext/githelp.pyconvertr   ,   sJ    ||Ju!|IIgt$
ueQAH    s   githelp|gits
   hg githelpT)helpcategory	helpbasicc                ^   [        U5      S:X  d  [        U5      S:X  a(  US   S:X  a  [        R                  " [        S5      5      eUS   S:X  a  USS nUS   nU[        ;  a"  [        R                  " [        S5      U-  5      eU R                  S5        USS n[        U   " X/UQ70 UD6$ )z_suggests the Mercurial equivalent of the given git command

Usage: hg githelp -- <git command>
r      s   gits8   missing git command - usage: hg githelp -- <git command>Ns   error: unknown git command %ss   githelp)lenr   Abortr   gitcommandspager)uirepoargskwargscmds        r   githelpr$   6   s     4yA~#d)q.T!W->kkIJ
 	
 Aw&ABx
q'C+kk!<=CDDHHZ8DsB6t6v66r   c           
        [        U5      n0 n[        U5      n  [        R                  " [        U5      XS5      n U Vs/ s H  n[        U5      PM     nn[        UR!                  5        V	V
s/ s H*  u  p[#        U
[$        5      (       a  U	[        U
5      4OX4PM,     sn
n	5      nX#4$ ! [        R                   Ga  nSUR                  ;   a  e SUR
                  -   UR                  ;   a$  S[        R                  " UR
                  5      -   nOSUR
                  -   UR                  ;   a$  S[        R                  " UR
                  5      -   nO@[        R                  " [        S5      [        R                  " UR
                  5      -  5      e UR                  U5        O{! [         an    [        S5      n[        S	5      n[        R                  " U[        R                  " UR
                  5      -  U[        R                  " UR
                  5      -  S
9ef = fU R                  [        S5      U-  5         S nAOS nAff = fGM5  s  snf s  sn
n	f )NTzrequires argumentz--   ---   -s   unknown option %ss-   unknown option '%s' packed with other optionss2   please try passing the option as its own flag: -%s)hints   ignoring unknown option %s
)listr   getoptGetoptErrormsgoptr   bytestrr   r   r   remove	Exceptionwarnr   dictitems
isinstancebytes)r   
cmdoptionsr!   optsexflagr-   r)   xkvs              r   parseoptionsr>   T   s   j!JD:D
	?&&tDz:TJD0 !%%1GAJD% 

	
$  *!U33Q
O!?$	
D :? !! 	?"bff,rvv"&&(x//77,266)h..rvv66kk*+h.>.>rvv.FF D! HINOkk(**26622 0 0 88  GGA56=>>+	?	 6 &	
s=   !B, I01I
,I	CIF'&I'A8H II	c                  \    \ rS rSrS rS r\R                  " \5      rS r	S r
S rS rSrg	)
Command~   c                ,    Xl         / U l        0 U l        g N)namer!   r8   )selfrD   s     r   __init__Command.__init__   s    			r   c                   SU R                   -   nU R                  (       ai  [        U R                  R                  5       5       HB  u  p#U H7  nU(       a$  [	        U[
        5      (       a  SnOSnXX$4-  -  nM.  USU4-  -  nM9     MD     U R                  (       a#  US-  nUSR                  U R                  5      -  nU$ )Ns   hg s    %s %ds    %s %ss    %s    )rD   r8   sortedr4   r5   intr!   join)rE   r#   r<   valuesr=   fmts         r   	__bytes__Command.__bytes__   s    tyy 99#DIIOO$56	A%a--"+C"+CaV|+v},   7 994KC499TYY''C
r   c                :    U R                   R                  U5        g rC   )r!   append)rE   values     r   rR   Command.append   s    		r   c                :    U R                   R                  U5        g rC   )r!   extend)rE   rM   s     r   rV   Command.extend   s    		 r   c                ^    U R                   R                  U/ 5      nUR                  U5        g rC   )r8   
setdefaultrR   )rE   keyrS   rM   s       r   __setitem__Command.__setitem__   s$    %%c2.er   c                    [        X5      $ rC   
AndCommandrE   others     r   __and__Command.__and__       $&&r   )r!   rD   r8   N)__name__
__module____qualname____firstlineno__rF   rO   r   	strmethod__str__rR   rV   r[   rb   __static_attributes__ r   r   r@   r@   ~   s2    
&   +G !'r   r@   c                  &    \ rS rSrS rS rS rSrg)r_      c                    Xl         X l        g rC   leftright)rE   rq   rr   s      r   rF   AndCommand.__init__   s    	
r   c                8    SU R                   U R                  4-  $ )Ns   %s && %srp   )rE   s    r   rj   AndCommand.__str__   s    dii444r   c                    [        X5      $ rC   r^   r`   s     r   rb   AndCommand.__and__   rd   r   rp   N)re   rf   rg   rh   rF   rj   rb   rk   rl   r   r   r_   r_      s    5'r   r_   c                p   SS/n[        XU5      u  p%UR                  S5      (       a&  U R                  [        S5      5        [	        S5      nOM[	        S5      nUR                  S5      (       d  UR                  U5        OU R                  [        S5      5        U R                  [        U5      S	5        g )
N)   A   allNr      p   patchNr   r}   sU   note: Mercurial will commit when complete, as there is no staging area in Mercurial

   commit --interactive   addrz   s?   note: use hg addremove to remove files that have been deleted

   
)r>   getstatusr   r@   rV   r6   r   r    r!   r"   r7   r8   r#   s          r   addr      s    !#J bd3JDxx
		@	
 -.foxxJJtII( IIuSzE"r   c                l    / n[        XU5        [        S5      nU R                  [        U5      S5        g )Ns   importr   r>   r@   r   r6   r   r    r!   r"   r7   r#   s         r   amr      s-    J&
)
CIIeCj% r   c                N   SS[         S4S/n[        XU5      u  p%[        S5      nUR                  S5      (       a  UR                  S5      US'   UR                  S5      (       a  UR                  S5      US'   UR	                  U5        U R                  [        U5      S5        g )	Nr|   r   )r   	   directoryr   r   s   import --no-commit   -pr   s   --prefixr   )rK   r>   r@   r   rV   r   r6   r   s          r   applyr      s    	tS#%J bd3JD
'
(Cxx~~XXd^E
xx88L1KJJtIIuSzE"r   c                8    U R                  [        S5      5        g )Ns,   see 'hg help bisect' for how to use bisect

r   r   r   r    r!   r"   s       r   bisectr      s    IIaABCr   c                    / n[        XU5      u  p%[        S5      nUR                  U Vs/ s H  n[        U5      PM     sn5        U R	                  [        U5      S5        g s  snf )Ns   annotate -udlr   )r>   r@   rV   r   r   r6   r   r    r!   r"   r7   r8   r#   r=   s           r   blamer      sV    Jbd3JD
"
#CJJD)Dq
D)*IIuSzE" *s   A#c                   / SQn[        XU5      u  p%[        S5      nUR                  S5      (       d  UR                  S5      (       a  U R                  [	        S5      5        g UR                  S5      (       a  [        S5      nU H  nXvS'   M	     S US'   OUR                  S	5      (       am  [        U5      S
:  a$  [        U5      S:  a  UR                  S
5      nO"SnO[        R                  " [	        S5      5      eUS
   n	XS'   UR                  U	5        OO[        U5      S:  a  US   US'   UR                  US
   5        O#[        U5      S:X  a  UR                  US
   5        U R                  [        U5      S5        g )N))r   s   set-upstreamNr   )r   s   set-upstream-tor   r      d   deleteNr   )   Dr   Nr   )   m   moveNr   )   Mr   Nr      bookmarks   set_upstreams   set_upstream_tos.   Mercurial has no concept of upstream branches
r   s   strip   -Br   r   r   s"   `hg log -T"{activebookmark}" -r .`s   missing newbranch argument   -m   -rr   )r>   r@   r   r   r   r   popr   r   rR   r6   )
r   r    r!   r"   r7   r8   r#   brancholdnews
             r   r   r      sI   J bd3JD
+
Cxx  DHH-?$@$@
		!FGH	)		hFJ  CJ	'		t9q=4y1}hhqk <++a =>??1gE


3t9q=aCJJJtAwY!^JJtAwIIuSzE"r   c                $   [         R                  " X5      (       a  gU R                  5       nUS:X  a  UnOUS-   U-   nU R                  R	                  U5      nU(       a  gU S   R                  5       nX5;   =(       d    UR                  U5      nU$ )a  
The first argument to git checkout can either be a revision or a path. Let's
generally assume it's a revision, unless it's obviously a path. There are
too many ways to spell revisions in git for us to reasonably catch all of
them, so let's be conservative.
Fr      /Tr   )r
   isrevsymbolgetcwdwvfsexistsmanifesthasdir)r    stringcwdrepopathr   r   didexists          r   ispathr   "  s     4(( 
++-C
cz:&YYh'FDz""$H$B)BHOr   c                   / SQn/ nSU;   a,  UR                  S5      nUR                  X&S-   S  5        US U n[        XU5      u  p'S nU(       a  [        XS   5      (       a  X%-   nOU(       a  US   nUSS  U-   n[	        S5      n	UR                  S5      (       a  U(       d  U(       a  S U	S'   UR                  S5      (       a  [	        S	5      n	S U	S
'   UR                  S5      (       a  [        U5      S:X  a-  [	        S5      n	U	R                  UR                  S5      5        GO*U	R                  US   5        [	        S5      n
U
R                  UR                  S5      5        X-  n	O[        U5      S:  a]  U R                  [        S5      5        [	        S	5      n	UR                  S5      (       a  S U	S
'   U(       a  XS'   U	R                  U5        OzU(       a-  UR                  S5      (       a  XS'   OXU	R                  U5        OFUR                  S5      (       a  [	        S	5      n	S U	S'   O[        R                  " [        S5      5      eU R                  [        U	5      S5        g )N)   b   branchr   r   )   Br   r   r      f   forceNr   r{   r&   r   r      updater   s   -Cr}      revert   -ir   r   s5   note: use --no-backup to avoid creating .orig files

r      --alls   a commit must be specifiedr   )indexrV   r>   r   r@   r   r   rR   r   r   r   r   r6   )r   r    r!   r"   r7   pathssepindexr8   revr#   bookcmds              r   checkoutr   ?  s   J E}::e$TQ,.)*IXbd3JD
Ct!W%%	1gQR5 
)
CxxCCJxxi E
xx	t9>+&CJJtxx	*+JJtAwk*GNN488I./-C	Ua
		!NOPi 88HCJJ

5	88HJJJsO	(		i Hkk!9:;;IIuSzE"r   c                f   / SQn[        XU5      u  p%[        S5      nUR                  S5      (       a  S US'   UR                  S5      (       a  S US'   OBUR                  S5      (       a  U R                  [	        S5      5        g UR                  U5        U R                  [        U5      S	5        g )
N)r      continueNr   r      abortNr   )   e   editNr   s   graftr   s   --editr   
   --continuer   s&   note: hg graft does not have --abort

r   r>   r@   r   r   r   rV   r6   r   s          r   
cherrypickr     s    J
 bd3JD
(
CxxIxx!M	(		
		!?@A

4IIuSzE"r   c                    / SQn[        XU5      u  p%[        S5      nUR                  S5      (       a  S US'   UR                  U5        U R	                  [        U5      S5        g )N))r   r   Nr   r   )   xr   Nr   s   purger   r   r   )r>   r@   r   rV   r   r6   r   s          r   cleanr     sW    J
 bd3JD
(
Cxx~~HJJtIIuSzE"r   c                j   / SQn[        XU5      u  p%[        U5      S:X  a  [        R                  " [	        S5      5      e[        S5      nUR                  US   5        [        U5      S:  a  UR                  US   5        UR                  S5      (       a   S US'   U R                  [	        S5      5        OUR                  S	5      (       a  S US'   UR                  S
5      (       a/  [        S5      nUR                  UR                  S
5      5        Xg-  nU R                  [        U5      S5        g )N))r      bareNr   )   ns   no-checkoutNr   r   r   s'   a repository to clone must be specified   cloner   r   s   -Usa   note: Mercurial does not have bare clones. -U will clone the repo without checking out a commit

s   no_checkoutr   r   r   )
r>   r   r   r   r   r@   rR   r   r   r6   )r   r    r!   r"   r7   r8   r#   cocmds           r   cloner     s   J
 bd3JD
4yA~kk!FGHH
(
CJJtAw
4y1}

47xxE

		L	
 
.	!	!E
xx		"TXXi()kIIuSzE"r   c                ^   / SQn[        XU5      u  p%[        S5      nUR                  S5      (       a  [        S5      nUR                  S5      (       a'  UR                  S5      (       a  [        S5      nOS US'   UR                  S5      (       a  UR                  S5      US	'   UR                  S
5      (       a  SUR                  S
5      4-  US'   UR                  S5      (       a  U R                  [	        S5      5        UR                  S5      (       a  UR                  S5      US'   UR                  S5      (       a  UR                  S5      US'   UR                  S5      (       a  UR                  S5      US'   UR                  U5        U R                  [        U5      S5        g )N)	   arz   Nr   )r      messager   r   r{   )   Cs   reuse-messager   r   )   F   filer   r   )r      authorr   r   )r      dater   r   )r      amendNr   )r   s   no-editNr      commitr}   r~   r   s   no_edits   --amends   reuse_messages   -Mr   s   '%s'r   rz   sq   note: Mercurial doesn't have a staging area, so there is no --all. -A will add and remove files for you though.

r      -lr   s   -ur      -dr   r   r   s          r   commitr     se   
J bd3JD
)
Cxx-.xx88J(#C"C
Oxx !!XX./E
xx
 466E
xx
		'	
 xxXXg&E
xx	XXi(E
xxXXg&E
JJtIIuSzE"r   c                8    U R                  [        S5      5        g )NsX   this command has been deprecated in the git project, thus isn't supported by this tool

)r2   r   r   s       r   
deprecatedr     s    GG	6	
r   c                   / SQn[        XU5      u  p%[        S5      nUR                  S5      (       a  U R                  [	        S5      5        UR                  S5      (       a  S US'   [        U5       H*  nUR                  U5         UR                  U5        XvS'   M,     U R                  [        U5      S5        g ! [         a    UR                  U5         Mh  f = f)	N)r   )r      cachedNr   )   R   reverseNr      diffr   sL   note: Mercurial has no concept of a staging area, so --cached does nothing

r   s	   --reverser   r   )r>   r@   r   r   r   r*   r0   revsr1   rR   r6   )r   r    r!   r"   r7   r8   r#   as           r   diffr     s    J
 bd3JD
'
Cxx	
		0	
 xx
 L$ZA	IIaLJ	  IIuSzE"  	JJqM	s   	B>>CCc                8    U R                  [        S5      5        g )Ns  Mercurial does not enable external difftool by default. You need to enable the extdiff extension in your .hgrc file by adding
extdiff =
to the [extensions] section and then running

hg extdiff -p <program>

See 'hg help extdiff' and 'hg help -e extdiff' for more information.
r   r   s       r   difftoolr   '  s    II		

r   c                V   SS/n[        XU5      u  p%[        S5      n[        U5      S:  ab  UR                  US   5        [        U5      S:  a?  U R	                  [        S5      5        USS   H  nXqR                  ;   a  XvS'   M  XvS'   M     U R	                  [        U5      S	5        g )
Nr   rz   Nr   r      pullr   r      note: Mercurial doesn't have refspecs. -r can be used to specify which commits you want to pull. -B can be used to specify which bookmark you want to pull.

r   r   r   r>   r@   r   rR   r   r   
_bookmarksr6   r   s           r   fetchr   5  s     #J bd3JD
'
C
4y1}

47t9q=II) !"X'!"J!"J	  IIuSzE"r   c                    / n[        XU5      u  p%[        S5      nUR                  U5        U R                  [	        U5      S5        g )N   grepr   )r>   r@   rV   r   r6   r   s          r   grepr   R  s?    Jbd3JD
'
C JJtIIuSzE"r   c                    / n[        XU5      u  p%[        S5      n[        U5      S:  a  UR                  US   5        U R	                  [        U5      S5        g )N   initr   r   r>   r@   r   rR   r   r6   r   s          r   initr   _  sL    Jbd3JD
'
C
4y1}

47IIuSzE"r   c                   / SQn[        XU5      u  p%UR                  S5      =(       d    UR                  S5      nU(       a-  [        S5      nXgS'   U R                  S[	        U5      -  5        g U R                  [        S5      5        U R                  [        S5      5        [        S	5      nS US
'   UR                  S5      (       a  UR                  S5      US'   UR                  S5      (       a  SUS'   UR                  S5      (       a  S US'   UR                  S5      (       a  S US'   UR                  S5      (       a  S US'   UR                  S5      (       d,  UR                  S5      (       d  UR                  S5      (       aW  UR                  SS5      nSU;   a   U R                  [        S5      5        SUS'   OU R                  [        S5      5        SUS'   [        U5      S:  a<  SUS   ;   a"  US   R                  S5      u  pS X4-  US!'   US	 UR                  U5        U R                  [	        U5      S"5        g )#N))r   s   followNr   )r   s   decorateNr   )r      numberr   r   )   1r   Nr   r      prettyr   r   )r      formatr   r   )r      onelineNr   )r      statNr   )r      graphNr   r{   )   Gs	   grep-diffr   r   )   Ss   pickaxe-regexr   r   s	   grep_diffs   pickaxe_regexr   s   --diffs   %s
se   note: -v prints the entire commit message like Git does. To print just the first line, drop the -v.

sF   note: see hg help revset for information on how to filter log output

   logs   -vr   r   r   r     --statr  s   -Gr}   r   r  r  r  r      format:sc   note: --format format:??? equates to Mercurial's --template. See hg help templates for more info.

s   ???s
   --templatesq   note: --pretty/format/oneline equate to Mercurial's --style or --template. See hg help templates for more info.

s   --styler   s   ..s   '%s::%s'r   r   )	r>   r   r@   r   r6   r   r   splitrV   )r   r    r!   r"   r7   r8   grep_patr#   formatsinceuntils              r   logr  k  s   J bd3JDxx%C2B)CHg!I
		'E#J&'II	;	
 II		
 &/CCJxx	XXi(E
xx~~E
xxIxxE
xxE
xx	dhhy11TXXj5I5I)S)IIL "(CII& %C
O
4y1}DG7==/LE$~5CJQ

4IIuSzE"r   c                   / SQn[        XU5      u  p%UR                  S5      (       dB  UR                  S5      (       d,  UR                  S5      (       d  UR                  S5      (       ax  [        S5      nUR                  S5      (       a  S US'   UR                  S5      (       a  S US'   UR                  S5      (       a  S US	'   UR                  S5      (       a  S US
'   O[        S5      nUR                  S5      (       a  U R                  [	        S5      5        UR                  S5      (       a  S US'   UR                  S5        U H  n[        R                  " U5      US'   M     U R                  [        U5      S5        g )N))   cr   Nr   )r      deletedNr   )r      modifiedNr   )   o   othersNr   )   i   ignoredNr   )   s   stageNr   )   z   _zeroNr   r  r  r  r     statusr   r   s   -or   s   filesr  s>   note: Mercurial doesn't have a staging area, ignoring --stage
r  s   -0r   s   -Ir   )	r>   r   r@   r   r   rR   r   
shellquoter6   )r   r    r!   r"   r7   r8   r#   includes           r   lsfilesr!    sL   J bd3JD 	88J88I88Ji 88JCJ88K  CJ88ICJ88JCJhxx
			
 xxE
JJt((1E
  IIuSzE"r   c                    / n[        XU5      u  p%[        S5      n[        U5      S:  a   UR                  U[        U5      S-
     5        U R	                  [        U5      S5        g )N   merger   r   r   r   r   s          r   merger$    sU    Jbd3JD
(
C
4y1}

4D	A&'IIuSzE"r   c                    / n[        XU5      u  p%[        U5      S:w  a  SS/n[        SUS   US   4-  5      nU R                  [	        S5      [	        S5      5        U R                  [        U5      S	5        g )
N   ry   r   s&   log -T '{node}\n' -r 'ancestor(%s,%s)'r   r   s1   note: ancestors() is part of the revset language
s3   (learn more about revsets with 'hg help revsets')

r   )r>   r   r@   r   r   r6   r   s          r   	mergebaser'    s|    Jbd3JD
4yA~d|
2d1gtAw5GGC II	
?@	
BC IIuSzE"r   c                    / n[        XU5      u  p%[        S5      n[        U5      S:X  a  S US'   UR                  U5        U R	                  [        U5      S5        g )Ns   resolver   r   r   )r>   r@   r   rV   r   r6   r   s          r   	mergetoolr)    sQ    Jbd3JD
*
C
4yA~HJJtIIuSzE"r   c                   SS/n[        XU5      u  p%[        S5      nUR                  U5        UR                  S5      (       a  S US'   UR                  S5      (       a  S US'   U R	                  [        U5      S5        g )	Nr   r   s   dry-runNr      mvr      -f   dry_run   -nr   r>   r@   rV   r   r   r6   r   s          r   mvr1    v    #%J bd3JD
%.CJJtxxE
xx
E
IIuSzE"r   c                `   / SQn[        XU5      u  p%[        S5      nS US'   [        U5      S:  ab  UR                  US   5        [        U5      S:  a?  U R	                  [        S5      5        USS   H  nXqR                  ;   a  XvS'   M  XvS'   M     U R	                  [        U5      S	5        g )
N)r   r   )   r   rebaseNr   r   s   --rebaser   r   r   r   r   r   r   r   s           r   pullr6  $  s    J
 bd3JD
'
CC
4y1}

47t9q=II) !"X'!"J!"J	  IIuSzE"r   c                   SS/n[        XU5      u  p%[        S5      n[        U5      S:  ab  UR                  US   5        [        U5      S:  a?  U R	                  [        S5      5        USS   H  nXqR                  ;   a  XvS'   M  XvS'   M     UR                  S	5      (       a  S US
'   U R	                  [        U5      S5        g )Nr   r      pushr   r   s   note: Mercurial doesn't have refspecs. -r can be used to specify which commits you want to push. -B can be used to specify which bookmark you want to push.

r   r   r   r-  r   )	r>   r@   r   rR   r   r   r   r   r6   r   s           r   pushr9  C  s     #J bd3JD
'
C
4y1}

47t9q=II- !"X'!"J!"J	  xxE
IIuSzE"r   c                d   / SQn[        XU5      u  p%UR                  S5      (       aj  U R                  [        S5      5        [	        S5      n[        U5      S:  a  U R                  [        S5      5        U R                  [        U5      S5        g UR                  S5      (       a&  [	        S	5      nU R                  [        U5      S5        [	        S
5      nUR                  S5      (       d  UR                  S5      (       a  S US'   UR                  S5      (       a  S US'   UR                  S5      (       a  U R                  [        S5      5        [        UR                  S5      5      US'   [        U5      S:  a  [        R                  " [        S5      5      eS[        US   5      [        US   5      4-  US'   OR[        U5      S:X  a  [        US   5      US'   O1[        U5      S:X  a"  [        US   5      US'   [        US   5      US'   U R                  [        U5      S5        g )N)r   )r     interactiveNr   )r      ontor   r   r   r   )r      skipNr   r;  sE   note: hg histedit does not perform a rebase. It just edits history.

s   histeditr   sc   also note: 'hg histedit' will automatically detect your stack, so no second argument is necessary

r   r=  s   revert --all -r .r5  r   r   r   s   --abortr<  sx   note: if you're trying to lift a commit off one branch, try hg rebase -d <destination commit> -s <commit to be lifted>

r   r&  s(   expected format: git rebase --onto X Y Zs   '::%s - ::%s'r   s   -ss   -b)
r>   r   r   r   r@   r   r6   r   r   r   r   s          r   rebaser>  c  s   J bd3JDxx
		.	
 k"t9q=IIK 			5:&xx*+
		5:&
)
Cxx 1 1!MxxJxx
			
 TXXg./E
t9q=++a KLMM%a)9747;K(LLE
t9> a)CJY!^ a)CJ a)CJIIuSzE"r   c                "   S/n[        XU5      u  p%[        S5      nUR                  S5      (       a  S US'   [        U5      S:  a  UR	                  US   5        U R                  [        U5      S5        U R                  [        S5      5        g )Nr   s   journalrz   r   r   s   

sH   note: in hg commits can be deleted from repo but we always have backups
)r>   r@   r   r   rR   r   r6   r   r   s          r   reflogr@    s     J bd3JD
*
CxxH
4y1}

47IIeCj'"II		
r   c                   / SQn[        XU5      u  p%[        [        U5      S:  a  US   OS5      nUR                  S5      nUR                  S5      (       a  U R	                  [        S5      5        UR                  S5      (       a  U R	                  [        S5      5        [        S	5      nU(       a  UR                  S
5        UR                  U5        U R	                  [        U5      S5        g )N))r      softNr   )r      hardNr   )r      mixedNr   r   r   rC  rD  sB   note: --mixed has no meaning since Mercurial has no staging area

rB  sA   note: --soft has no meaning since Mercurial has no staging area

r   s   --cleanr   )	r>   r   r   r   r   r   r@   rR   r6   )	r   r    r!   r"   r7   r8   r   hardr#   s	            r   resetrF    s    J
 bd3JDD	AT!W48F88GDxx
		$	
 xx
		$	
 )
C

:JJvIIuSzE"r   c                    / n[        XU5      u  p%[        U5      S:  a  U R                  [        S5      5        [	        S5      nU(       a  UR                  US   5        U R                  [        U5      S5        g )Nr   s;   note: hg backout doesn't support multiple commits at once

s   backoutr   r   )r>   r   r   r   r@   rR   r6   r   s          r   revertrH    sj    Jbd3JD
4y1}
			
 *
C

47IIuSzE"r   c                b   SS/n[        XU5      u  p%UR                  S5      (       d  UR                  S5      (       aW  [        S5      nUR                  S5      (       a  U R                  [	        S5      5        U R                  [        U5      S5        g U R                  [	        S5      5        g )	N)r   s	   show-cdupNr   )r   s   show-toplevelNr   s	   show_cdups   show_toplevels   roots1   note: hg root prints the root of the repository

r   s5   note: see hg help revset for how to refer to commits
)r>   r   r@   r   r   r6   r   s          r   revparserJ    s    &*J bd3JDxx*:!;!;g88L!!IIaNOP
		5:&
		!MNOr   c                   SS/n[        XU5      u  p%[        S5      nUR                  U5        UR                  S5      (       a  S US'   UR                  S5      (       a  S US'   U R	                  [        U5      S5        g )	Nr   r+     rmr   r-  r.  r/  r   r0  r   s          r   rmrM    r2  r   c                   SSSS[         S4/n[        XU5      u  p%UR                  S5      (       aT  UR                  S5      S:X  a  [        S	5      nS
US'   O[        S5      nUR	                  S5        UR	                  S5        O[        U5      S:  aj  [        XS   5      (       a  [        S5      nO[        S5      nUR                  U5        UR                  S5      (       a  UR	                  SUS   4-  5        OEUR                  S5      (       a$  [        S5      nUR	                  SUS   4-  5        O[        S5      nU R                  [        U5      S5        g )N)r   s   name-statusNr   r     Us   unifiedr   s   name_statusr  r  r  r   s   --changer	  s   --style statuss   -r .r   s   cats   exports   --config diff.unified=%dr   )
rK   r>   r   r@   rR   r   r   rV   r   r6   r   s          r   showrP    s3   ("	z3$J
 bd3JDxx88I*,)$C#C&/CJJ()JJw	TQ$Q  &/C)$C

488JJJ2d:6F5HHI	*		i 

.$z2B1DDEi IIuSzE"r   c                h   S/n[        XU5      u  p%[        S5      n[        U5      S:  a  US   OS nUS:X  a"  S US'   UR                  S5      (       a  S US'   GO=US:X  aE  UR                  S5      (       a  S US'   OS US	'   [        U5      S
:  a  UR	                  US
   5        OUS:X  a  S US'   OUS:X  a;  S US'   [        U5      S
:  a  UR	                  US
   5        OUR	                  S5        OUS:X  d  US:X  a:  [        S5      n[        U5      S
:  a  UR	                  US
   5        US:X  a  S US'   O_US:X  d  US:X  a  U R                  [        S5      5        g [        U5      S:  a)  US   S:w  a	  US   US'   O[        U5      S
:  a  US
   US'   U R                  [        U5      S5        g )Nr{   s   shelver      listr   r}   r      showr
  r   s   clears	   --cleanups   dropr   s   <shelve name>s   pop   applys   unshelves   --keepr   s   createsT   note: Mercurial doesn't have equivalents to the git stash branch or create actions

s   saves   --namer   )r>   r@   r   r   rR   r   r   r6   )r   r    r!   r"   r7   r8   r#   actions           r   stashrV  /  s   #J bd3JD
)
CD	AT!W4FE
88HCJ	7	88HCJ!C	Nt9q=JJtAw	8	 L	7	E
t9q=JJtAwJJ'(	6	Vx/k"t9q=JJtAwX!C	N	9	) 3
		:	
 	t9q=Aw'!!%aITQ!%aIIIuSzE"r   c                    S/n[        XU5      u  p%[        S5      nUR                  U5        UR                  S5      (       a  S US'   U R	                  [        U5      S5        g )N)r   r  Nr   r  r  r   r   r0  r   s          r   r   r   c  s\    $J bd3JD
)
CJJtxx
E
IIuSzE"r   c                    U(       d  [         R                  " [        S5      5      eUS   nU[        ;  a"  [         R                  " [        S5      U-  5      eUSS  n[        U   " X/UQ70 UD6$ )Ns   missing svn commandr   s   unknown git svn command "%s"r   )r   r   r   gitsvncommands)r   r    r!   r"   svncmds        r   svnr[  r  sj    kk!2344!WF^#kk!;<vEFF8D&!"<T<V<<r   c                l    / n[        XU5        [        S5      nU R                  [        U5      S5        g )Nr8  r   r   r   s         r   
svndcommitr]  }  s-    J&
'
CIIuSzE"r   c                    / n[        XU5        [        S5      nUR                  S5        U R                  [	        U5      S5        g )Nr      default-pushr   r>   r@   rR   r   r6   r   s         r   svnfetchra    s9    J&
'
CJJIIuSzE"r   c                    / n[        XU5      u  p%U(       d  [        R                  " [        S5      5      e[	        S5      nUS   US'   U R                  [        U5      S5        g )Ns   missing find-rev argumentr	  r   r   r   )r>   r   r   r   r@   r   r6   r   s          r   
svnfindrevrc    sU    Jbd3JDkk!89::
&/CaCJIIuSzE"r   c                    S/n[        XU5        [        S5      nUR                  S5        [        S5      nUR                  S5        XV-  nU R                  [	        U5      S5        g )N)   ls   localNr   r   r_  r5  s   tipr   r`  )r   r    r!   r"   r7   pullcmd	rebasecmdr#   s           r   	svnrebaserh    s`    #J &gGNN?#	"IV

CIIuSzE"r   c                   / SQn[        XU5      u  p%UR                  S5      (       a  [        S5      nO[        S5      nU(       d  [        R                  " [        S5      5      eUR                  US   5        [        U5      S:  a  US   US'   UR                  S	5      (       a  S US
'   UR                  S5      (       a  S US'   U R                  [        U5      S5        g )N)r   )re  rR  Nr   r   rR  s   tags   tags   missing tag argumentr   r   r   r   s   --remover   r-  r   )
r>   r   r@   r   r   r   rR   r   r   r6   r   s          r   tagrk    s    J
 bd3JDxxgfo++a 7899

47t9q=aCJ88I#C88HCJIIuSzE"r   r   s   amrT  s   bisects   blamer   s   checkouts   cherry-picks   cleanr   r   r   s   difftool   fetchr   r   r	  s   ls-filesr#  s
   merge-bases	   mergetoolr,  r   r8  r5  s   reflogs   resetr   s	   rev-parserL  rS  s   stashr  s   svn)rj  s   whatchanged)s   dcommitrl  s   find-revr5  )D__doc__
__future__r   r+   r   mercurial.i18nr   	mercurialr   r   r   r   r	   r
   mercurial.utilsr   
testedwithcmdtablecommandr   CATEGORY_HELPr$   r>   r@   r_   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r!  r$  r'  r)  r1  r6  r9  r>  r@  rF  rH  rJ  rM  rP  rV  r   r[  r]  ra  rc  rh  rk  r   rY  rl   r   r   <module>rv     s8  	 #  	   % #



H
% 	m&&77.'T&' &'R	' 	'#>!#"D#)#X:=#@#.#  #F2#j#@#:
#	#M#`*#Z	##$	##$#>#@;#|* #F#&P #$#B1#h#=##
## #:%
C%	2% e% v	%
 e% v% % J% e% e% v% T% % e% T%  T!%" C#%$ %%& e'%( 9)%* )+%, 
2-%. T/%0 T1%2 v3%4 v5%6 e7%8 v9%: (;%< 
2=%> T?%@ eA%B vC%D CE%F I%P 	r   