Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running against a new server without a typemap/stream spec will cause errors on trying to set up either. #1

Closed
brettbates opened this issue May 24, 2024 · 2 comments

Comments

@brettbates
Copy link

The 'p4 streams' and 'p4 typemap' specs don't get populated correctly by the fetch_* commands if they are empty.

Apologies for not just giving you PR, I don't have permission from employer; but you can use .get("TypeMap", []) etc instead of ["TypeMap"] and all is fine. Thanks for the tool, it looks very promising.

jase-perf added a commit to jase-perf/p4templates that referenced this issue May 24, 2024
perforce#1
Added test for when typemap is empty
update get_typemap to return empty list if no typemap, rather than throwing exception.
@jase-perf
Copy link
Contributor

Thanks Brett!
I just submitted a PR #2 to fix the fetch_typemap issue and update the tests.
From testing it, I don't think fetch_stream has the same issue, because that command returns an empty streamspec if the stream doesn't already exist. Or, if the path is malformed or the depot doesn't exist, it will throw an exception, which I would imagine is the desired behavior.

Let me know if there's something I've missed and that fetch_stream can return an empty dict. Otherwise hopefully this gets merged and we can close the issue!

@brettbates
Copy link
Author

Thanks Jase,

For fetch streams, I conflated a very similar issue with iterate_streams(), which usually just runs 'p4 streams' and creates an iterator. In the case that 'p4 streams' is empty, you get an exception for the warning 'No such stream.'. Needs a try/except P4.P4Exception

existing_stream_names = {_["Stream"] for _ in server.iterate_streams()}

https://github.com/perforce/p4templates/blob/main/kernel/create_stream.py#L40

rmaffesoli added a commit that referenced this issue Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants