tests/test-py3-commands.t
branchstable
changeset 40404 956ec6f1320d
parent 40131 535fc8a22365
parent 40403 bf249bb60087
child 40405 4185bc53d1e3
equal deleted inserted replaced
40131:535fc8a22365 40404:956ec6f1320d
     1 #require py3exe
       
     2 
       
     3 This test helps in keeping a track on which commands we can run on
       
     4 Python 3 and see what kind of errors are coming up.
       
     5 The full traceback is hidden to have a stable output.
       
     6   $ HGBIN=`which hg`
       
     7 
       
     8   $ for cmd in version debuginstall ; do
       
     9   >   echo $cmd
       
    10   >   $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
       
    11   > done
       
    12   version
       
    13   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       
    14   debuginstall
       
    15   no problems detected
       
    16 
       
    17 #if test-repo
       
    18 Make a clone so that any features in the developer's .hg/hgrc that
       
    19 might confuse Python 3 don't break this test. When we can do commit in
       
    20 Python 3, we'll stop doing this. We use e76ed1e480ef for the clone
       
    21 because it has different files than 273ce12ad8f1, so we can test both
       
    22 `files` from dirstate and `files` loaded from a specific revision.
       
    23 
       
    24   $ hg clone -r e76ed1e480ef "`dirname "$TESTDIR"`" testrepo 2>&1 | tail -1
       
    25   15 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    26 
       
    27 Test using -R, which exercises some URL code:
       
    28   $ $PYTHON3 $HGBIN -R testrepo files -r 273ce12ad8f1 | tail -1
       
    29   testrepo/tkmerge
       
    30 
       
    31 Now prove `hg files` is reading the whole manifest. We have to grep
       
    32 out some potential warnings that come from hgrc as yet.
       
    33   $ cd testrepo
       
    34   $ $PYTHON3 $HGBIN files -r 273ce12ad8f1
       
    35   .hgignore
       
    36   PKG-INFO
       
    37   README
       
    38   hg
       
    39   mercurial/__init__.py
       
    40   mercurial/byterange.py
       
    41   mercurial/fancyopts.py
       
    42   mercurial/hg.py
       
    43   mercurial/mdiff.py
       
    44   mercurial/revlog.py
       
    45   mercurial/transaction.py
       
    46   notes.txt
       
    47   setup.py
       
    48   tkmerge
       
    49 
       
    50   $ $PYTHON3 $HGBIN files -r 273ce12ad8f1 | wc -l
       
    51   \s*14 (re)
       
    52   $ $PYTHON3 $HGBIN files | wc -l
       
    53   \s*15 (re)
       
    54 
       
    55 Test if log-like commands work:
       
    56 
       
    57   $ $PYTHON3 $HGBIN tip
       
    58   changeset:   10:e76ed1e480ef
       
    59   tag:         tip
       
    60   user:        oxymoron@cinder.waste.org
       
    61   date:        Tue May 03 23:37:43 2005 -0800
       
    62   summary:     Fix linking of changeset revs when merging
       
    63   
       
    64 
       
    65   $ $PYTHON3 $HGBIN log -r0
       
    66   changeset:   0:9117c6561b0b
       
    67   user:        mpm@selenic.com
       
    68   date:        Tue May 03 13:16:10 2005 -0800
       
    69   summary:     Add back links from file revisions to changeset revisions
       
    70   
       
    71 
       
    72   $ cd ..
       
    73 #endif
       
    74 
       
    75 Test if `hg config` works:
       
    76 
       
    77   $ $PYTHON3 $HGBIN config
       
    78   devel.all-warnings=true
       
    79   devel.default-date=0 0
       
    80   largefiles.usercache=$TESTTMP/.cache/largefiles
       
    81   ui.slash=True
       
    82   ui.interactive=False
       
    83   ui.mergemarkers=detailed
       
    84   ui.promptecho=True
       
    85   web.address=localhost
       
    86   web.ipv6=False
       
    87 
       
    88   $ cat > included-hgrc <<EOF
       
    89   > [extensions]
       
    90   > babar = imaginary_elephant
       
    91   > EOF
       
    92   $ cat >> $HGRCPATH <<EOF
       
    93   > %include $TESTTMP/included-hgrc
       
    94   > EOF
       
    95   $ $PYTHON3 $HGBIN version | tail -1
       
    96   *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob)
       
    97   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       
    98 
       
    99   $ rm included-hgrc
       
   100   $ touch included-hgrc
       
   101 
       
   102 Test bytes-ness of policy.policy with HGMODULEPOLICY
       
   103 
       
   104   $ HGMODULEPOLICY=py
       
   105   $ export HGMODULEPOLICY
       
   106   $ $PYTHON3 `which hg` debuginstall 2>&1 2>&1 | tail -1
       
   107   no problems detected
       
   108 
       
   109 `hg init` can create empty repos
       
   110 `hg status works fine`
       
   111 `hg summary` also works!
       
   112 
       
   113   $ $PYTHON3 `which hg` init py3repo
       
   114   $ cd py3repo
       
   115   $ echo "This is the file 'iota'." > iota
       
   116   $ $PYTHON3 $HGBIN status
       
   117   ? iota
       
   118   $ $PYTHON3 $HGBIN add iota
       
   119   $ $PYTHON3 $HGBIN status
       
   120   A iota
       
   121   $ hg diff --nodates --git
       
   122   diff --git a/iota b/iota
       
   123   new file mode 100644
       
   124   --- /dev/null
       
   125   +++ b/iota
       
   126   @@ -0,0 +1,1 @@
       
   127   +This is the file 'iota'.
       
   128   $ $PYTHON3 $HGBIN commit --message 'commit performed in Python 3'
       
   129   $ $PYTHON3 $HGBIN status
       
   130 
       
   131   $ mkdir A
       
   132   $ echo "This is the file 'mu'." > A/mu
       
   133   $ $PYTHON3 $HGBIN addremove
       
   134   adding A/mu
       
   135   $ $PYTHON3 $HGBIN status
       
   136   A A/mu
       
   137   $ HGEDITOR='echo message > ' $PYTHON3 $HGBIN commit
       
   138   $ $PYTHON3 $HGBIN status
       
   139   $ $PYHON3 $HGBIN summary
       
   140   parent: 1:e1e9167203d4 tip
       
   141    message
       
   142   branch: default
       
   143   commit: (clean)
       
   144   update: (current)
       
   145   phases: 2 draft
       
   146 
       
   147 Test weird unicode-vs-bytes stuff
       
   148 
       
   149   $ $PYTHON3 $HGBIN help | egrep -v '^ |^$'
       
   150   Mercurial Distributed SCM
       
   151   list of commands:
       
   152   additional help topics:
       
   153   (use 'hg help -v' to show built-in aliases and global options)
       
   154 
       
   155   $ $PYTHON3 $HGBIN help help | egrep -v '^ |^$'
       
   156   hg help [-ecks] [TOPIC]
       
   157   show help for a given topic or a help overview
       
   158   options ([+] can be repeated):
       
   159   (some details hidden, use --verbose to show complete help)
       
   160 
       
   161   $ $PYTHON3 $HGBIN help -k notopic
       
   162   abort: no matches
       
   163   (try 'hg help' for a list of topics)
       
   164   [255]
       
   165 
       
   166 Prove the repo is valid using the Python 2 `hg`:
       
   167   $ hg verify
       
   168   checking changesets
       
   169   checking manifests
       
   170   crosschecking files in changesets and manifests
       
   171   checking files
       
   172   2 files, 2 changesets, 2 total revisions
       
   173   $ hg log
       
   174   changeset:   1:e1e9167203d4
       
   175   tag:         tip
       
   176   user:        test
       
   177   date:        Thu Jan 01 00:00:00 1970 +0000
       
   178   summary:     message
       
   179   
       
   180   changeset:   0:71c96e924262
       
   181   user:        test
       
   182   date:        Thu Jan 01 00:00:00 1970 +0000
       
   183   summary:     commit performed in Python 3
       
   184   
       
   185 
       
   186   $ $PYTHON3 $HGBIN log -G
       
   187   @  changeset:   1:e1e9167203d4
       
   188   |  tag:         tip
       
   189   |  user:        test
       
   190   |  date:        Thu Jan 01 00:00:00 1970 +0000
       
   191   |  summary:     message
       
   192   |
       
   193   o  changeset:   0:71c96e924262
       
   194      user:        test
       
   195      date:        Thu Jan 01 00:00:00 1970 +0000
       
   196      summary:     commit performed in Python 3
       
   197   
       
   198   $ $PYTHON3 $HGBIN log -Tjson
       
   199   [
       
   200    {
       
   201     "bookmarks": [],
       
   202     "branch": "default",
       
   203     "date": [0, 0],
       
   204     "desc": "message",
       
   205     "node": "e1e9167203d450ca2f558af628955b5f5afd4489",
       
   206     "parents": ["71c96e924262969ff0d8d3d695b0f75412ccc3d8"],
       
   207     "phase": "draft",
       
   208     "rev": 1,
       
   209     "tags": ["tip"],
       
   210     "user": "test"
       
   211    },
       
   212    {
       
   213     "bookmarks": [],
       
   214     "branch": "default",
       
   215     "date": [0, 0],
       
   216     "desc": "commit performed in Python 3",
       
   217     "node": "71c96e924262969ff0d8d3d695b0f75412ccc3d8",
       
   218     "parents": ["0000000000000000000000000000000000000000"],
       
   219     "phase": "draft",
       
   220     "rev": 0,
       
   221     "tags": [],
       
   222     "user": "test"
       
   223    }
       
   224   ]
       
   225 
       
   226 Show that update works now!
       
   227 
       
   228   $ $PYTHON3 $HGBIN up 0
       
   229   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   230   $ $PYTHON3 $HGBIN identify
       
   231   71c96e924262
       
   232 
       
   233 branches and bookmarks also works!
       
   234 
       
   235   $ $PYTHON3 $HGBIN branches
       
   236   default                        1:e1e9167203d4
       
   237   $ $PYTHON3 $HGBIN bookmark book
       
   238   $ $PYTHON3 $HGBIN bookmarks
       
   239    * book                      0:71c96e924262