[PATCH 1 of 3] tests: add a substitution pattern for dates in HTTP headers and LFS payload

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 1 of 3] tests: add a substitution pattern for dates in HTTP headers and LFS payload

Matt Harbison-2
# HG changeset patch
# User Matt Harbison <[hidden email]>
# Date 1519503121 18000
#      Sat Feb 24 15:12:01 2018 -0500
# Node ID dade0442450d1f813ff5c90025603363210aa0f1
# Parent  6aeb076b1321c540db6419fc48c8a3a552fb596b
tests: add a substitution pattern for dates in HTTP headers and LFS payload

This will be useful when printing HTTP headers and JSON payload received from an
LFS server.  The RFC 1123 date masking has uses elsewhere too.

diff --git a/tests/common-pattern.py b/tests/common-pattern.py
--- a/tests/common-pattern.py
+++ b/tests/common-pattern.py
@@ -72,6 +72,14 @@ substitutions = [
     (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)',
      lambda m: br' - - [$LOGDATE$] "' + m.group(1)
     ),
+    # HTTP header dates- RFC 1123
+    (br'Date: [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT',
+     br'Date: $HTTP_DATE$'
+    ),
+    # LFS expiration value
+    (br'"expires_at": "\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"',
+     br'"expires_at": "$ISO_8601_DATE_TIME$"'
+    ),
     # Windows has an extra '/' in the following lines that get globbed away:
     #   pushing to file:/*/$TESTTMP/r2 (glob)
     #   comparing with file:/*/$TESTTMP/r2 (glob)
diff --git a/tests/test-http-bad-server.t b/tests/test-http-bad-server.t
--- a/tests/test-http-bad-server.t
+++ b/tests/test-http-bad-server.t
@@ -116,7 +116,7 @@ Failure on subsequent HTTP request on th
   readline(4? from -1) -> (2) \r\n (glob)
   write(36) -> HTTP/1.1 200 Script output follows\r\n
   write(23) -> Server: badhttpserver\r\n
-  write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37) -> Date: $HTTP_DATE$\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
   write(21) -> Content-Length: 417\r\n
   write(2) -> \r\n
@@ -157,7 +157,7 @@ Failure to read getbundle HTTP request
   readline(13? from -1) -> (2) \r\n (glob)
   write(36) -> HTTP/1.1 200 Script output follows\r\n
   write(23) -> Server: badhttpserver\r\n
-  write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37) -> Date: $HTTP_DATE$\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
   write(21) -> Content-Length: 417\r\n
   write(2) -> \r\n
@@ -179,7 +179,7 @@ Failure to read getbundle HTTP request
   readline(2? from -1) -> (2) \r\n (glob)
   write(36) -> HTTP/1.1 200 Script output follows\r\n
   write(23) -> Server: badhttpserver\r\n
-  write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37) -> Date: $HTTP_DATE$\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
   write(20) -> Content-Length: 42\r\n
   write(2) -> \r\n
@@ -214,7 +214,7 @@ Now do a variation using POST to send ar
   readline(14? from -1) -> (2) \r\n (glob)
   write(36) -> HTTP/1.1 200 Script output follows\r\n
   write(23) -> Server: badhttpserver\r\n
-  write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37) -> Date: $HTTP_DATE$\r\n
   write(41) -> Content-Type: application/mercurial-0.1\r\n
   write(21) -> Content-Length: 430\r\n
   write(2) -> \r\n
@@ -290,7 +290,7 @@ Server sends an incomplete capabilities
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (144) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (121) Server: badhttpserver\r\n
-  write(37 from 37) -> (84) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (84) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (43) Content-Type: application/mercurial-0.1\r\n
   write(21 from 21) -> (22) Content-Length: 417\r\n
   write(2 from 2) -> (20) \r\n
@@ -325,7 +325,7 @@ TODO this output is horrible
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (659) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (636) Server: badhttpserver\r\n
-  write(37 from 37) -> (599) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (599) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (558) Content-Type: application/mercurial-0.1\r\n
   write(21 from 21) -> (537) Content-Length: 417\r\n
   write(2 from 2) -> (535) \r\n
@@ -341,7 +341,7 @@ TODO this output is horrible
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (82) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (59) Server: badhttpserver\r\n
-  write(37 from 37) -> (22) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (22) Date: $HTTP_DATE$\r\n
   write(22 from 41) -> (0) Content-Type: applicat
   write limit reached; closing socket
   write(36) -> HTTP/1.1 500 Internal Server Error\r\n
