tests/test-amend.t
author Faheem Mitha <faheem@faheem.info>
Sat, 11 Oct 2014 02:27:21 +0530
changeset 1127 87625964c333
parent 1067 5d063fed9e3d
child 1140 b7d85cd8ec7b
permissions -rw-r--r--
debian: remove .PHONY line completely This does not work in the case of implicit pattern matching rules as used by dh. Consider this example from Geoffrey Thomas: $ ls -l total 16 -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 blue.c -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 green.c -rw-r--r-- 1 faheem faheem 35 Aug 16 20:26 Makefile -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 red.c $ cat Makefile %: %.c gcc -o $@ $< .PHONY: blue $ make red gcc -o red red.c $ make green gcc -o green green.c $ make blue make: Nothing to be done for blue'. The Make manual (http://www.gnu.org/software/make/manual/make.html#Phony-Targets) says Since it knows that phony targets do not name actual files that could be remade from other files, make skips the implicit rule search for phony targets (see Implicit Rules). Thanks to the good folks on #debian-mentors on OFTC for instruction and explanation in these matters.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH <<EOF
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     2
  > [extensions]
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     3
  > hgext.rebase=
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     4
  > hgext.graphlog=
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     5
  > EOF
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     6
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     7
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
     8
  $ glog() {
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
     9
  >   hg glog --template '{rev}@{branch}({phase}) {desc|firstline}\n' "$@"
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    10
  > }
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    11
630
722b52c75f02 compat: adapt to upstreaming of divergent logic
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 491
diff changeset
    12
  $ hg init repo --traceback
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    13
  $ cd repo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    14
  $ echo a > a
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    15
  $ hg ci -Am adda
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    16
  adding a
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    17
984
b286f77d680c tests: fix grammar, spelling, punctuation in comments
Greg Ward <greg@gerg.ca>
parents: 976
diff changeset
    18
Test that amend captures branches
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    19
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    20
  $ hg branch foo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    21
  marked working directory as branch foo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    22
  (branches are permanent and global, did you want a bookmark?)
974
5808aad40aca amend: in tests, do not rely on defaults -- always use explicit -d
Greg Ward <greg@gerg.ca>
parents: 742
diff changeset
    23
  $ hg amend -d '0 0'
441
d702f0d26c6a obsolete: remove debugsuccessors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 385
diff changeset
    24
  $ hg debugobsolete
1065
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 985
diff changeset
    25
  07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'user': 'test'} (glob)
1067
5d063fed9e3d evolve: yield to relevant markers handling in core
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1065
diff changeset
    26
  b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {07f4944404050f47db2e5c5071e0e84e7a27bba9} (*) {'user': 'test'} (glob)
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    27
  $ hg branch
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    28
  foo
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    29
  $ hg branches
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
    30
  foo                            2:6a022cbb61d5
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    31
  $ glog
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    32
  @  2@foo(draft) adda
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    33
  
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    34
Test no-op
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    35
974
5808aad40aca amend: in tests, do not rely on defaults -- always use explicit -d
Greg Ward <greg@gerg.ca>
parents: 742
diff changeset
    36
  $ hg amend -d '0 0'
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
    37
  nothing changed
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
    38
  [1]
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    39
  $ glog
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    40
  @  2@foo(draft) adda
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    41
  
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    42
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    43
Test forcing the message to the same value, no intermediate revision.
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    44
974
5808aad40aca amend: in tests, do not rely on defaults -- always use explicit -d
Greg Ward <greg@gerg.ca>
parents: 742
diff changeset
    45
  $ hg amend -d '0 0' -m 'adda'
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
    46
  nothing changed
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
    47
  [1]
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    48
  $ glog
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    49
  @  2@foo(draft) adda
263
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    50
  
de62daaf2054 amend: drop --branches, pick it from working directory
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    51
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    52
Test collapsing into an existing revision, no intermediate revision.
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    53
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    54
  $ echo a >> a
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    55
  $ hg ci -m changea
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    56
  $ echo a > a
445
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    57
  $ hg status
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    58
  M a
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    59
  $ hg pstatus
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    60
  $ hg diff
742
760d01a549a6 amend: use core mechanism for amend
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 699
diff changeset
    61
  diff -r f7a50201fe3a a
445
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    62
  --- a/a	Thu Jan 01 00:00:00 1970 +0000
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    63
  +++ b/a	* +0000 (glob)
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    64
  @@ -1,2 +1,1 @@
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    65
   a
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    66
  -a
52b5e14c63d5 obsolete: enforce pdiff and pstatus alias in the extension
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 444
diff changeset
    67
  $ hg pdiff
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    68
  $ hg ci -m reseta
441
d702f0d26c6a obsolete: remove debugsuccessors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 385
diff changeset
    69
  $ hg debugobsolete
1065
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 985
diff changeset
    70
  07f4944404050f47db2e5c5071e0e84e7a27bba9 6a022cbb61d5ba0f03f98ff2d36319dfea1034ae 0 (*) {'user': 'test'} (glob)
1067
5d063fed9e3d evolve: yield to relevant markers handling in core
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1065
diff changeset
    71
  b2e32ffb533cbe1d5759638c0cd4e8abc43b2738 0 {07f4944404050f47db2e5c5071e0e84e7a27bba9} (*) {'user': 'test'} (glob)
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    72
  $ hg phase 2
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    73
  2: draft
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    74
  $ glog
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    75
  @  4@foo(draft) reseta
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    76
  |
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    77
  o  3@foo(draft) changea
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    78
  |
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    79
  o  2@foo(draft) adda
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    80
  
975
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
    81
Specify precise commit date with -d
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
    82
  $ hg amend -d '2001-02-03 04:05:06 +0700'
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
    83
  $ hg parents --template '{rev}  {date|date}\n'
09d6036ad596 amend: explicitly test -d option
Greg Ward <greg@gerg.ca>
parents: 974
diff changeset
    84
  5  Sat Feb 03 04:05:06 2001 +0700
265
24943df310d4 amend: do not traceback on no-ops
Patrick Mezard <patrick@mezard.eu>
parents: 263
diff changeset
    85
976
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    86
Specify "now" as commit date with -D
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    87
  $ before=`date +%s`
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    88
  $ hg amend -D
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    89
  $ commit=`hg parents --template '{date|hgdate} rev{rev}\n'`
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    90
  $ after=`date +%s`
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    91
  $ (echo $before ; echo $commit; echo $after) | sort -k1 -n -s
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    92
  \d+ (re)
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    93
  \d+ 0 rev6 (re)
bed842762447 amend: add -D/--current-date option, just like mq's qrefresh has
Greg Ward <greg@gerg.ca>
parents: 975
diff changeset
    94
  \d+ (re)
985
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
    95
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
    96
Specify current user as committer with -U
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
    97
  $ HGUSER=newbie hg amend -U
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
    98
  $ hg parents --template '{rev}  {author}\n'
6a37044ec0b3 amend: add -U/--current-user option (inspired by mq)
Greg Ward <greg@gerg.ca>
parents: 984
diff changeset
    99
  7  newbie