Skip to content

Conversation

@karelbilek
Copy link
Contributor

As I was poking in the code, I didn't like that at some places, pushKV is being used, and at other places, push_back(Pair()) is being used. So I changed the style to pushKV. (It's done automatically by sed, see the git comment on the first commit)

I also realized that the Pair Univalue code is not used anymore with this change anymore, and since there is this comment in the source code for about 2 years

// Most duplicate other methods, and should be removed

I went ahead and removed it

It's all mostly bikeshed

Consistently use UniValue.pushKV instead of UniValue.push_back(Pair())

Replicable by `find . -name '*.cpp' -print0 | xargs -0 sed -i 's/push_back(Pair(\(.*\)));/pushKV(\1);/g'`
@sipa
Copy link
Member

sipa commented Sep 22, 2017

We have in fact a simple framework for verifiable scripted changes, see for example #10483. Perhaps you can use that for the first commit.

@jonasschnelli
Copy link
Contributor

UniValue is added as a git subtree. Please propose changes that affect the UniValue sources upstream (https://github.com/bitcoin-core/univalue).

@achow101
Copy link
Member

@jonasschnelli This is changing how UniValue is used, not changing UniValue itself.

@jonasschnelli
Copy link
Contributor

@achow101
Copy link
Member

Oh, missed that.

@promag
Copy link
Contributor

promag commented Sep 24, 2017

@Runn1ng will you remove univalue changes and submit a patch there?

@karelbilek
Copy link
Contributor Author

Sorry, busy weekend, I am doing it now

@jgarzik
Copy link
Contributor

jgarzik commented Sep 24, 2017

FWIW, jgarzik/univalue#42

@karelbilek
Copy link
Contributor Author

karelbilek commented Sep 24, 2017

Here is the PR bitcoin-core/univalue-subtree#5

@promag
Copy link
Contributor

promag commented Sep 27, 2017

For now 1st commit is enough. Meanwhile other merged PR's can use .push_back(Pair(...)) so keep an eye on that.

Concept ACK.

@karelbilek
Copy link
Contributor Author

karelbilek commented Sep 27, 2017 via email

@promag
Copy link
Contributor

promag commented Sep 27, 2017

I know and IMO a failing build is better. Anyway, concept ACK.

@jnewbery
Copy link
Contributor

I think the subtree update and scripted-diff would need to be atomic to avoid breaking git bisect. Is that correct?

Maybe check with @laanwj or @MarcoFalke if that's possible?

@promag
Copy link
Contributor

promag commented Sep 29, 2017

If #10583 is merged then there are a couple of push_back to replace after rebase.

@maflcko
Copy link
Member

maflcko commented Sep 29, 2017

@jnewbery Since the scripted diff can not contain any other changes (like changes to a subtree) I don't think this is possible. However, it is possible to do in one commit when the scripted diff keyword does not appear.

@karelbilek
Copy link
Contributor Author

I don't think I can do it both atomically for bisect and as git subtree merge.

I think I can make it atomically if I manually add the changes to the subtree files inside the script, but that will be a bit ugly too.

@sipa
Copy link
Member

sipa commented Sep 30, 2017

If it's impossible to do at once due to the subtree update being a separate commit, I think it's fine to do it as a separate commit in the same PR.

@jnewbery
Copy link
Contributor

jnewbery commented Oct 1, 2017

To keep git bisect working, we'd need to do two commits in univalue:

  1. Pushing boolean value to univalue correctly
  2. Remove deprecated std::pair wrappers

and do three commits in this repo:

  1. subtree update, pulling commit (1) from univalue
  2. do the scripted-diff to change from push_back(Pair()) to pushKV()
  3. subtree update, pulling commit (2) from univalue

is that possible?

@karelbilek
Copy link
Contributor Author

karelbilek commented Oct 12, 2017

@jnewbery yeah, that could be possible. Actually, the PR in univalue is already written like that.

Now I am waiting for the univalue PR to be merged :)

@maflcko
Copy link
Member

maflcko commented Nov 10, 2017

It can be done atomically in two commits. See #11420

@laanwj
Copy link
Member

laanwj commented Dec 12, 2017

FWIW #11420 was merged, anything left to do here?

@jnewbery
Copy link
Contributor

bitcoin-core/univalue-subtree#5 needs to be merged in bitcoin-core/univalue before this can go in.

@jnewbery
Copy link
Contributor

jnewbery commented Jan 8, 2018

This now requires bitcoin-core/univalue-subtree#10 and bitcoin-core/univalue-subtree#11 to be merged, and then separate subtree bumps for those PRs, with the "Consistently use UniValue.pushKV instead of UniValue.push_back(Pair())" commit between those two subtree bumps.

@karel-3d has said that he doesn't have time to maintain these PRs, so I'll open a PR that handles this once the univalue PRs are merged.

@jnewbery
Copy link
Contributor

bitcoin-core/univalue-subtree#10 is merged. Waiting for bitcoin-core/univalue-subtree#11 before I open a new PR for this.

@maflcko
Copy link
Member

maflcko commented Jan 15, 2018

@jnewbery I think it is cleaner to bump the subtree separately. (Once for bitcoin-core/univalue-subtree#10, and then some time in the future, not necessarily now, for bitcoin-core/univalue-subtree#11)

@jnewbery
Copy link
Contributor

I think it is cleaner to bump the subtree separately.

Sure, I'm happy to review a PR that does that.

maflcko pushed a commit that referenced this pull request Feb 12, 2018
…ack(Pair()) (karel-3d)

91986ed scripted-diff: Use UniValue.pushKV instead of push_back(Pair()) (Karel Bilek)
a570098 Squashed 'src/univalue/' changes from 07947ff2da..51d3ab34ba (MarcoFalke)

Pull request description:

  Rebased version of  #11386 by karel-3d.

  Closes:  #11386

Tree-SHA512: f3a81447e573c17e75813f4d41ceb34b9980eac81efdd98ddb149d7c51f792be7e2b32239b6ea7e6da68af23897afa6b4ce3f4e8070f9c4adf5105bf6075f2a0
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants