tests/test-hooklib-reject_merge_commits.t
author Matt Harbison <matt_harbison@yahoo.com>
Tue, 06 Sep 2022 15:08:52 -0400
branchstable
changeset 49490 37debd850c16
parent 44413 4cabeea6d214
permissions -rw-r--r--
packaging: update dulwich to drop the certifi dependency on Windows The presence of `certifi` causes the system certificate store to be ignored, which was reported as a bug against TortoiseHg[1]. It was only pulled in on Windows because of `dulwich`, which was copied from the old TortoiseHg install scripts, in order to support `hg-git`. This version of `dulwich` raises the minimum `urllib3` to a version (1.25) that does certificate verification by default, without the help of `certifi`[2]. We already bundle a newer version of `urllib3`. Note that `certifi` can still be imported from the user site directory, if installed there. But the installer no longer disables the system certificates by default. [1] https://foss.heptapod.net/mercurial/tortoisehg/thg/-/issues/5825 [2] https://github.com/jelmer/dulwich/issues/1025

  $ cat <<EOF >> $HGRCPATH
  > [extensions]
  > hooklib =
  > 
  > [phases]
  > publish = False
  > EOF
  $ hg init a
  $ hg --cwd a debugbuilddag '.:parent.:childa*parent/childa<parent@otherbranch./childa'
  $ hg --cwd a log -G
  o    changeset:   4:a9fb040caedd
  |\   branch:      otherbranch
  | |  tag:         tip
  | |  parent:      3:af739dfc49b4
  | |  parent:      1:66f7d451a68b
  | |  user:        debugbuilddag
  | |  date:        Thu Jan 01 00:00:04 1970 +0000
  | |  summary:     r4
  | |
  | o  changeset:   3:af739dfc49b4
  | |  branch:      otherbranch
  | |  parent:      0:1ea73414a91b
  | |  user:        debugbuilddag
  | |  date:        Thu Jan 01 00:00:03 1970 +0000
  | |  summary:     r3
  | |
  +---o  changeset:   2:a6b287721c3b
  | |/   parent:      0:1ea73414a91b
  | |    parent:      1:66f7d451a68b
  | |    user:        debugbuilddag
  | |    date:        Thu Jan 01 00:00:02 1970 +0000
  | |    summary:     r2
  | |
  o |  changeset:   1:66f7d451a68b
  |/   tag:         childa
  |    user:        debugbuilddag
  |    date:        Thu Jan 01 00:00:01 1970 +0000
  |    summary:     r1
  |
  o  changeset:   0:1ea73414a91b
     tag:         parent
     user:        debugbuilddag
     date:        Thu Jan 01 00:00:00 1970 +0000
     summary:     r0
  
  $ hg init b
  $ cat <<EOF >> b/.hg/hgrc
  > [hooks]
  > pretxnchangegroup.reject_merge_commits = \
  >   python:hgext.hooklib.reject_merge_commits.hook
  > EOF
  $ hg --cwd b pull ../a -r a6b287721c3b
  pulling from ../a
  adding changesets
  adding manifests
  adding file changes
  error: pretxnchangegroup.reject_merge_commits hook failed: a6b287721c3b rejected as merge on the same branch. Please consider rebase.
  transaction abort!
  rollback completed
  abort: a6b287721c3b rejected as merge on the same branch. Please consider rebase.
  [255]
  $ hg --cwd b pull ../a -r 1ea73414a91b
  pulling from ../a
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 0 changes to 0 files
  new changesets 1ea73414a91b (1 drafts)
  (run 'hg update' to get a working copy)
  $ hg --cwd b pull ../a -r a9fb040caedd
  pulling from ../a
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 0 changes to 0 files
  new changesets 66f7d451a68b:a9fb040caedd (3 drafts)
  (run 'hg update' to get a working copy)