aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-23 17:32:33 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-25 13:38:11 +0300
commit5f85dd75c096b57a085737a8164099cb1ef19181 (patch)
tree43f0e2f264f8e66ff01a5b370dac8f9588085a1e
parent7e7dee76c870917866fd23f385211ee8101705b4 (diff)
Always print reference submit result manifest value if present
-rw-r--r--bdep/publish.cxx29
-rw-r--r--tests/publish.test5
2 files changed, 21 insertions, 13 deletions
diff --git a/bdep/publish.cxx b/bdep/publish.cxx
index 00fc003..22c7ab7 100644
--- a/bdep/publish.cxx
+++ b/bdep/publish.cxx
@@ -585,20 +585,26 @@ namespace bdep
message = move (v);
- // Get the reference if the submission succeeded.
+ // Try to get an optional reference and make sure it is present if
+ // the submission succeeded.
//
- if (c == 200)
+ nv = p.next ();
+
+ if (n == "reference")
{
- nv = p.next ();
- if (n != "reference" || v.empty ())
- bad_value ("no reference specified");
+ if (v.empty ())
+ bad_value ("empty reference specified");
reference = move (v);
+
+ nv = p.next ();
}
+ else if (c == 200)
+ bad_value ("no reference specified");
// Skip the remaining name/value pairs.
//
- for (nv = p.next (); !nv.empty (); nv = p.next ()) ;
+ for (; !nv.empty (); nv = p.next ()) ;
status = c;
}
@@ -656,8 +662,6 @@ namespace bdep
if (reference)
dr << info << "reference: " << *reference;
- else
- dr << info << "checksum: " << checksum;
}
finish (o.curl (), pr, io);
@@ -666,11 +670,14 @@ namespace bdep
// Print the submission failure reason and fail.
//
- if (!reference)
+ if (!status || *status != 200)
{
diag_record dr (fail);
dr << message;
+ if (reference)
+ dr << info << "reference: " << *reference;
+
if (location)
dr << info << "new repository location: " << *location;
@@ -682,7 +689,9 @@ namespace bdep
dr << info << "try again later";
}
- return make_pair (move (*reference), message);
+ assert (reference); // Should be present if the submission succeeded.
+
+ return make_pair (move (*reference), move (message));
}
static int
diff --git a/tests/publish.test b/tests/publish.test
index 61f7a60..63faf9c 100644
--- a/tests/publish.test
+++ b/tests/publish.test
@@ -61,7 +61,7 @@ windows = ($cxx.target.class == 'windows')
upgrade prj/1.0.1
submitting prj-1.0.1.tar.gz
%.*
- %prj/1\.0\.1 submission is queued \(.{12}\)%
+ %(prj/1\.0\.1 )?submission is queued \(.{12}\)%
EOE
}
@@ -186,6 +186,7 @@ windows = ($cxx.target.class == 'windows')
submitting prj-1.0.5.tar.gz
%.*
error: duplicate submission
+ % info: reference: .{12}%?
EOE
}
@@ -205,7 +206,6 @@ windows = ($cxx.target.class == 'windows')
%.*
error: submission handling failed
% info: consider reporting this to .+ repository maintainers%
- % info: checksum: .{64}%
EOE
}
@@ -225,7 +225,6 @@ windows = ($cxx.target.class == 'windows')
%.*
error: HTTP status code 500 (internal server error)
% info: consider reporting this to .+ repository maintainers%
- % info: checksum: .{64}%
EOE
}
}