Patrick Mézard avatar Patrick Mézard committed 4b2c5c4 Merge

Merge with main

Tested against 1.3.1

Comments (0)

Files changed (3)

     findcmd.__doc__ = commands.findcmd.__doc__
 for m in (error, cmdutil, commands):
     if hasattr(m, "UnknownCommand"):
-        findcmd.UnknownCommand = m.UnknownCommand
+        UnknownCommand = m.UnknownCommand
     # Assign the exceptions explicitely to avoid demandload issues
     if revs is None:
+    if not hasattr(revs, '__iter__'):
+        revs = [revs]
     for strrev in revs:
             intrev = int(strrev)
                  prehooks=[lambda tree: check_mq(tree)])
+def tag(ui, top, name, revision=None, **opts):
+    """add a tag for the current or given revision in the working forest
+    Name a particular revision using <name>.
+    Tags are used to name particular revisions of the repository and are
+    very useful to compare different revision, to go back to significant
+    earlier versions or to mark branch points as releases, etc.
+    If no revision is given, the parent of the working directory is used,
+    or tip if no revision is checked out.
+    To facilitate version control, distribution, and merging of tags,
+    they are stored as a file named ".hgtags" which is managed
+    similarly to other project files and can be hand-edited if
+    necessary.  The file '.hg/localtags' is used for local tags (not
+    shared among repositories).
+    """
+    if revision is not None:
+        ui.warn(_("use of 'hg ftag NAME [REV]' is deprecated, "
+                  "please use 'hg ftag [-r REV] NAME' instead\n"))
+        if opts['rev']:
+            raise util.Abort(_("use only one form to specify the revision"))
+        opts['rev'] = revision
+    forest = Forest(top=top, snapfile=None,
+                    walkhg=walkhgenabled(ui, opts['walkhg']))
+    def function(tree, ignore, opts):
+        try:
+            commands.tag(ui, tree.getrepo(ui), name, rev_=None, **opts)
+        except Exception, err:
+            ui.warn(_("skipped: %s\n") % err)
+            tree.repo.transaction().__del__()
+    @Forest.Tree.skip
+    def check_mq(tree):
+        tree.die_on_mq(top.root)
+    forest.apply(ui, function, None, opts,
+                 prehooks=[lambda tree: check_mq(tree)])
 def trees(ui, top, **opts):
     """show the roots of the repositories
                 ui.warn(_("warning: %s\n") % err)
                 raise err
-            snapfile = opts['snapfile']
-            opts['rev'] = revision
-    tip = opts['tip']
+    if snapfile is None:
+        snapfile = opts['snapfile']
+        opts['rev'] = revision
     forest = Forest(top=top, snapfile=snapfile,
                     walkhg=walkhgenabled(ui, opts['walkhg']))
             rev = opts['rev'] or None
             rev = None
-        if type(rev) is str:
-            rev = rev
-        elif rev:
-            rev = rev[0]
+        if hasattr(rev, '__iter__'):
+            rev = rev[-1]
             if rev is not None:
                 commands.update(ui, tree.getrepo(ui),
              [walkhgopts] + cmd_options(ui, 'status'),
              _('hg fstatus [OPTION]... [FILE]...')),
+        "ftag":
+            (tag,
+             [walkhgopts] + cmd_options(ui, 'tag'),
+             _('hg ftag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')),
         "ftrees" :
              [('c', 'convert', False,
                                     _('hg ffetch [OPTION]... [SOURCE]'))})
-    except findcmd.UnknownCommand:
+    except UnknownCommand:
 commands.norepo += " fclone fseed"
     sed -e 's/--- top-snap1.*$/--- top-snap1/' \
         -e 's/+++ top-snap2.*$/+++ top-snap2/'
+echo "# ftag"
+hg fclone toplevel newtop > /dev/null
+hg ftag -R newtop fred
+hg ftag -R newtop barney
+hg ftag -R newtop -r fred wilma
+hg tags --cwd newtop | sed -e 's/:.*//'
+hg tags --cwd newtop/d/d/t | sed -e 's/:.*//'
+rm -rf newtop
 echo "# fupdate"
 hg fclone toplevel newtop > /dev/null
 hg fupdate -R newtop top-snap
 echo "# fseed"
 hg clone toplevel newtop
-hg fseed -R newtop top-snap default
+hg fseed top-snap default
 rm -rf newtop
 hg fseed --traceback --root newtop top-snap default >/dev/null
 hg fsnap --cwd newtop --compatible | fixpath
 -revision = 5d60830890a20c050332e222b8307bbb70940a3f
 +revision = e7ef7301b2ddca4eca0c4e80fe0cc8c943d05645
+# ftag
+tip                                4
+barney                             2
+wilma                              1
+fred                               1
+tip                                3
+barney                             1
+wilma                              0
+fred                               0
 # fupdate
 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 skipped: 't/t' has mq patches applied
-skipped: branch default not found
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 # walk **/.hg
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.