Changeset 57816


Ignore:
Timestamp:
Sep 17, 2009, 4:23:04 AM (8 years ago)
Author:
blb@…
Message:

devel/hg-forest - update to 20090409 version, switch to python26 group to match mercurial port

Location:
trunk/dports/devel/hg-forest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/devel/hg-forest/Portfile

    r57375 r57816  
    22
    33PortSystem          1.0
    4 PortGroup           python25 1.0
     4PortGroup           python26 1.0
    55name                hg-forest
    6 version             20090203
     6version             20090409
    77categories          devel mercurial
    88maintainers         blb openmaintainer
  • trunk/dports/devel/hg-forest/files/forest.py

    r49248 r57816  
    5656import shutil
    5757
    58 from mercurial import cmdutil, commands, error, hg, hgweb, node, util
     58from mercurial import cmdutil, commands, hg, hgweb, node, util
    5959from mercurial import localrepo, sshrepo, sshserver, httprepo, statichttprepo
    6060from mercurial.i18n import gettext as _
     61
     62# Import exceptions with backwards compatibility
     63try:
     64    from mercurial.error import RepoError, UnknownCommand
     65except ImportError:
     66    from mercurial.repo import RepoError
     67    try:
     68        from mercurial.cmdutil import UnknownCommand
     69    except ImportError:
     70        from mercurial.commands import UnknownCommand
    6171
    6272# For backwards compatibility, we need the following function definition.
     
    7888    findcmd.findcmd = commands.findcmd
    7989    findcmd.__doc__ = commands.findcmd.__doc__
    80 for m in (error, cmdutil, commands):
    81     if hasattr(m, "UnknownCommand"):
    82         findcmd.UnknownCommand = m.UnknownCommand
    83         break
    84 try:
    85     # Assign the exceptions explicitely to avoid demandload issues
    86     import mercurial.repo
    87     import mercurial.cmdutil
    88     RepoError = mercurial.repo.RepoError
    89     ParseError = mercurial.dispatch.ParseError
    90 except AttributeError:
    91     import mercurial.error
    92     RepoError = mercurial.error.RepoError
    93     ParseError = mercurial.error.ParseError
    9490
    9591# For backwards compatibility, find the parseurl() function that splits
     
    378374    if revs is None:
    379375        return
     376    if not hasattr(revs, '__iter__'):
     377        revs = [revs]
    380378    for strrev in revs:
    381379        try:
     
    11331131    snapfile = snapshot or opts['snapfile']
    11341132    if not snapfile:
    1135         raise ParseError("fseed", _("invalid arguments"))
     1133        raise cmdutil.ParseError("fseed", _("invalid arguments"))
    11361134    forest = Forest(snapfile=snapfile)
    11371135    tip = opts['tip']
     
    12451243
    12461244
     1245def tag(ui, top, name, revision=None, **opts):
     1246    """add a tag for the current or given revision in the working forest
     1247
     1248    Name a particular revision using <name>.
     1249
     1250    Tags are used to name particular revisions of the repository and are
     1251    very useful to compare different revision, to go back to significant
     1252    earlier versions or to mark branch points as releases, etc.
     1253
     1254    If no revision is given, the parent of the working directory is used,
     1255    or tip if no revision is checked out.
     1256
     1257    To facilitate version control, distribution, and merging of tags,
     1258    they are stored as a file named ".hgtags" which is managed
     1259    similarly to other project files and can be hand-edited if
     1260    necessary.  The file '.hg/localtags' is used for local tags (not
     1261    shared among repositories).
     1262    """
     1263    if revision is not None:
     1264        ui.warn(_("use of 'hg ftag NAME [REV]' is deprecated, "
     1265                  "please use 'hg ftag [-r REV] NAME' instead\n"))
     1266        if opts['rev']:
     1267            raise util.Abort(_("use only one form to specify the revision"))
     1268        opts['rev'] = revision
     1269    forest = Forest(top=top, snapfile=None,
     1270                    walkhg=walkhgenabled(ui, opts['walkhg']))
     1271
     1272    def function(tree, ignore, opts):
     1273        try:
     1274            commands.tag(ui, tree.getrepo(ui), name, rev_=None, **opts)
     1275        except Exception, err:
     1276            ui.warn(_("skipped: %s\n") % err)
     1277            tree.repo.transaction().__del__()
     1278
     1279    @Forest.Tree.skip
     1280    def check_mq(tree):
     1281        tree.die_on_mq(top.root)
     1282
     1283    forest.apply(ui, function, None, opts,
     1284                 prehooks=[lambda tree: check_mq(tree)])
     1285
     1286
    12471287def trees(ui, top, **opts):
    12481288    """show the roots of the repositories
     
    12891329            else:
    12901330                raise err
    1291             snapfile = opts['snapfile']
    1292             opts['rev'] = revision
    1293     tip = opts['tip']
     1331    if snapfile is None:
     1332        snapfile = opts['snapfile']
     1333        opts['rev'] = revision
    12941334    forest = Forest(top=top, snapfile=snapfile,
    12951335                    walkhg=walkhgenabled(ui, opts['walkhg']))
     
    13001340        else:
    13011341            rev = None
    1302         if type(rev) is str:
    1303             rev = rev
    1304         elif rev:
    1305             rev = rev[0]
     1342        if hasattr(rev, '__iter__'):
     1343            rev = rev[-1]
    13061344        try:
    13071345            if rev is not None:
     
    13781416             [walkhgopts] + cmd_options(ui, 'status'),
    13791417             _('hg fstatus [OPTION]... [FILE]...')),
     1418        "ftag":
     1419            (tag,
     1420             [walkhgopts] + cmd_options(ui, 'tag'),
     1421             _('hg ftag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')),
    13801422        "ftrees" :
    13811423            (trees,
     
    14051447                                                  table=hgext.fetch.cmdtable),
    14061448                                    _('hg ffetch [OPTION]... [SOURCE]'))})
    1407     except findcmd.UnknownCommand:
     1449    except UnknownCommand:
    14081450        return
    14091451
Note: See TracChangeset for help on using the changeset viewer.