Fossil SCM
/json/finfo now sorts ASC when --after is specified.
Commit
5dcaeca7c1f146d642f40bd05f4fb854d9066c80
Parent
afe12e107737a2e…
1 file changed
+3
-1
+3
-1
| --- src/json_finfo.c | ||
| +++ src/json_finfo.c | ||
| @@ -36,10 +36,11 @@ | ||
| 36 | 36 | char const * zAfter = NULL; |
| 37 | 37 | char const * zBefore = NULL; |
| 38 | 38 | int limit = -1; |
| 39 | 39 | int currentRow = 0; |
| 40 | 40 | char const * zCheckin = NULL; |
| 41 | + char sort = -1; | |
| 41 | 42 | if(!g.perm.Read){ |
| 42 | 43 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| 43 | 44 | return NULL; |
| 44 | 45 | } |
| 45 | 46 | json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change."); |
| @@ -95,16 +96,17 @@ | ||
| 95 | 96 | blob_appendf(&sql, " AND ci.uuid='%q'", zU); |
| 96 | 97 | free(zU); |
| 97 | 98 | }else{ |
| 98 | 99 | if( zAfter && *zAfter ){ |
| 99 | 100 | blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zAfter); |
| 101 | + sort = 1; | |
| 100 | 102 | }else if( zBefore && *zBefore ){ |
| 101 | 103 | blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zBefore); |
| 102 | 104 | } |
| 103 | 105 | } |
| 104 | 106 | |
| 105 | - blob_appendf(&sql," ORDER BY event.mtime DESC /*sort*/"); | |
| 107 | + blob_appendf(&sql," ORDER BY event.mtime %s /*sort*/", (sort>0?"ASC":"DESC")); | |
| 106 | 108 | /*printf("SQL=\n%s\n",blob_str(&sql));*/ |
| 107 | 109 | db_prepare(&q, "%s", blob_str(&sql)/*extra %s to avoid double-expanding |
| 108 | 110 | SQL escapes*/); |
| 109 | 111 | blob_reset(&sql); |
| 110 | 112 | |
| 111 | 113 |
| --- src/json_finfo.c | |
| +++ src/json_finfo.c | |
| @@ -36,10 +36,11 @@ | |
| 36 | char const * zAfter = NULL; |
| 37 | char const * zBefore = NULL; |
| 38 | int limit = -1; |
| 39 | int currentRow = 0; |
| 40 | char const * zCheckin = NULL; |
| 41 | if(!g.perm.Read){ |
| 42 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| 43 | return NULL; |
| 44 | } |
| 45 | json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change."); |
| @@ -95,16 +96,17 @@ | |
| 95 | blob_appendf(&sql, " AND ci.uuid='%q'", zU); |
| 96 | free(zU); |
| 97 | }else{ |
| 98 | if( zAfter && *zAfter ){ |
| 99 | blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zAfter); |
| 100 | }else if( zBefore && *zBefore ){ |
| 101 | blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zBefore); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | blob_appendf(&sql," ORDER BY event.mtime DESC /*sort*/"); |
| 106 | /*printf("SQL=\n%s\n",blob_str(&sql));*/ |
| 107 | db_prepare(&q, "%s", blob_str(&sql)/*extra %s to avoid double-expanding |
| 108 | SQL escapes*/); |
| 109 | blob_reset(&sql); |
| 110 | |
| 111 |
| --- src/json_finfo.c | |
| +++ src/json_finfo.c | |
| @@ -36,10 +36,11 @@ | |
| 36 | char const * zAfter = NULL; |
| 37 | char const * zBefore = NULL; |
| 38 | int limit = -1; |
| 39 | int currentRow = 0; |
| 40 | char const * zCheckin = NULL; |
| 41 | char sort = -1; |
| 42 | if(!g.perm.Read){ |
| 43 | json_set_err(FSL_JSON_E_DENIED,"Requires 'o' privileges."); |
| 44 | return NULL; |
| 45 | } |
| 46 | json_warn( FSL_JSON_W_UNKNOWN, "Achtung: the output of the finfo command is up for change."); |
| @@ -95,16 +96,17 @@ | |
| 96 | blob_appendf(&sql, " AND ci.uuid='%q'", zU); |
| 97 | free(zU); |
| 98 | }else{ |
| 99 | if( zAfter && *zAfter ){ |
| 100 | blob_appendf(&sql, " AND event.mtime>=julianday('%q')", zAfter); |
| 101 | sort = 1; |
| 102 | }else if( zBefore && *zBefore ){ |
| 103 | blob_appendf(&sql, " AND event.mtime<=julianday('%q')", zBefore); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | blob_appendf(&sql," ORDER BY event.mtime %s /*sort*/", (sort>0?"ASC":"DESC")); |
| 108 | /*printf("SQL=\n%s\n",blob_str(&sql));*/ |
| 109 | db_prepare(&q, "%s", blob_str(&sql)/*extra %s to avoid double-expanding |
| 110 | SQL escapes*/); |
| 111 | blob_reset(&sql); |
| 112 | |
| 113 |