# HG changeset patch # User Martin von Zweigbergk # Date 1603955832 25200 # Node ID 330c258fe7ca06eaeaca60056741dd59024bf3b0 # Parent 4db5671d57d9946df0570c110b655d5a07055960# Parent 341e014fe0fbcf50a244c4b644b27ed87643829f branching: merge with stable diff -r 4db5671d57d9 -r 330c258fe7ca mercurial/commands.py --- a/mercurial/commands.py Sat Oct 17 21:57:21 2020 +0900 +++ b/mercurial/commands.py Thu Oct 29 00:17:12 2020 -0700 @@ -862,13 +862,11 @@ ui.status( _(b'changeset %s backs out changeset %s\n') - % (nice(repo.changelog.tip()), nice(node)) + % (nice(newnode), nice(node)) ) if opts.get(b'merge') and op1 != node: hg.clean(repo, op1, show_stats=False) - ui.status( - _(b'merging with changeset %s\n') % nice(repo.changelog.tip()) - ) + ui.status(_(b'merging with changeset %s\n') % nice(newnode)) overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} with ui.configoverride(overrides, b'backout'): return hg.merge(repo[b'tip']) diff -r 4db5671d57d9 -r 330c258fe7ca mercurial/commit.py --- a/mercurial/commit.py Sat Oct 17 21:57:21 2020 +0900 +++ b/mercurial/commit.py Thu Oct 29 00:17:12 2020 -0700 @@ -79,6 +79,9 @@ if repo.changelog._copiesstorage == b'extra': extra = _extra_with_copies(repo, extra, files) + # save the tip to check whether we actually committed anything + oldtip = repo.changelog.tiprev() + # update changelog repo.ui.note(_(b"committing changelog\n")) repo.changelog.delayupdate(tr) @@ -99,7 +102,11 @@ ) # set the new commit is proper phase targetphase = subrepoutil.newcommitphase(repo.ui, ctx) - if targetphase: + + # prevent unmarking changesets as public on recommit + waspublic = oldtip == repo.changelog.tiprev() and not repo[n].phase() + + if targetphase and not waspublic: # retract boundary do not alter parent changeset. # if a parent have higher the resulting phase will # be compliant anyway diff -r 4db5671d57d9 -r 330c258fe7ca mercurial/repoview.py --- a/mercurial/repoview.py Sat Oct 17 21:57:21 2020 +0900 +++ b/mercurial/repoview.py Thu Oct 29 00:17:12 2020 -0700 @@ -69,7 +69,7 @@ from . import mergestate ms = mergestate.mergestate.read(repo) - if ms.active(): + if ms.active() and ms.unresolvedcount(): for node in (ms.local, ms.other): rev = cl.index.get_rev(node) if rev is not None: diff -r 4db5671d57d9 -r 330c258fe7ca mercurial/ui.py --- a/mercurial/ui.py Sat Oct 17 21:57:21 2020 +0900 +++ b/mercurial/ui.py Thu Oct 29 00:17:12 2020 -0700 @@ -1661,7 +1661,9 @@ if not r: r = default if self.configbool(b'ui', b'promptecho'): - self._writemsg(self._fmsgout, r, b"\n", type=b'promptecho') + self._writemsg( + self._fmsgout, r or b'', b"\n", type=b'promptecho' + ) return r except EOFError: raise error.ResponseExpected() diff -r 4db5671d57d9 -r 330c258fe7ca mercurial/url.py --- a/mercurial/url.py Sat Oct 17 21:57:21 2020 +0900 +++ b/mercurial/url.py Thu Oct 29 00:17:12 2020 -0700 @@ -96,6 +96,13 @@ if not passwd: passwd = self.ui.getpass() + # As of Python 3.8, the default implementation of + # AbstractBasicAuthHandler.retry_http_basic_auth() assumes the user + # is set if pw is not None. This means (None, str) is not a valid + # return type of find_user_password(). + if user is None: + return None, None + self.passwddb.add_password(realm, authuri, user, passwd) self._writedebug(user, passwd) return (pycompat.strurl(user), pycompat.strurl(passwd)) diff -r 4db5671d57d9 -r 330c258fe7ca tests/test-backout.t --- a/tests/test-backout.t Sat Oct 17 21:57:21 2020 +0900 +++ b/tests/test-backout.t Thu Oct 29 00:17:12 2020 -0700 @@ -806,3 +806,18 @@ $ hg backout --merge --no-commit 2 abort: cannot specify both --no-commit and --merge [255] + +Ensure that backout out the same changeset twice performs correctly: + + $ hg backout 2 + removing 3 + changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f + $ echo 4 > 4 + $ hg ci -A -m 4 + adding 4 + $ hg up 2 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg backout 2 + removing 3 + created new head + changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f diff -r 4db5671d57d9 -r 330c258fe7ca tests/test-http.t --- a/tests/test-http.t Sat Oct 17 21:57:21 2020 +0900 +++ b/tests/test-http.t Thu Oct 29 00:17:12 2020 -0700 @@ -192,6 +192,34 @@ $ hg id http://localhost:$HGPORT2/ abort: http authorization required for http://localhost:$HGPORT2/ [255] + $ hg id --config ui.interactive=true --debug http://localhost:$HGPORT2/ + using http://localhost:$HGPORT2/ + sending capabilities command + http authorization required for http://localhost:$HGPORT2/ + realm: mercurial + user: abort: response expected + [255] + $ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/ + > + > EOF + using http://localhost:$HGPORT2/ + sending capabilities command + http authorization required for http://localhost:$HGPORT2/ + realm: mercurial + user: + password: abort: response expected + [255] + $ cat <<'EOF' | hg id --config ui.interactive=true --config ui.nontty=true --debug http://localhost:$HGPORT2/ + > + > + > EOF + using http://localhost:$HGPORT2/ + sending capabilities command + http authorization required for http://localhost:$HGPORT2/ + realm: mercurial + user: + password: abort: authorization failed + [255] $ hg id --config ui.interactive=true --config extensions.getpass=get_pass.py http://user@localhost:$HGPORT2/ http authorization required for http://localhost:$HGPORT2/ realm: mercurial @@ -360,6 +388,9 @@ "GET /?cmd=capabilities HTTP/1.1" 401 - "GET /?cmd=capabilities HTTP/1.1" 401 - "GET /?cmd=capabilities HTTP/1.1" 401 - + "GET /?cmd=capabilities HTTP/1.1" 401 - + "GET /?cmd=capabilities HTTP/1.1" 401 - + "GET /?cmd=capabilities HTTP/1.1" 401 - "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull diff -r 4db5671d57d9 -r 330c258fe7ca tests/test-phases.t --- a/tests/test-phases.t Sat Oct 17 21:57:21 2020 +0900 +++ b/tests/test-phases.t Thu Oct 29 00:17:12 2020 -0700 @@ -999,3 +999,55 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: A + $ cd .. + +Recommitting an exact match of a public commit shouldn't change it to +draft: + + $ cd initialrepo + $ hg phase -r 2 + 2: public + $ hg up -C 1 + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ mkcommit C + created new head + $ hg phase -r 2 + 2: public + +Same, but for secret: + + $ hg up 7 + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ mkcommit F -s + test-debug-phase: new rev 8: x -> 2 + test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret + $ hg up 7 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg phase + 7: draft + $ mkcommit F + test-debug-phase: new rev 8: x -> 2 + test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret + $ hg phase -r tip + 8: secret + +But what about obsoleted changesets? + + $ hg up 4 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ mkcommit H + test-debug-phase: new rev 5: x -> 2 + created new head + test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret + $ hg phase -r 5 + 5: secret + $ hg par + changeset: 5:a030c6be5127 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + obsolete: pruned + summary: H + + $ hg up tip + 2 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ cd .. diff -r 4db5671d57d9 -r 330c258fe7ca tests/test-rebase-check-restore.t --- a/tests/test-rebase-check-restore.t Sat Oct 17 21:57:21 2020 +0900 +++ b/tests/test-rebase-check-restore.t Thu Oct 29 00:17:12 2020 -0700 @@ -176,6 +176,48 @@ warning: conflicts while merging A! (edit, then use 'hg resolve --mark') [1] +An unresolved conflict will pin the obsolete revision + + $ hg log -G -Tcompact + % 5[tip] 071d07019675 1970-01-01 00:00 +0000 test + | F + | + o 4 ae36e8e3dfd7 1970-01-01 00:00 +0000 test + | E + | + o 3:0 46b37eabc604 1970-01-01 00:00 +0000 test + | D + | + | @ 2 965c486023db 1970-01-01 00:00 +0000 test + | | C + | | + | o 1 27547f69f254 1970-01-01 00:00 +0000 test + |/ B + | + o 0 4a2df7238c3b 1970-01-01 00:00 +0000 test + A + + +But resolving the conflicts will unpin it + + $ hg resolve -m A + (no more unresolved files) + $ hg log -G -Tcompact + o 4[tip] ae36e8e3dfd7 1970-01-01 00:00 +0000 test + | E + | + o 3:0 46b37eabc604 1970-01-01 00:00 +0000 test + | D + | + | @ 2 965c486023db 1970-01-01 00:00 +0000 test + | | C + | | + | o 1 27547f69f254 1970-01-01 00:00 +0000 test + |/ B + | + o 0 4a2df7238c3b 1970-01-01 00:00 +0000 test + A + $ hg up -C -q . $ cd ..