yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject yetus git commit: YETUS-423 Make sortorder and sorttype of type choices.
Date Thu, 14 Jul 2016 14:08:34 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 36210cdec -> 7dd10b24e


YETUS-423 Make sortorder and sorttype of type choices.

Signed-off-by: Allen Wittenauer <aw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/7dd10b24
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/7dd10b24
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/7dd10b24

Branch: refs/heads/master
Commit: 7dd10b24ed7d174a43ed358809b26433093d08e8
Parents: 36210cd
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Thu Jul 7 23:35:46 2016 +0530
Committer: Allen Wittenauer <aw@apache.org>
Committed: Thu Jul 14 07:08:25 2016 -0700

----------------------------------------------------------------------
 .../in-progress/releasedocmaker.md              |  2 +-
 release-doc-maker/releasedocmaker.py            | 24 ++++++++------------
 2 files changed, 11 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/7dd10b24/asf-site-src/source/documentation/in-progress/releasedocmaker.md
----------------------------------------------------------------------
diff --git a/asf-site-src/source/documentation/in-progress/releasedocmaker.md b/asf-site-src/source/documentation/in-progress/releasedocmaker.md
index 5e8e88f..c28ec1b 100644
--- a/asf-site-src/source/documentation/in-progress/releasedocmaker.md
+++ b/asf-site-src/source/documentation/in-progress/releasedocmaker.md
@@ -154,7 +154,7 @@ This will now sort by the issue id, listing them in lowest to highest
(or ascend
 The order may be reversed to list them in highest to lowest (or descending) order by providing
the appropriate flag:
 
 ```bash
-$ releasedocmaker --sorttype=issueid --sortorder=dec
+$ releasedocmaker --sorttype=issueid --sortorder=desc
 ```
 
 In the case of multiple projects given on the command line, the projects will be grouped
and then sorted by issue id.

http://git-wip-us.apache.org/repos/asf/yetus/blob/7dd10b24/release-doc-maker/releasedocmaker.py
----------------------------------------------------------------------
diff --git a/release-doc-maker/releasedocmaker.py b/release-doc-maker/releasedocmaker.py
index 824fcdf..c4e526f 100755
--- a/release-doc-maker/releasedocmaker.py
+++ b/release-doc-maker/releasedocmaker.py
@@ -301,22 +301,17 @@ class Jira(object):
             result = cmp(selfsplit[0], othersplit[0])
             if result == 0:
                 result = cmp(int(selfsplit[1]), int(othersplit[1]))
-                if result != 0:
-                    if SORTORDER == 'dec':
-                        if result == 1:
-                            result = -1
-                        else:
-                            result = 1
+                # dec is supported for backward compatibility
+                if SORTORDER in ['dec', 'desc']:
+                        result *= -1
+
         elif SORTTYPE == 'resolutiondate':
             dts = dateutil.parser.parse(self.fields['resolutiondate'])
             dto = dateutil.parser.parse(other.fields['resolutiondate'])
             result = cmp(dts, dto)
-            if result != 0:
-                if SORTORDER == 'newer':
-                    if result == 1:
-                        result = -1
-                    else:
-                        result = 1
+            if SORTORDER == 'newer':
+                    result *= -1
+
         return result
 
     def get_incompatible_change(self):
@@ -676,15 +671,16 @@ def parse_args():
     parser.add_option(
         "--sortorder",
         dest="sortorder",
-        type="string",
         metavar="TYPE",
         default=SORTORDER,
+        # dec is supported for backward compatibility
+        choices=["asc", "dec", "desc", "newer", "older"],
         help="Sorting order for sort type (default: %s)" % SORTORDER)
     parser.add_option("--sorttype",
                       dest="sorttype",
-                      type="string",
                       metavar="TYPE",
                       default=SORTTYPE,
+                      choices=["resolutiondate", "issueid"],
                       help="Sorting type for issues (default: %s)" % SORTTYPE)
     parser.add_option(
         "-t",


Mime
View raw message