@@ -373,7 +373,7 @@ TODO client spews a stack due to uncaugh
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (724) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (701) Server: badhttpserver\r\n
-  write(37 from 37) -> (664) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (664) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (623) Content-Type: application/mercurial-0.1\r\n
   write(21 from 21) -> (602) Content-Length: 417\r\n
   write(2 from 2) -> (600) \r\n
@@ -389,7 +389,7 @@ TODO client spews a stack due to uncaugh
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (147) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (124) Server: badhttpserver\r\n
-  write(37 from 37) -> (87) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (87) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (46) Content-Type: application/mercurial-0.1\r\n
   write(20 from 20) -> (26) Content-Length: 42\r\n
   write(2 from 2) -> (24) \r\n
@@ -425,7 +425,7 @@ TODO this output is terrible
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (871) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (848) Server: badhttpserver\r\n
-  write(37 from 37) -> (811) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (811) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (770) Content-Type: application/mercurial-0.1\r\n
   write(21 from 21) -> (749) Content-Length: 417\r\n
   write(2 from 2) -> (747) \r\n
@@ -441,7 +441,7 @@ TODO this output is terrible
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (294) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (271) Server: badhttpserver\r\n
-  write(37 from 37) -> (234) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (234) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (193) Content-Type: application/mercurial-0.1\r\n
   write(20 from 20) -> (173) Content-Length: 42\r\n
   write(2 from 2) -> (171) \r\n
@@ -457,7 +457,7 @@ TODO this output is terrible
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (93) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (70) Server: badhttpserver\r\n
-  write(37 from 37) -> (33) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (33) Date: $HTTP_DATE$\r\n
   write(33 from 41) -> (0) Content-Type: application/mercuri
   write limit reached; closing socket
   write(36) -> HTTP/1.1 500 Internal Server Error\r\n
@@ -486,7 +486,7 @@ Server sends empty HTTP body for getbund
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (909) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (886) Server: badhttpserver\r\n
-  write(37 from 37) -> (849) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (849) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (808) Content-Type: application/mercurial-0.1\r\n
   write(21 from 21) -> (787) Content-Length: 417\r\n
   write(2 from 2) -> (785) \r\n
@@ -502,7 +502,7 @@ Server sends empty HTTP body for getbund
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (332) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (309) Server: badhttpserver\r\n
-  write(37 from 37) -> (272) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (272) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (231) Content-Type: application/mercurial-0.1\r\n
   write(20 from 20) -> (211) Content-Length: 42\r\n
   write(2 from 2) -> (209) \r\n
@@ -518,7 +518,7 @@ Server sends empty HTTP body for getbund
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (131) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (108) Server: badhttpserver\r\n
-  write(37 from 37) -> (71) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (71) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (30) Content-Type: application/mercurial-0.2\r\n
   write(28 from 28) -> (2) Transfer-Encoding: chunked\r\n
   write(2 from 2) -> (0) \r\n
@@ -549,7 +549,7 @@ Server sends partial compression string
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (933) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (910) Server: badhttpserver\r\n
-  write(37 from 37) -> (873) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (873) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (832) Content-Type: application/mercurial-0.1\r\n
   write(21 from 21) -> (811) Content-Length: 417\r\n
   write(2 from 2) -> (809) \r\n
@@ -565,7 +565,7 @@ Server sends partial compression string
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (356) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (333) Server: badhttpserver\r\n
-  write(37 from 37) -> (296) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (296) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (255) Content-Type: application/mercurial-0.1\r\n
   write(20 from 20) -> (235) Content-Length: 42\r\n
   write(2 from 2) -> (233) \r\n
@@ -581,7 +581,7 @@ Server sends partial compression string
   readline(-1) -> (2) \r\n
   write(36 from 36) -> (155) HTTP/1.1 200 Script output follows\r\n
   write(23 from 23) -> (132) Server: badhttpserver\r\n
-  write(37 from 37) -> (95) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n
+  write(37 from 37) -> (95) Date: $HTTP_DATE$\r\n
   write(41 from 41) -> (54) Content-Type: application/mercurial-0.2\r\n
   write(28 from 28) -> (26) Transfer-Encoding: chunked\r\n
   write(2 from 2) -> (24) \r\n
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 2 of 3] test-lfs: dial up the debugging on commands that interact with the server

