contrib/merge-lists/Cargo.toml
author Martin von Zweigbergk <martinvonz@google.com>
Fri, 04 Mar 2022 16:12:56 -0800
changeset 49010 681b25ea579e
child 50806 337bc83c1275
permissions -rw-r--r--
contrib: add a partial-merge tool for sorted lists (such as Python imports) This is a pretty naive tool that uses a regular expression for matching lines. It is based on a Google-internal tool that worked in a similar way. For now, the regular expression is hard-coded to attempt to match single-line Python imports. The only commit I've found in the hg core repo where the tool helped was commit 9cd6292abfdf. I think that's because we often use multiple imports per import statement. I think this tool is still a decent first step (especially once the regex is made configurable in the next patch). The merging should ideally use a proper Python parser and do the merge at the AST (or CST?) level, but that's significantly harder, especially if you want to preserve comments and whitespace. It's also less generic. Differential Revision: https://phab.mercurial-scm.org/D12380
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49010
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     1
# A tool that performs a 3-way merge, resolving conflicts in sorted lists and
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     2
# leaving other conflicts unchanged. This is useful with Mercurial's support
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     3
# for partial merge tools (configured in `[partial-merge-tools]`).
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     4
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     5
[package]
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     6
name = "merge-lists"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     7
version = "0.1.0"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     8
edition = "2021"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
     9
# We need https://github.com/rust-lang/rust/pull/89825
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    10
rust-version = "1.59"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    11
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    12
[dependencies]
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    13
clap = { version = "3.1.6", features = ["derive"] }
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    14
itertools = "0.10.3"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    15
regex = "1.5.5"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    16
similar = { version="2.1.0", features = ["bytes"] }
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    17
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    18
[dev-dependencies]
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    19
assert_cmd = "2.0.4"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    20
insta = "1.13.0"
681b25ea579e contrib: add a partial-merge tool for sorted lists (such as Python imports)
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff changeset
    21
tempdir = "0.3.7"