Mercurial > hg
comparison mercurial/cmdutil.py @ 40666:69268a13ffa5
branch: allow changing branch of merge commits with --rev
Tests show that changing branch of merge commits works fine with evolution and
without, so let's allow it. Other safeguards should prevent users from shooting
themselves in the foot.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Fri, 09 Nov 2018 13:57:13 +0800 |
parents | 824b687ff6af |
children | 79f8f032c706 |
comparison
equal
deleted
inserted
replaced
40665:fb379b78b93e | 40666:69268a13ffa5 |
---|---|
730 if len(roots) > 1: | 730 if len(roots) > 1: |
731 raise error.Abort(_("cannot change branch of non-linear revisions")) | 731 raise error.Abort(_("cannot change branch of non-linear revisions")) |
732 rewriteutil.precheck(repo, revs, 'change branch of') | 732 rewriteutil.precheck(repo, revs, 'change branch of') |
733 | 733 |
734 root = repo[roots.first()] | 734 root = repo[roots.first()] |
735 if not root.p1().branch() == label and label in repo.branchmap(): | 735 rpb = {parent.branch() for parent in root.parents()} |
736 if label not in rpb and label in repo.branchmap(): | |
736 raise error.Abort(_("a branch of the same name already exists")) | 737 raise error.Abort(_("a branch of the same name already exists")) |
737 | 738 |
738 if repo.revs('merge() and %ld', revs): | |
739 raise error.Abort(_("cannot change branch of a merge commit")) | |
740 if repo.revs('obsolete() and %ld', revs): | 739 if repo.revs('obsolete() and %ld', revs): |
741 raise error.Abort(_("cannot change branch of a obsolete changeset")) | 740 raise error.Abort(_("cannot change branch of a obsolete changeset")) |
742 | 741 |
743 # make sure only topological heads | 742 # make sure only topological heads |
744 if repo.revs('heads(%ld) - head()', revs): | 743 if repo.revs('heads(%ld) - head()', revs): |