Matt Harbison-2
# HG changeset patch
# User Matt Harbison <[hidden email]>
# Date 1520908201 14400
#      Mon Mar 12 22:30:01 2018 -0400
# Node ID f28c282005085edb77f64612be503a7cd43ab994
# Parent  dade0442450d1f813ff5c90025603363210aa0f1
test-lfs: dial up the debugging on commands that interact with the server

This will be useful to let the client print out the HTTP headers and JSON in a
future patch, so we can compare native LFS serving against test-lfs-server
behavior.  There tends to be a lot of debug stuff that we don't care about here
in a push, so I was tempted to print this output with a [devel] config.  But
this will be useful for field debugging too, so just put up with the extra
output here.

It would have been nice to be able to set ui.debug once, but issue5815 prevents
that.

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
@@ -43,32 +43,66 @@ store.
 
   $ hg init ../repo2
   $ mv .hg/store/lfs .hg/store/lfs_
-  $ hg push ../repo2 -v
+  $ hg push ../repo2 --debug
+  http auth: user foo, password ***
   pushing to ../repo2
+  http auth: user foo, password ***
+  query 1; heads
   searching for changes
+  1 total queries in *s (glob)
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
+  lfs: computing set of blobs to upload
   lfs: uploading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
   lfs: uploaded 1 files (12 bytes)
   1 changesets found
-  uncompressed size of bundle content:
-       * (changelog) (glob)
-       * (manifests) (glob)
-       *  a (glob)
+  list of changesets:
+  99a7098854a3984a5c9eab0fc7a2906697b7cb5c
+  bundle2-output-bundle: "HG20", 4 parts total
+  bundle2-output-part: "replycaps" 191 bytes payload
+  bundle2-output-part: "check:heads" streamed payload
+  bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
+  bundle2-output-part: "phase-heads" 24 bytes payload
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "replycaps" supported
+  bundle2-input-part: total payload size 191
+  bundle2-input-part: "check:heads" supported
+  bundle2-input-part: total payload size 20
+  bundle2-input-part: "changegroup" (params: 1 mandatory) supported
   adding changesets
+  add changeset 99a7098854a3
   adding manifests
   adding file changes
+  adding a revisions
   added 1 changesets with 1 changes to 1 files
   calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
+  bundle2-input-part: total payload size 617
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
+  bundle2-input-bundle: 3 parts total
+  updating the branch cache
+  bundle2-output-bundle: "HG20", 1 parts total
+  bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
+  bundle2-input-bundle: no-transaction
+  bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
+  bundle2-input-bundle: 0 parts total
+  listing keys for "phases"
   $ mv .hg/store/lfs_ .hg/store/lfs
 
 Clear the cache to force a download
   $ rm -rf `hg config lfs.usercache`
   $ cd ../repo2
-  $ hg update tip -v
+  $ hg update tip --debug
+  http auth: user foo, password ***
   resolving manifests
+   branchmerge: False, force: False, partial: False
+   ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
+   a: remote created -> g
   getting a
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -79,9 +113,18 @@ When the server has some blobs already
   $ echo ANOTHER-LARGE-FILE > c
   $ echo ANOTHER-LARGE-FILE2 > d
   $ hg commit -m b-and-c -A b c d
-  $ hg push ../repo1 -v | grep -v '^  '
+  $ hg push ../repo1 --debug
+  http auth: user foo, password ***
   pushing to ../repo1
+  http auth: user foo, password ***
+  query 1; heads
   searching for changes
+  all remote heads known locally
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
+  listing keys for "bookmarks"
+  lfs: computing set of blobs to upload
   lfs: need to transfer 2 objects (39 bytes)
   lfs: uploading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
   lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
@@ -89,16 +132,49 @@ When the server has some blobs already
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   lfs: uploaded 2 files (39 bytes)
   1 changesets found
