##// END OF EJS Templates
filemerge: add support for partial conflict resolution by external tool...
filemerge: add support for partial conflict resolution by external tool A common class of merge conflicts is in imports/#includes/etc. It's relatively easy to write a tool that can resolve these conflicts, perhaps by naively just unioning the statements and leaving any cleanup to other tools to do later [1]. Such specialized tools cannot generally resolve all conflicts in a file, of course. Let's therefore call them "partial merge tools". Note that the internal simplemerge algorithm is such a partial merge tool - one that only resolves trivial "conflicts" where one side is unchanged or both sides change in the same way. One can also imagine having smarter language-aware partial tools that merge the AST. It may be useful for such tools to interactively let the user resolve any conflicts it can't resolve itself. However, having the option of implementing it as a partial merge tool means that the developer doesn't *need* to create a UI for it. Instead, the user can resolve any remaining conflicts with their regular merge tool (e.g. `:merge3` or `meld). We don't currently have a way to let the user define such partial merge tools. That's what this patch addresses. It lets the user configure partial merge tools to run. Each tool can be configured to run only on files matching certain patterns (e.g. "*.py"). The tool takes three inputs (local, base, other) and resolves conflicts by updating these in place. For example, let's say the inputs are these: base: ``` import sys def main(): print('Hello') ``` local: ``` import os import sys def main(): print('Hi') ``` other: ``` import re import sys def main(): print('Howdy') ``` A partial merge tool could now resolve the conflicting imports by replacing the import statements in *all* files by the following snippet, while leaving the remainder of the files unchanged. ``` import os import re import sys ``` As a result, simplemerge and any regular merge tool that runs after the partial merge tool(s) will consider the imports to be non-conflicting and will only present the conflict in `main()` to the user. Differential Revision: https://phab.mercurial-scm.org/D12356

File last commit:

