This is an archive of the discontinued Mercurial Phabricator instance.

format-source: move the extension to core
AbandonedPublic

Authored by pulkit on Dec 3 2018, 10:33 AM.

Details

Reviewers
None
Group Reviewers
hg-reviewers
Summary

Format-source is an extension which helps in applying and merging code
formatting (or other changes).

It provides a 'format-source' command which will
format the source with tool provided using config options. While formating it
stores information about the chunks being formatted and stores that in
'.hg-format-source' file. The file should be checked in to the repo so that it
can be shared with others.
It wraps filemerging to read formatting information from '.hg-format-source'
file which is checked into repo and then prevents conflicts related to
formatting.

It's ~300 lines of python code but the problem which it is solving is very
important in big distributed projects.

With this extension, we have all the functionality in core which is capable of
doing source formatting. hg annotate --skip is one of the other important
functionality here.

It caught my interest while I was finding how we can prevent conflicts with mass
b'' writing or other changes. I also found that Mozilla recently used it format
their large C++ codebase to Google coding style.
https://bugzilla.mozilla.org/show_bug.cgi?id=1511181

The extension and tests are copied from e43153fb827 changeset of
https://bitbucket.org/octobus/format-source repository.

While moving this extension, following changes were made:

  • added absolute_import to testlib/json-pretty.py
  • fix test-check-code.t violations like too long lines
  • dropped old compatibility code
  • changed tested-with value to match core ext ones
  • removed minimum-hgversion and buglink infos

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Dec 3 2018, 10:33 AM
pulkit abandoned this revision.Dec 3 2018, 10:55 AM

It was a volunteered effort and I find out that extension author has better plans after sending this. So abandoning.