-  uncompressed size of bundle content:
+  list of changesets:
+  dfca2c9e2ef24996aa61ba2abd99277d884b3d63
+  bundle2-output-bundle: "HG20", 5 parts total
+  bundle2-output-part: "replycaps" 191 bytes payload
+  bundle2-output-part: "check:phases" 24 bytes payload
+  bundle2-output-part: "check:heads" streamed payload
+  bundle2-output-part: "changegroup" (params: 1 mandatory) streamed payload
+  bundle2-output-part: "phase-heads" 24 bytes payload
+  bundle2-input-bundle: with-transaction
+  bundle2-input-part: "replycaps" supported
+  bundle2-input-part: total payload size 191
+  bundle2-input-part: "check:phases" supported
+  bundle2-input-part: total payload size 24
+  bundle2-input-part: "check:heads" supported
+  bundle2-input-part: total payload size 20
+  bundle2-input-part: "changegroup" (params: 1 mandatory) supported
   adding changesets
+  add changeset dfca2c9e2ef2
   adding manifests
   adding file changes
+  adding b revisions
+  adding c revisions
+  adding d revisions
   added 1 changesets with 3 changes to 3 files
+  bundle2-input-part: total payload size 1315
+  bundle2-input-part: "phase-heads" supported
+  bundle2-input-part: total payload size 24
+  bundle2-input-bundle: 4 parts total
+  updating the branch cache
+  bundle2-output-bundle: "HG20", 1 parts total
+  bundle2-output-part: "reply:changegroup" (advisory) (params: 0 advisory) empty payload
+  bundle2-input-bundle: no-transaction
+  bundle2-input-part: "reply:changegroup" (advisory) (params: 0 advisory) supported
+  bundle2-input-bundle: 0 parts total
+  listing keys for "phases"
 
 Clear the cache to force a download
   $ rm -rf `hg config lfs.usercache`
-  $ hg --repo ../repo1 update tip -v
+  $ hg --repo ../repo1 update tip --debug
+  http auth: user foo, password ***
   resolving manifests
+   branchmerge: False, force: False, partial: False
+   ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
   lfs: need to transfer 2 objects (39 bytes)
   lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
   lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
@@ -106,10 +182,13 @@ Clear the cache to force a download
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
+   b: remote created -> g
   getting b
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
+   c: remote created -> g
   getting c
   lfs: found d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 in the local lfs store
