Patchwork [2,of,6] test-lfs: drop trailing ', ' item separators from debug JSON output

login
register
mail settings
Submitter Matt Harbison
Date March 19, 2018, 4:08 a.m.
Message ID <acc9042d2a8b4c7a397a.1521432505@Envy>
Download mbox | patch
Permalink /patch/29601/
State Accepted
Headers show

Comments

Matt Harbison - March 19, 2018, 4:08 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1521084848 14400
#      Wed Mar 14 23:34:08 2018 -0400
# Node ID acc9042d2a8b4c7a397a14cd9d1003fcf00c29f3
# Parent  793636c45477f81af6fddacc458979fecc84ae3a
test-lfs: drop trailing ', ' item separators from debug JSON output

The trailing space looks weird when conditionalizing the line.  The commas
shouldn't be necessary because of the indenting.  The `lfs-test-server` isn't
sending all of the same items (notably, the "transfer" attribute is missing), so
having the commas means more lines need to be conditionalized.

Patch

diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -249,7 +249,8 @@  class _gitlfsremote(object):
                 response['objects'] = sorted(response['objects'],
                                              key=lambda p: p['oid'])
             self.ui.debug('%s\n'
-                          % json.dumps(response, indent=2, sort_keys=True))
+                          % json.dumps(response, indent=2,
+                                       separators=('', ': '), sort_keys=True))
 
         return response
 
diff --git a/tests/test-lfs-test-server.t b/tests/test-lfs-test-server.t
--- a/tests/test-lfs-test-server.t
+++ b/tests/test-lfs-test-server.t
@@ -63,14 +63,14 @@  store.
       {
         "actions": {
           "upload": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
           }
-        }, 
-        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b", 
+        }
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
         "size": 12
       }
     ]
@@ -133,14 +133,14 @@  Clear the cache to force a download
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
           }
-        }, 
-        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b", 
+        }
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
         "size": 12
       }
     ]
@@ -184,40 +184,40 @@  When the server has some blobs already
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
           }
-        }, 
-        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b", 
+        }
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
         "size": 12
-      }, 
+      }
       {
         "actions": {
           "upload": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
           }
-        }, 
-        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19", 
+        }
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
         "size": 20
-      }, 
+      }
       {
         "actions": {
           "upload": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
           }
-        }, 
-        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998", 
+        }
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
         "size": 19
       }
     ]
@@ -289,27 +289,27 @@  Clear the cache to force a download
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
           }
-        }, 
-        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19", 
+        }
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
         "size": 20
-      }, 
+      }
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
           }
-        }, 
-        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998", 
+        }
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
         "size": 19
       }
     ]
@@ -362,14 +362,14 @@  Test a corrupt file download, but clear 
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
           }
-        }, 
-        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998", 
+        }
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
         "size": 19
       }
     ]
@@ -416,14 +416,14 @@  Test a corrupted file upload
       {
         "actions": {
           "upload": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0"
           }
-        }, 
-        "oid": "e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0", 
+        }
+        "oid": "e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0"
         "size": 17
       }
     ]
@@ -447,40 +447,40 @@  Archive will prefetch blobs in a group
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
           }
-        }, 
-        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b", 
+        }
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
         "size": 12
-      }, 
+      }
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
           }
-        }, 
-        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19", 
+        }
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
         "size": 20
-      }, 
+      }
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
           }
-        }, 
-        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998", 
+        }
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
         "size": 19
       }
     ]
@@ -533,27 +533,27 @@  Cat will prefetch blobs in a group
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
           }
-        }, 
-        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b", 
+        }
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
         "size": 12
-      }, 
+      }
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
           }
-        }, 
-        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998", 
+        }
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
         "size": 19
       }
     ]
@@ -600,40 +600,40 @@  Revert will prefetch blobs in a group
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
           }
-        }, 
-        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b", 
+        }
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
         "size": 12
-      }, 
+      }
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
           }
-        }, 
-        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19", 
+        }
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
         "size": 20
-      }, 
+      }
       {
         "actions": {
           "download": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
           }
-        }, 
-        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998", 
+        }
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
         "size": 19
       }
     ]
@@ -687,14 +687,14 @@  Check error message when the remote miss
       {
         "actions": {
           "upload": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13"
           }
-        }, 
-        "oid": "8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13", 
+        }
+        "oid": "8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13"
         "size": 6
       }
     ]
@@ -754,14 +754,14 @@  Check error message when object does not
       {
         "actions": {
           "upload": {
-            "expires_at": "$ISO_8601_DATE_TIME$", 
+            "expires_at": "$ISO_8601_DATE_TIME$"
             "header": {
               "Accept": "application/vnd.git-lfs"
-            }, 
+            }
             "href": "http://localhost:$HGPORT/objects/bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a"
           }
-        }, 
-        "oid": "bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a", 
+        }
+        "oid": "bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a"
         "size": 6
       }
     ]