diff mercurial/revset.py @ 17913:03e552aaae67

bundle: add revset expression to show bundle contents (issue3487) bundle() revset expression returns all changes that are present in the bundle file (no matter whether they are in the repo or not). Bundle file should be specified via -R option.
author Tomasz Kleczek <tkleczek@fb.com>
date Wed, 31 Oct 2012 16:23:23 -0700
parents d8905e2c1301
children 49c85541617b
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Oct 24 23:09:31 2012 +0200
+++ b/mercurial/revset.py	Wed Oct 31 16:23:23 2012 -0700
@@ -442,6 +442,19 @@
     bumped = obsmod.getrevs(repo, 'bumped')
     return [r for r in subset if r in bumped]
 
+def bundle(repo, subset, x):
+    """``bundle()``
+    Changesets in the bundle.
+
+    Bundle must be specified by the -R option."""
+
+    try:
+        bundlenodes = repo.changelog.bundlenodes
+    except AttributeError:
+        raise util.Abort(_("no bundle provided - specify with -R"))
+    revs = set(repo[n].rev() for n in bundlenodes)
+    return [r for r in subset if r in revs]
+
 def checkstatus(repo, subset, pat, field):
     m = None
     s = []
@@ -1513,6 +1526,7 @@
     "branch": branch,
     "branchpoint": branchpoint,
     "bumped": bumped,
+    "bundle": bundle,
     "children": children,
     "closed": closed,
     "contains": contains,