Andreas Sandberg has uploaded this change for review. ( https://gem5-review.googlesource.com/7461

Change subject: util: Add an option to specify paths in list_changes.py
......................................................................

util: Add an option to specify paths in list_changes.py

Add an option to restrict change lists to changes that touch one or
more subdirectories in the source tree.

Change-Id: Id4e34fe300fdc3657505e2e188c727e583bcf611
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-by: Sudhanshu Jha <[email protected]>
---
M util/maint/list_changes.py
1 file changed, 12 insertions(+), 8 deletions(-)



diff --git a/util/maint/list_changes.py b/util/maint/list_changes.py
index 78e4442..3d9be8d 100755
--- a/util/maint/list_changes.py
+++ b/util/maint/list_changes.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python2
 #
-# Copyright (c) 2017 ARM Limited
+# Copyright (c) 2017-2018 Arm Limited
 # All rights reserved
 #
 # The license below extends only to copyright in the software and shall
@@ -105,7 +105,7 @@
     def __str__(self):
         return "%s: %s" % (self.rev[0:8], self.log[0])

-def list_revs(branch, baseline=None):
+def list_revs(branch, baseline=None, paths=[]):
     """Get a generator that lists git revisions that exist in 'branch'. If
     the optional parameter 'baseline' is specified, the generator
     excludes commits that exist on that branch.
@@ -119,7 +119,9 @@
     else:
         query = str(branch)

-    changes = subprocess.check_output([ "git", "rev-list", query ])
+    changes = subprocess.check_output(
+        [ "git", "rev-list", query, '--'] + paths
+    )

     if changes == "":
         return
@@ -128,9 +130,9 @@
         assert rev != ""
         yield Commit(rev)

-def list_changes(upstream, feature):
-    feature_revs = tuple(list_revs(upstream, feature))
-    upstream_revs = tuple(list_revs(feature, upstream))
+def list_changes(upstream, feature, paths=[]):
+    feature_revs = tuple(list_revs(upstream, feature, paths=paths))
+    upstream_revs = tuple(list_revs(feature, upstream, paths=paths))

     feature_cids = dict([
(c.change_id, c) for c in feature_revs if c.change_id is not None ])
@@ -173,11 +175,13 @@
     parser.add_argument("--deep-search", action="store_true",
                         help="Use a deep search to find incorrectly " \
                         "rebased changes")
+    parser.add_argument("paths", metavar="PATH", type=str, nargs="*",
+                        help="Paths to list changes for")

     args = parser.parse_args()

     incoming, outgoing, common, upstream_unknown, feature_unknown = \
-        list_changes(args.upstream, args.feature)
+        list_changes(args.upstream, args.feature, paths=args.paths)

     if incoming:
         print "Incoming changes:"
@@ -210,7 +214,7 @@

     if args.deep_search:
         print "Incorrectly rebased changes:"
-        all_upstream_revs = list_revs(args.upstream)
+        all_upstream_revs = list_revs(args.upstream, paths=args.paths)
         all_upstream_cids = dict([
             (c.change_id, c) for c in all_upstream_revs \
             if c.change_id is not None ])

--
To view, visit https://gem5-review.googlesource.com/7461
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4e34fe300fdc3657505e2e188c727e583bcf611
Gerrit-Change-Number: 7461
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to