Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 42409:72522fe7fb95
merge: reorder some initialization to make more sense
This puts the closely related definitions of "pl", "p1", "p2", "pas"
close together, and moves the definition of "overwrite" away and
closer to where it's first used.
Differential Revision: https://phab.mercurial-scm.org/D6471
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sat, 09 Mar 2019 22:11:27 -0800 |
parents | beec7fc6adec |
children | a5b5ecff5f37 |
comparison
equal
deleted
inserted
replaced
42408:4e4fa3a95406 | 42409:72522fe7fb95 |
---|---|
1975 with repo.wlock(): | 1975 with repo.wlock(): |
1976 if wc is None: | 1976 if wc is None: |
1977 wc = repo[None] | 1977 wc = repo[None] |
1978 pl = wc.parents() | 1978 pl = wc.parents() |
1979 p1 = pl[0] | 1979 p1 = pl[0] |
1980 p2 = repo[node] | |
1980 pas = [None] | 1981 pas = [None] |
1981 if ancestor is not None: | 1982 if ancestor is not None: |
1982 pas = [repo[ancestor]] | 1983 pas = [repo[ancestor]] |
1983 | |
1984 overwrite = force and not branchmerge | |
1985 | |
1986 p2 = repo[node] | |
1987 if pas[0] is None: | 1984 if pas[0] is None: |
1988 if repo.ui.configlist('merge', 'preferancestor') == ['*']: | 1985 if repo.ui.configlist('merge', 'preferancestor') == ['*']: |
1989 cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node()) | 1986 cahs = repo.changelog.commonancestorsheads(p1.node(), p2.node()) |
1990 pas = [repo[anc] for anc in (sorted(cahs) or [nullid])] | 1987 pas = [repo[anc] for anc in (sorted(cahs) or [nullid])] |
1991 else: | 1988 else: |
1992 pas = [p1.ancestor(p2, warn=branchmerge)] | 1989 pas = [p1.ancestor(p2, warn=branchmerge)] |
1993 | 1990 |
1994 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), bytes(p1), bytes(p2) | 1991 fp1, fp2, xp1, xp2 = p1.node(), p2.node(), bytes(p1), bytes(p2) |
1995 | 1992 |
1993 overwrite = force and not branchmerge | |
1996 ### check phase | 1994 ### check phase |
1997 if not overwrite: | 1995 if not overwrite: |
1998 if len(pl) > 1: | 1996 if len(pl) > 1: |
1999 raise error.Abort(_("outstanding uncommitted merge")) | 1997 raise error.Abort(_("outstanding uncommitted merge")) |
2000 ms = mergestate.read(repo) | 1998 ms = mergestate.read(repo) |