tests/test-amend.t
branchmercurial-4.3
changeset 3818 f8677cb11dcb
parent 3715 a77fb9669e99
equal deleted inserted replaced
3817:5ca297e78f2c 3818:f8677cb11dcb
    17 
    17 
    18   $ hg branch foo
    18   $ hg branch foo
    19   marked working directory as branch foo
    19   marked working directory as branch foo
    20   (branches are permanent and global, did you want a bookmark?)
    20   (branches are permanent and global, did you want a bookmark?)
    21   $ hg amend -d '0 0' -n "this a note on the obsmarker and supported for hg>=4.4"
    21   $ hg amend -d '0 0' -n "this a note on the obsmarker and supported for hg>=4.4"
       
    22   current hg version does not support storing note in obsmarker
    22   $ hg debugobsolete
    23   $ hg debugobsolete
    23   07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
    24   07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
       
    25   b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {07f4944404050f47db2e5c5071e0e84e7a27bba9} (*) {'ef1': '*', 'user': 'test'} (glob)
       
    26 
    24   $ hg obslog
    27   $ hg obslog
    25   @  6a022cbb61d5 (1) adda
    28   @  6a022cbb61d5 (2) adda
    26   |
    29   |
    27   x  07f494440405 (0) adda
    30   x  07f494440405 (0) adda
    28        rewritten(branch) as 6a022cbb61d5 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
    31        rewritten(branch) as 6a022cbb61d5 by test (Thu Jan 01 00:00:00 1970 +0000)
    29          note: this a note on the obsmarker and supported for hg>=4.4
       
    30   
    32   
    31   $ hg branch
    33   $ hg branch
    32   foo
    34   foo
    33   $ hg branches
    35   $ hg branches
    34   foo                            1:6a022cbb61d5
    36   foo                            2:6a022cbb61d5
    35   $ glog
    37   $ glog
    36   @  1@foo(draft) adda
    38   @  2@foo(draft) adda
    37   
    39   
    38 Test no-op
    40 Test no-op
    39 
    41 
    40   $ hg amend -d '0 0'
    42   $ hg amend -d '0 0'
    41   nothing changed
    43   nothing changed
    42   [1]
    44   [1]
    43   $ glog
    45   $ glog
    44   @  1@foo(draft) adda
    46   @  2@foo(draft) adda
    45   
    47   
    46 
    48 
    47 Test forcing the message to the same value, no intermediate revision.
    49 Test forcing the message to the same value, no intermediate revision.
    48 
    50 
    49   $ hg amend -d '0 0' -m 'adda'
    51   $ hg amend -d '0 0' -m 'adda'
    50   nothing changed
    52   nothing changed
    51   [1]
    53   [1]
    52   $ glog
    54   $ glog
    53   @  1@foo(draft) adda
    55   @  2@foo(draft) adda
    54   
    56   
    55 
    57 
    56 Test collapsing into an existing revision, no intermediate revision.
    58 Test collapsing into an existing revision, no intermediate revision.
    57 
    59 
    58   $ echo a >> a
    60   $ echo a >> a
    70   -a
    72   -a
    71   $ hg pdiff
    73   $ hg pdiff
    72   $ hg ci -m reseta
    74   $ hg ci -m reseta
    73   $ hg debugobsolete
    75   $ hg debugobsolete
    74   07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
    76   07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'ef1': '*', 'user': 'test'} (glob)
       
    77   b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {07f4944404050f47db2e5c5071e0e84e7a27bba9} (*) {'ef1': '*', 'user': 'test'} (glob)
    75   $ hg phase 2
    78   $ hg phase 2
    76   2: draft
    79   2: draft
    77   $ glog
    80   $ glog
    78   @  3@foo(draft) reseta
    81   @  4@foo(draft) reseta
    79   |
    82   |
    80   o  2@foo(draft) changea
    83   o  3@foo(draft) changea
    81   |
    84   |
    82   o  1@foo(draft) adda
    85   o  2@foo(draft) adda
    83   
    86   
    84 Specify precise commit date with -d
    87 Specify precise commit date with -d
    85   $ hg amend -d '2001-02-03 04:05:06 +0700'
    88   $ hg amend -d '2001-02-03 04:05:06 +0700'
    86   $ hg parents --template '{rev}  {date|date}\n'
    89   $ hg parents --template '{rev}  {date|date}\n'
    87   4  Sat Feb 03 04:05:06 2001 +0700
    90   5  Sat Feb 03 04:05:06 2001 +0700
    88 
    91 
    89 Specify "now" as commit date with -D
    92 Specify "now" as commit date with -D
    90   $ before=`date +%s`
    93   $ before=`date +%s`
    91   $ hg amend -D
    94   $ hg amend -D
    92   $ commit=`hg parents --template '{date|hgdate} rev{rev}\n'`
    95   $ commit=`hg parents --template '{date|hgdate} rev{rev}\n'`
    93   $ after=`date +%s`
    96   $ after=`date +%s`
    94   $ (echo $before ; echo $commit; echo $after) | sort -k1 -n -s
    97   $ (echo $before ; echo $commit; echo $after) | sort -k1 -n -s
    95   \d+ (re)
    98   \d+ (re)
    96   \d+ 0 rev5 (re)
    99   \d+ 0 rev6 (re)
    97   \d+ (re)
   100   \d+ (re)
    98 
   101 
    99 Specify current user as committer with -U
   102 Specify current user as committer with -U
   100   $ HGUSER=newbie hg amend -U
   103   $ HGUSER=newbie hg amend -U
   101   $ hg parents --template '{rev}  {author}\n'
   104   $ hg parents --template '{rev}  {author}\n'
   102   6  newbie
   105   7  newbie
   103 
   106 
   104 Check that --logfile works
   107 Check that --logfile works
   105   $ echo "logfile message" > logfile.txt
   108   $ echo "logfile message" > logfile.txt
   106   $ hg amend -l logfile.txt
   109   $ hg amend -l logfile.txt
   107   $ hg log -r . -T "{desc}\n"
   110   $ hg log -r . -T "{desc}\n"
   112   $ hg amend -e --config ui.username= -m "empty user"
   115   $ hg amend -e --config ui.username= -m "empty user"
   113   abort: no username supplied
   116   abort: no username supplied
   114   (use 'hg config --edit' to set your username)
   117   (use 'hg config --edit' to set your username)
   115   [255]
   118   [255]
   116   $ hg sum
   119   $ hg sum
   117   parent: 7:* tip (glob)
   120   parent: 8:* tip (glob)
   118    logfile message
   121    logfile message
   119   branch: foo
   122   branch: foo
   120   commit: 1 unknown (clean)
   123   commit: 1 unknown (clean)
   121   update: (current)
   124   update: (current)
   122   phases: 3 draft
   125   phases: 3 draft