On 11/30/18 2:06 AM, Ehsan Akhgari wrote:
On Thu, Nov 29, 2018 at 9:43 AM Emilio Cobos Álvarez <emi...@crisal.io>
wrote:

On 11/29/18 1:38 PM, Sylvestre Ledru wrote:
This extension will automatically rebase the local changes to avoid
conflicts.

Is there a way to do the same for cinnabar users?


Yes!  Sorry for the delay...

NP!

Please check out this script:
https://github.com/ehsan/clang-format-reformat-branch.  This does something
similar to the format-source extension for Mercurial but done as a one-time
tool, borrowing from the tool that the MongoDB project developed for the
same use case.  It takes a local branch based on a clone of mozilla-central
that doesn't yet have the reformat commit and rebases it on top of the
reformat commit, reformatting your local modifications in the process.  I
hope it proves to be helpful for the git users out there!

Nice! I haven't tried it yet (actually was going to report back when I found the reply).

I hacked up something today as well while looking into this. It's not really sophisticated, and you need to tweak the git repo config, so your script probably works best for most people.

Just in case it's useful for somebody, while looking into a way to do this (I basically followed[1]), I wrote a little merge driver which seems to work fine (with a caveat, see below). I just uploaded it here:

  https://github.com/emilio/clang-format-merge

The nice thing is that I can forget about this and all the regular commands (cherry-pick / rebase / am...) will "just work", which is nice for me since I don't need to think on all the patches I need to rebase before-hand.

The caveat is that right now it needs a patch:

  https://phabricator.services.mozilla.com/D13505

Because the current './mach clang-format -a' used for 'hg formatsource' makes assumptions about the path it's formatting, and git loves paths like .merge_file_lwMX2O. So if it doesn't make it in it'll be quite useless :-)

The repository has full instructions on how to use it, but please let me
know if you have any questions or hit any issues.

Thanks, I'll give that a shot for some of my checkouts and report back :)

 -- Emilio

[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=574611
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to