+   d: remote created -> g
   getting d
   lfs: found 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 in the local lfs store
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -122,8 +201,11 @@ Test a corrupt file download, but clear
   $ rm ../repo1/.hg/store/lfs/objects/d1/1e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   $ rm ../repo1/*
 
-  $ hg --repo ../repo1 update -C tip -v
+  $ hg --repo ../repo1 update -C tip --debug
+  http auth: user foo, password ***
   resolving manifests
+   branchmerge: False, force: True, partial: False
+   ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
   abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   [255]
@@ -141,9 +223,18 @@ Test a corrupted file upload
   $ echo 'another lfs blob' > b
   $ hg ci -m 'another blob'
   $ echo 'damage' > .hg/store/lfs/objects/e6/59058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
-  $ hg push -v ../repo1
+  $ hg push --debug ../repo1
+  http auth: user foo, password ***
   pushing to ../repo1
+  http auth: user foo, password ***
+  query 1; heads
   searching for changes
+  all remote heads known locally
+  listing keys for "phases"
+  checking for updated bookmarks
+  listing keys for "bookmarks"
+  listing keys for "bookmarks"
+  lfs: computing set of blobs to upload
   lfs: uploading e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0 (17 bytes)
   abort: detected corrupt lfs object: e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
   (run hg verify)
@@ -152,7 +243,8 @@ Test a corrupted file upload
 Archive will prefetch blobs in a group
 
   $ rm -rf .hg/store/lfs `hg config lfs.usercache`
-  $ hg archive -vr 1 ../archive
+  $ hg archive --debug -r 1 ../archive
+  http auth: user foo, password ***
   lfs: need to transfer 3 objects (51 bytes)
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
@@ -178,7 +270,8 @@ Archive will prefetch blobs in a group
 Cat will prefetch blobs in a group
 
   $ rm -rf .hg/store/lfs `hg config lfs.usercache`
-  $ hg cat -vr 1 a b c
+  $ hg cat --debug -r 1 a b c
+  http auth: user foo, password ***
   lfs: need to transfer 2 objects (31 bytes)
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
@@ -198,7 +291,8 @@ Revert will prefetch blobs in a group
   $ rm -rf .hg/store/lfs
   $ rm -rf `hg config lfs.usercache`
   $ rm *
-  $ hg revert --all -r 1 -v
+  $ hg revert --all -r 1 --debug
+  http auth: user foo, password ***
   adding a
   reverting b
   reverting c
@@ -226,7 +320,11 @@ Check error message when the remote miss
   $ hg commit -m b b
   $ rm -rf .hg/store/lfs
   $ rm -rf `hg config lfs.usercache`
-  $ hg update -C '.^'
+  $ hg update -C '.^' --debug
+  http auth: user foo, password ***
+  resolving manifests
+   branchmerge: False, force: True, partial: False
+   ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
   abort: LFS server error. Remote object for "b" not found:(.*)! (re)
   [255]
 
@@ -265,8 +363,14 @@ Check error message when object does not
 #endif
 
   $ cd $TESTTMP
-  $ hg clone test test2
+  $ hg --debug clone test test2
+  http auth: user foo, password ***
+  linked 6 files
+  http auth: user foo, password ***
   updating to branch default
+  resolving manifests
+   branchmerge: False, force: False, partial: False
+   ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
   abort: LFS server error. Remote object for "a" not found:(.*)! (re)
   [255]
 
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 3 of 3] lfs: debug print HTTP headers and JSON payload received from the server

Matt Harbison-2
In reply to this post by Matt Harbison-2
# HG changeset patch
# User Matt Harbison <[hidden email]>
# Date 1520910527 14400
#      Mon Mar 12 23:08:47 2018 -0400
# Node ID d0b66408b224022fd96cb347ff3439e807812b21
# Parent  f28c282005085edb77f64612be503a7cd43ab994
lfs: debug print HTTP headers and JSON payload received from the server

This has been extremely valuable to show divergences between `hg serve` and
`lfs-test-server`.  Once the `hg serve` code lands, there will be a certain
amount of conditionalizing that needs to be done, because `lfs-test-server`
doesn't always follow its spec.

The $ISO_8601_DATE_TIME$ pattern masks the fact that `lfs-test-serve` is sending
out an expires_at value of "0001-01-01T00:00:00Z".  `hg serve` will (probably)
use current time + 10 minutes or similar.  The $HTTP_DATE$ is the current time.

diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py
--- a/hgext/lfs/blobstore.py
+++ b/hgext/lfs/blobstore.py
@@ -217,7 +217,8 @@ class _gitlfsremote(object):
         batchreq.add_header('Accept', 'application/vnd.git-lfs+json')
         batchreq.add_header('Content-Type', 'application/vnd.git-lfs+json')
         try:
-            rawjson = self.urlopener.open(batchreq).read()
+            rsp = self.urlopener.open(batchreq)
+            rawjson = rsp.read()
         except util.urlerr.httperror as ex:
             raise LfsRemoteError(_('LFS HTTP error: %s (action=%s)')
                                  % (ex, action))
@@ -226,6 +227,19 @@ class _gitlfsremote(object):
         except ValueError:
             raise LfsRemoteError(_('LFS server returns invalid JSON: %s')
                                  % rawjson)
+
+        if self.ui.debugflag:
+            self.ui.debug('Status: %d\n' % rsp.status)
+            # lfs-test-server and hg serve return headers in different order
+            self.ui.debug('%s\n'
+                          % '\n'.join(sorted(str(rsp.info()).splitlines())))
+
+            if 'objects' in response:
+                response['objects'] = sorted(response['objects'],
+                                             key=lambda p: p['oid'])
+            self.ui.debug('%s\n'
+                          % json.dumps(response, indent=2, sort_keys=True))
+
         return response
 
     def _checkforservererror(self, pointers, responses, action):
@@ -301,6 +315,13 @@ class _gitlfsremote(object):
         response = b''
         try:
             req = self.urlopener.open(request)
+
+            if self.ui.debugflag:
+                self.ui.debug('Status: %d\n' % req.status)
+                # lfs-test-server and hg serve return headers in different order
+                self.ui.debug('%s\n'
+                              % '\n'.join(sorted(str(req.info()).splitlines())))
+
             if action == 'download':
                 # If downloading blobs, store downloaded data to local blobstore
                 localstore.download(oid, req)
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
@@ -54,7 +54,32 @@ store.
   checking for updated bookmarks
   listing keys for "bookmarks"
   lfs: computing set of blobs to upload
+  Status: 200
+  Content-Length: 309
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "upload": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b">http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
+          }
+        },
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b",
+        "size": 12
+      }
+    ]
+  }
   lfs: uploading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  Status: 200
+  Content-Length: 0
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
   lfs: uploaded 1 files (12 bytes)
   1 changesets found
@@ -99,7 +124,32 @@ Clear the cache to force a download
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: 000000000000, local: 000000000000+, remote: 99a7098854a3
+  Status: 200
+  Content-Length: 311
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b">http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
+          }
+        },
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b",
+        "size": 12
+      }
+    ]
+  }
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  Status: 200
+  Content-Length: 12
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
    a: remote created -> g
@@ -125,10 +175,65 @@ When the server has some blobs already
   listing keys for "bookmarks"
   listing keys for "bookmarks"
   lfs: computing set of blobs to upload
+  Status: 200
+  Content-Length: 901
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b">http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
+          }
+        },
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b",
+        "size": 12
+      },
+      {
+        "actions": {
+          "upload": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19">http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
+          }
+        },
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19",
+        "size": 20
+      },
+      {
+        "actions": {
+          "upload": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998">http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
+          }
+        },
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998",
+        "size": 19
+      }
+    ]
+  }
   lfs: need to transfer 2 objects (39 bytes)
   lfs: uploading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
+  Status: 200
+  Content-Length: 0
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
   lfs: uploading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  Status: 200
+  Content-Length: 0
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   lfs: uploaded 2 files (39 bytes)
   1 changesets found
@@ -175,11 +280,53 @@ Clear the cache to force a download
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: 99a7098854a3, local: 99a7098854a3+, remote: dfca2c9e2ef2
+  Status: 200
+  Content-Length: 608
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19">http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
+          }
+        },
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19",
+        "size": 20
+      },
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998">http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
+          }
+        },
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998",
+        "size": 19
+      }
+    ]
+  }
   lfs: need to transfer 2 objects (39 bytes)
   lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
+  Status: 200
+  Content-Length: 20
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
   lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  Status: 200
+  Content-Length: 19
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
    b: remote created -> g
@@ -206,7 +353,32 @@ Test a corrupt file download, but clear
   resolving manifests
    branchmerge: False, force: True, partial: False
    ancestor: dfca2c9e2ef2+, local: dfca2c9e2ef2+, remote: dfca2c9e2ef2
+  Status: 200
+  Content-Length: 311
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998">http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
+          }
+        },
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998",
+        "size": 19
+      }
+    ]
+  }
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  Status: 200
+  Content-Length: 7
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   abort: corrupt remote lfs object: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   [255]
 
@@ -235,6 +407,27 @@ Test a corrupted file upload
   listing keys for "bookmarks"
   listing keys for "bookmarks"
   lfs: computing set of blobs to upload
+  Status: 200
+  Content-Length: 309
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "upload": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0">http://localhost:$HGPORT/objects/e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0"
+          }
+        },
+        "oid": "e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0",
+        "size": 17
+      }
+    ]
+  }
   lfs: uploading e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0 (17 bytes)
   abort: detected corrupt lfs object: e659058e26b07b39d2a9c7145b3f99b41f797b6621c8076600e9cb7ee88291f0
   (run hg verify)
@@ -245,14 +438,73 @@ Archive will prefetch blobs in a group
   $ rm -rf .hg/store/lfs `hg config lfs.usercache`
   $ hg archive --debug -r 1 ../archive
   http auth: user foo, password ***
+  Status: 200
+  Content-Length: 905
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b">http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
+          }
+        },
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b",
+        "size": 12
+      },
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19">http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
+          }
+        },
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19",
+        "size": 20
+      },
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998">http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
+          }
+        },
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998",
+        "size": 19
+      }
+    ]
+  }
   lfs: need to transfer 3 objects (51 bytes)
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  Status: 200
+  Content-Length: 12
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
   lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
+  Status: 200
+  Content-Length: 20
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
   lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  Status: 200
+  Content-Length: 19
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
@@ -272,11 +524,53 @@ Cat will prefetch blobs in a group
   $ rm -rf .hg/store/lfs `hg config lfs.usercache`
   $ hg cat --debug -r 1 a b c
   http auth: user foo, password ***
+  Status: 200
+  Content-Length: 608
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b">http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
+          }
+        },
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b",
+        "size": 12
+      },
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998">http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
+          }
+        },
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998",
+        "size": 19
+      }
+    ]
+  }
   lfs: need to transfer 2 objects (31 bytes)
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  Status: 200
+  Content-Length: 12
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  Status: 200
+  Content-Length: 19
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
@@ -297,14 +591,73 @@ Revert will prefetch blobs in a group
   reverting b
   reverting c
   reverting d
+  Status: 200
+  Content-Length: 905
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b">http://localhost:$HGPORT/objects/31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b"
+          }
+        },
+        "oid": "31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b",
+        "size": 12
+      },
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19">http://localhost:$HGPORT/objects/37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19"
+          }
+        },
+        "oid": "37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19",
+        "size": 20
+      },
+      {
+        "actions": {
+          "download": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998">http://localhost:$HGPORT/objects/d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998"
+          }
+        },
+        "oid": "d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998",
+        "size": 19
+      }
+    ]
+  }
   lfs: need to transfer 3 objects (51 bytes)
   lfs: downloading 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b (12 bytes)
+  Status: 200
+  Content-Length: 12
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b to the usercache
   lfs: processed: 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b
   lfs: downloading 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 (20 bytes)
+  Status: 200
+  Content-Length: 20
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19 to the usercache
   lfs: processed: 37a65ab78d5ecda767e8622c248b5dbff1e68b1678ab0e730d5eb8601ec8ad19
   lfs: downloading d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 (19 bytes)
+  Status: 200
+  Content-Length: 19
+  Content-Type: text/plain; charset=utf-8
+  Date: $HTTP_DATE$
   lfs: adding d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998 to the usercache
   lfs: processed: d11e1a642b60813aee592094109b406089b8dff4cb157157f753418ec7857998
   lfs: found 31cf46fbc4ecd458a0943c5b4881f1f5a6dd36c53d6167d5b69ac45149b38e5b in the local lfs store
@@ -325,6 +678,27 @@ Check error message when the remote miss
   resolving manifests
    branchmerge: False, force: True, partial: False
    ancestor: 62fdbaf221c6+, local: 62fdbaf221c6+, remote: ef0564edf47e
+  Status: 200
+  Content-Length: 308
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "upload": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13">http://localhost:$HGPORT/objects/8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13"
+          }
+        },
+        "oid": "8e6ea5f6c066b44a0efa43bcce86aea73f17e6e23f0663df0251e7524e140a13",
+        "size": 6
+      }
+    ]
+  }
   abort: LFS server error. Remote object for "b" not found:(.*)! (re)
   [255]
 
@@ -371,6 +745,27 @@ Check error message when object does not
   resolving manifests
    branchmerge: False, force: False, partial: False
    ancestor: 000000000000, local: 000000000000+, remote: d2a338f184a8
+  Status: 200
+  Content-Length: 308
+  Content-Type: application/vnd.git-lfs+json
+  Date: $HTTP_DATE$
+  {
+    "objects": [
+      {
+        "actions": {
+          "upload": {
+            "expires_at": "$ISO_8601_DATE_TIME$",
+            "header": {
+              "Accept": "application/vnd.git-lfs"
+            },
+            "href": "<a href="http://localhost:$HGPORT/objects/bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a">http://localhost:$HGPORT/objects/bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a"
+          }
+        },
+        "oid": "bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a",
+        "size": 6
+      }
+    ]
+  }
   abort: LFS server error. Remote object for "a" not found:(.*)! (re)
   [255]
 
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 3 of 3] lfs: debug print HTTP headers and JSON payload received from the server

Yuya Nishihara
On Tue, 13 Mar 2018 00:00:08 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <[hidden email]>
> # Date 1520910527 14400
> #      Mon Mar 12 23:08:47 2018 -0400
> # Node ID d0b66408b224022fd96cb347ff3439e807812b21
> # Parent  f28c282005085edb77f64612be503a7cd43ab994
> lfs: debug print HTTP headers and JSON payload received from the server

Seems fine, queued, thanks.

> +        if self.ui.debugflag:
> +            self.ui.debug('Status: %d\n' % rsp.status)
> +            # lfs-test-server and hg serve return headers in different order
> +            self.ui.debug('%s\n'
> +                          % '\n'.join(sorted(str(rsp.info()).splitlines())))
> +
> +            if 'objects' in response:
> +                response['objects'] = sorted(response['objects'],
> +                                             key=lambda p: p['oid'])
> +            self.ui.debug('%s\n'
> +                          % json.dumps(response, indent=2, sort_keys=True))

We'll need some hack for py3 because json is unicode.
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel