tests/test-import.t
author Matt Harbison <matt_harbison@yahoo.com>
Sat, 09 Aug 2014 19:12:16 -0400
branchstable
changeset 1106 6b0cf1b73693
parent 1065 f355bbc124fc
child 1185 cc3e68120185
permissions -rw-r--r--
evolve: replace each obsolete sha1 in the description with its latest successor Obsolete csets are hidden by default and don't get pushed to the parent repo. In order to avoid broken references in commit messages, it makes sense to evolve those references to the latest and greatest successor, as each cset containing them is evolved. Of course, stale references can still occur if a commit in branch 'A' references something in branch 'B', and that something in 'B' is evolved but 'A' isn't subsequently evolved. This alleviates the user that is evolving a series of commits from having to 1) recognize that there is a hash that needs updating in any one of the series 2) look up the latest successor manually 3) hg amend -e The regular expression for matching and the logic for replacing are borrowed from the convert extension [1]. It might be nice for the output to state the reason that the reference couldn't be updated (it was pruned, split or diverged), but that may be excessive for something only displayed in verbose mode. (Maybe it should be a ui.status() instead?) [1] http://selenic.com/hg/rev/45562379ce4e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     1
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     2
This feature requires mercurial 3.0
984
b286f77d680c tests: fix grammar, spelling, punctuation in comments
Greg Ward <greg@gerg.ca>
parents: 951
diff changeset
     3
(and the `only()` revset is 3.0 specific)
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     4
951
e3f7258d05d5 test: fix test-import condition
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 930
diff changeset
     5
  $ (hg help revset | grep '"only(' > /dev/null) || exit 80
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     6
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     7
Test creation of obsolescence marker by path import
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     8
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     9
  $ hg init auto-obsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    10
  $ cd auto-obsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    11
  $ echo '[extensions]' >> $HGRCPATH
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    12
  $ echo 'rebase=' >> $HGRCPATH
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    13
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    14
  $ echo A > a
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    15
  $ hg commit -Am A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    16
  adding a
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    17
  $ echo B > b
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    18
  $ hg commit -Am B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    19
  adding b
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    20
  $ hg up '.^'
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    21
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    22
  $ echo C > c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    23
  $ hg commit -Am C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    24
  adding c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    25
  created new head
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    26
  $ hg log -G
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    27
  @  changeset:   2:eb8dd0f31b51
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    28
  |  tag:         tip
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    29
  |  parent:      0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    30
  |  user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    31
  |  date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    32
  |  summary:     C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    33
  |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    34
  | o  changeset:   1:95b760afef3c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    35
  |/   user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    36
  |    date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    37
  |    summary:     B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    38
  |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    39
  o  changeset:   0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    40
     user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    41
     date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    42
     summary:     A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    43
  
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    44
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    45
(actual test)
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    46
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    47
  $ hg export 'desc(B)' | hg import - --obsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    48
  applying patch from stdin
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    49
  $ hg log -G
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    50
  @  changeset:   3:00c49133f17e
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    51
  |  tag:         tip
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    52
  |  user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    53
  |  date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    54
  |  summary:     B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    55
  |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    56
  o  changeset:   2:eb8dd0f31b51
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    57
  |  parent:      0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    58
  |  user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    59
  |  date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    60
  |  summary:     C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    61
  |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    62
  o  changeset:   0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    63
     user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    64
     date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    65
     summary:     A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    66
  
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    67
  $ hg debugobsolete
1065
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 984
diff changeset
    68
  95b760afef3c234ffb3f9fd391edcb36e60921a4 00c49133f17e5e5a52b6ef1b6d516c0e90b56d8a 0 (*) {'user': 'test'} (glob)
930
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    69
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    70
  $ hg rollback
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    71
  repository tip rolled back to revision 2 (undo import)
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    72
  working directory now based on revision 2
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    73
  $ hg log -G
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    74
  @  changeset:   2:eb8dd0f31b51
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    75
  |  tag:         tip
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    76
  |  parent:      0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    77
  |  user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    78
  |  date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    79
  |  summary:     C
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    80
  |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    81
  | o  changeset:   1:95b760afef3c
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    82
  |/   user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    83
  |    date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    84
  |    summary:     B
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    85
  |
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    86
  o  changeset:   0:f2bbf19cf96d
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    87
     user:        test
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    88
     date:        Thu Jan 01 00:00:00 1970 +0000
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    89
     summary:     A
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    90
  
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    91
  $ hg debugobsolete
cac35bef8aee import: --obsolete flag for automatic obsolescence marker creation
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    92