pmezard / hgforest-crew

Branch of hg forest extension (http://hg.akoha.org/hgforest) working with hg crew repository

Clone this repository (size: 105.9 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/pmezard/hgforest-crew/
commit 97: 4b2c5c4ffeff
parent 91: 872a57531db6
parent 96: 43f2315ce536
branch: default
Merge with main Tested against 1.3.1
Patrick Mézard / pmezard
6 months ago

Changed (Δ1.8 KB):

raw changeset »

forest.py (55 lines added, 9 lines removed)

Up to file-list forest.py:

@@ -79,7 +79,7 @@ except AttributeError:
79
79
    findcmd.__doc__ = commands.findcmd.__doc__
80
80
for m in (error, cmdutil, commands):
81
81
    if hasattr(m, "UnknownCommand"):
82
        findcmd.UnknownCommand = m.UnknownCommand
82
        UnknownCommand = m.UnknownCommand
83
83
        break
84
84
try:
85
85
    # Assign the exceptions explicitely to avoid demandload issues
@@ -377,6 +377,8 @@ def die_on_numeric_revs(revs):
377
377
    """
378
378
    if revs is None:
379
379
        return
380
    if not hasattr(revs, '__iter__'):
381
        revs = [revs]
380
382
    for strrev in revs:
381
383
        try:
382
384
            intrev = int(strrev)
@@ -1244,6 +1246,48 @@ def status(ui, top, *pats, **opts):
1244
1246
                 prehooks=[lambda tree: check_mq(tree)])
1245
1247
1246
1248
1249
def tag(ui, top, name, revision=None, **opts):
1250
    """add a tag for the current or given revision in the working forest
1251
1252
    Name a particular revision using <name>.
1253
1254
    Tags are used to name particular revisions of the repository and are
1255
    very useful to compare different revision, to go back to significant
1256
    earlier versions or to mark branch points as releases, etc.
1257
1258
    If no revision is given, the parent of the working directory is used,
1259
    or tip if no revision is checked out.
1260
1261
    To facilitate version control, distribution, and merging of tags,
1262
    they are stored as a file named ".hgtags" which is managed
1263
    similarly to other project files and can be hand-edited if
1264
    necessary.  The file '.hg/localtags' is used for local tags (not
1265
    shared among repositories).
1266
    """
1267
    if revision is not None:
1268
        ui.warn(_("use of 'hg ftag NAME [REV]' is deprecated, "
1269
                  "please use 'hg ftag [-r REV] NAME' instead\n"))
1270
        if opts['rev']:
1271
            raise util.Abort(_("use only one form to specify the revision"))
1272
        opts['rev'] = revision
1273
    forest = Forest(top=top, snapfile=None,
1274
                    walkhg=walkhgenabled(ui, opts['walkhg']))
1275
1276
    def function(tree, ignore, opts):
1277
        try:
1278
            commands.tag(ui, tree.getrepo(ui), name, rev_=None, **opts)
1279
        except Exception, err:
1280
            ui.warn(_("skipped: %s\n") % err)
1281
            tree.repo.transaction().__del__()
1282
1283
    @Forest.Tree.skip
1284
    def check_mq(tree):
1285
        tree.die_on_mq(top.root)
1286
1287
    forest.apply(ui, function, None, opts,
1288
                 prehooks=[lambda tree: check_mq(tree)])
1289
1290
1247
1291
def trees(ui, top, **opts):
1248
1292
    """show the roots of the repositories
1249
1293
@@ -1288,9 +1332,9 @@ def update(ui, top, revision=None, **opt
1288
1332
                ui.warn(_("warning: %s\n") % err)
1289
1333
            else:
1290
1334
                raise err
1291
            snapfile = opts['snapfile']
1292
            opts['rev'] = revision
1293
    tip = opts['tip']
1335
    if snapfile is None:
1336
        snapfile = opts['snapfile']
1337
        opts['rev'] = revision
1294
1338
    forest = Forest(top=top, snapfile=snapfile,
1295
1339
                    walkhg=walkhgenabled(ui, opts['walkhg']))
1296
1340
@@ -1299,10 +1343,8 @@ def update(ui, top, revision=None, **opt
1299
1343
            rev = opts['rev'] or None
1300
1344
        else:
1301
1345
            rev = None
1302
        if type(rev) is str:
1303
            rev = rev
1304
        elif rev:
1305
            rev = rev[0]
1346
        if hasattr(rev, '__iter__'):
1347
            rev = rev[-1]
1306
1348
        try:
1307
1349
            if rev is not None:
1308
1350
                commands.update(ui, tree.getrepo(ui),
@@ -1377,6 +1419,10 @@ def uisetup(ui):
1377
1419
            (status,
1378
1420
             [walkhgopts] + cmd_options(ui, 'status'),
1379
1421
             _('hg fstatus [OPTION]... [FILE]...')),
1422
        "ftag":
1423
            (tag,
1424
             [walkhgopts] + cmd_options(ui, 'tag'),
1425
             _('hg ftag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')),
1380
1426
        "ftrees" :
1381
1427
            (trees,
1382
1428
             [('c', 'convert', False,
@@ -1404,7 +1450,7 @@ def uisetup(ui):
1404
1450
                                                  remove=('bundle',),
1405
1451
                                                  table=hgext.fetch.cmdtable),
1406
1452
                                    _('hg ffetch [OPTION]... [SOURCE]'))})
1407
    except findcmd.UnknownCommand:
1453
    except UnknownCommand:
1408
1454
        return
1409
1455
1410
1456
commands.norepo += " fclone fseed"