tests/test-glog-beautifygraph.t
changeset 39058 a271466cb53a
parent 39055 dcecf772756a
child 39707 5abc47d4ca6b
equal deleted inserted replaced
39057:850fe0b9c0c0 39058:a271466cb53a
    78   >   fi
    78   >   fi
    79   >   echo $rev > a
    79   >   echo $rev > a
    80   >   hg commit -Aqd "$rev 0" -m "($rev) $msg"
    80   >   hg commit -Aqd "$rev 0" -m "($rev) $msg"
    81   > }
    81   > }
    82 
    82 
    83   $ cat > printrevset.py <<EOF
       
    84   > from __future__ import absolute_import
       
    85   > from mercurial import (
       
    86   >   cmdutil,
       
    87   >   commands,
       
    88   >   extensions,
       
    89   >   logcmdutil,
       
    90   >   revsetlang,
       
    91   >   smartset,
       
    92   > )
       
    93   > 
       
    94   > from mercurial.utils import (
       
    95   >   stringutil,
       
    96   > )
       
    97   > 
       
    98   > def logrevset(repo, pats, opts):
       
    99   >     revs = logcmdutil._initialrevs(repo, opts)
       
   100   >     if not revs:
       
   101   >         return None
       
   102   >     match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, opts)
       
   103   >     return logcmdutil._makerevset(repo, match, pats, slowpath, opts)
       
   104   > 
       
   105   > def uisetup(ui):
       
   106   >     def printrevset(orig, repo, pats, opts):
       
   107   >         revs, filematcher = orig(repo, pats, opts)
       
   108   >         if opts.get(b'print_revset'):
       
   109   >             expr = logrevset(repo, pats, opts)
       
   110   >             if expr:
       
   111   >                 tree = revsetlang.parse(expr)
       
   112   >                 tree = revsetlang.analyze(tree)
       
   113   >             else:
       
   114   >                 tree = []
       
   115   >             ui = repo.ui
       
   116   >             ui.write(b'%s\n' % stringutil.pprint(opts.get(b'rev', [])))
       
   117   >             ui.write(revsetlang.prettyformat(tree) + b'\n')
       
   118   >             ui.write(stringutil.prettyrepr(revs) + b'\n')
       
   119   >             revs = smartset.baseset()  # display no revisions
       
   120   >         return revs, filematcher
       
   121   >     extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
       
   122   >     aliases, entry = cmdutil.findcmd(b'log', commands.table)
       
   123   >     entry[1].append((b'', b'print-revset', False,
       
   124   >                      b'print generated revset and exit (DEPRECATED)'))
       
   125   > EOF
       
   126 
       
   127   $ echo "[extensions]" >> $HGRCPATH
    83   $ echo "[extensions]" >> $HGRCPATH
   128   $ echo "printrevset=`pwd`/printrevset.py" >> $HGRCPATH
    84   $ echo "printrevset=$TESTDIR/printrevset.py" >> $HGRCPATH
   129   $ echo "beautifygraph=" >> $HGRCPATH
    85   $ echo "beautifygraph=" >> $HGRCPATH
   130 
    86 
   131 Set a default of narrow-text UTF-8.
    87 Set a default of narrow-text UTF-8.
   132 
    88 
   133   $ HGENCODING=UTF-8; export HGENCODING
    89   $ HGENCODING=UTF-8; export HGENCODING