r49613:6387562e stable
r49838:f3aafd78 default
Show More
Makefile
135 lines | 4.0 KiB | text/x-makefile | MakefileLexer
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 $(eval HGROOT := $(shell cd ../..; pwd))
Gregory Szorc
packaging: dynamically define make targets...
r38478 DEBIAN_CODENAMES := \
stretch \
av6
packaging: add Bullseye, remove Jessie...
r43077 buster \
bullseye
Gregory Szorc
packaging: dynamically define make targets...
r38478
UBUNTU_CODENAMES := \
xenial \
bionic \
av6
packaging: add Cosmic and Disco, remove Trusty and Artful...
r43076 cosmic \
Matt Harbison
packaging: drop Disco (19.04) and add Focal (20.04)...
r46582 focal
Gregory Szorc
packaging: dynamically define make targets...
r38478
Mads Kiilerich
packaging: update built-in Fedora support to Fedora 31...
r43678 FEDORA_RELEASE := 31
Gregory Szorc
packaging: dynamically define make targets...
r38478
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 RHEL_RELEASES := \
Mathias De Mare
packaging: add support for CentOS 8...
r43723 7 \
8
Gregory Szorc
packaging: dynamically define make targets...
r38478
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 # Build a Python for these RHEL (and derivatives) releases.
RHEL_WITH_PYTHON_RELEASES :=
RHEL_WITH_NONVERSIONED_PYTHON :=
RHEL_WITH_36_DOCUTILS := 7
Gregory Szorc
packaging: dynamically define make targets...
r38478
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 help:
@echo 'Packaging Make Targets'
@echo ''
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 @echo 'docker-rhel{$(strip $(RHEL_RELEASES))}'
@echo ' Build an RPM for a specific RHEL/derivative version using Docker.'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 @echo ''
Gregory Szorc
packaging: dynamically define make targets...
r38478 @echo 'docker-debian-{$(strip $(DEBIAN_CODENAMES))}'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 @echo ' Build Debian packages specific to a Debian distro using Docker.'
@echo ''
Mads Kiilerich
packaging: refactor "fedora29" target to a single more generic "fedora" target...
r43677 @echo 'docker-fedora'
@echo ' Build an RPM for a Fedora $(FEDORA_RELEASE) using Docker.'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 @echo ''
Gregory Szorc
packaging: dynamically define make targets...
r38478 @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 @echo ' Build Debian package specific to an Ubuntu distro using Docker.'
@echo ''
Gregory Szorc
packaging: dynamically define make targets...
r38478 @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}-ppa'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 @echo ' Build a source-only Debian package specific to an Ubuntu distro'
@echo ' using Docker.'
@echo ''
@echo 'linux-wheels'
@echo ' Build Linux manylinux wheels using Docker.'
@echo ''
@echo 'linux-wheels-{x86_64, i686}'
@echo ' Build Linux manylinux wheels for a specific architecture using Docker'
@echo ''
@echo 'deb'
@echo ' Build a Debian package locally targeting the current system'
@echo ''
@echo 'ppa'
@echo ' Build a Debian source package locally targeting the current system'
@echo ''
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 @echo 'rhel{$(strip $(RHEL_RELEASES))}'
@echo ' Build an RPM for a specific RHEL/derivative version locally'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 @echo ''
Mads Kiilerich
packaging: refactor "fedora29" target to a single more generic "fedora" target...
r43677 @echo 'fedora'
@echo ' Build an RPM for Fedora $(FEDORA_RELEASE) locally'
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
.PHONY: help
.PHONY: deb
deb:
./builddeb
.PHONY: ppa
ppa:
./builddeb --source-only
Gregory Szorc
packaging: dynamically define make targets...
r38478 # Debian targets.
define debian_targets =
.PHONY: docker-debian-$(1)
docker-debian-$(1):
./dockerdeb debian $(1)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 endef
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 $(foreach codename,$(DEBIAN_CODENAMES),$(eval $(call debian_targets,$(codename))))
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 # Ubuntu targets.
define ubuntu_targets =
.PHONY: docker-ubuntu-$(1)
docker-ubuntu-$(1):
./dockerdeb ubuntu $(1)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 .PHONY: docker-ubuntu-$(1)-ppa
docker-ubuntu-$(1)-ppa:
./dockerdeb ubuntu $(1) --source-only
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 endef
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 $(foreach codename,$(UBUNTU_CODENAMES),$(eval $(call ubuntu_targets,$(codename))))
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 # Fedora targets.
Mads Kiilerich
packaging: refactor "fedora29" target to a single more generic "fedora" target...
r43677 .PHONY: fedora
fedora:
mkdir -p $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 ./buildrpm
Mads Kiilerich
packaging: refactor "fedora29" target to a single more generic "fedora" target...
r43677 cp $(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
cp $(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $(HGROOT)/packages/fedora$(FEDORA_RELEASE)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034 rm -rf $(HGROOT)/rpmbuild
Mads Kiilerich
packaging: refactor "fedora29" target to a single more generic "fedora" target...
r43677 .PHONY: docker-fedora
docker-fedora:
./dockerrpm fedora$(FEDORA_RELEASE)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 # RHEL targets.
define rhel_targets
.PHONY: rhel$(1)
rhel$(1):
mkdir -p $$(HGROOT)/packages/rhel$(1)
./buildrpm $$(if $$(filter $(1),$$(RHEL_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(RHEL_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(RHEL_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,)
cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/rhel$(1)
cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/rhel$(1)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 .PHONY: docker-rhel$(1)
docker-rhel$(1):
./dockerrpm rhel$(1) $$(if $$(filter $(1),$$(RHEL_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(RHEL_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(RHEL_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,)
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Gregory Szorc
packaging: dynamically define make targets...
r38478 endef
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
Mathias De Mare
contrib: refer to RHEL and derivatives instead of CentOS specifically...
r49613 $(foreach release,$(RHEL_RELEASES),$(eval $(call rhel_targets,$(release))))
Gregory Szorc
packaging: move most packaging targets to own Makefile...
r38034
.PHONY: linux-wheels
linux-wheels: linux-wheels-x86_64 linux-wheels-i686
.PHONY: linux-wheels-x86_64
linux-wheels-x86_64:
docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_x86_64 /src/contrib/packaging/build-linux-wheels.sh
.PHONY: linux-wheels-i686
linux-wheels-i686:
docker run -e "HGTEST_JOBS=$(shell nproc)" --rm -ti -v `pwd`/../..:/src quay.io/pypa/manylinux1_i686 linux32 /src/contrib/packaging/build-linux-wheels.sh