code: def checkMergeSize(
      sourceBranch=None,
      targetBranch=None,
      sourceRepo=None,
      targetRepo=None,
  ):
      """
      Check that a git merge would not increase the repository size by
      MERGE_SIZE_LIMIT.
      """
      if sourceBranch is None:
          sourceBranch = getGitBranch()
          sourceRepo = ".."
  
      if targetBranch is None:
          if sourceBranch == "master":
              targetBranch = "master"
              targetRepo = "https://github.com/pyqtgraph/pyqtgraph.git"
          else:
              targetBranch = "master"
              targetRepo = ".."
  
      workingDir = "__merge-test-clone"
      env = dict(
          TARGET_BRANCH=targetBranch,
          SOURCE_BRANCH=sourceBranch,
          TARGET_REPO=targetRepo,
          SOURCE_REPO=sourceRepo,
          WORKING_DIR=workingDir,
      )
  
      print(
          "Testing merge size difference:\n"
          "  SOURCE: {SOURCE_REPO} {SOURCE_BRANCH}\n"
          "  TARGET: {TARGET_BRANCH} {TARGET_REPO}".format(**env)
      )
  
      setup = """
          mkdir {WORKING_DIR} && cd {WORKING_DIR} &&
          git init && git remote add -t {TARGET_BRANCH} target {TARGET_REPO} &&
          git fetch target {TARGET_BRANCH} &&
          git checkout -qf target/{TARGET_BRANCH} &&
          git gc -q --aggressive
          """.format(
          **env
      )
  
      checkSize = """
          cd {WORKING_DIR} &&
          du -s . | sed -e "s/\t.*//"
          """.format(
          **env
      )
  
      merge = """
          cd {WORKING_DIR} &&
          git pull -q {SOURCE_REPO} {SOURCE_BRANCH} &&
          git gc -q --aggressive
          """.format(
          **env
      )
  
      try:
          print("Check out target branch:\n" + setup)
          subprocess.check_call(setup, shell=True)
          targetSize = int(
              subprocess.check_output(checkSize, shell=True)
          )
          print("TARGET SIZE: %d kB" % targetSize)
          print("Merge source branch:\n" + merge)
          subprocess.check_call(merge, shell=True)
          mergeSize = int(
              subprocess.check_output(checkSize, shell=True)
          )
          print("MERGE SIZE: %d kB" % mergeSize)
  
          diff = mergeSize - targetSize
          if diff <= MERGE_SIZE_LIMIT:
              print("DIFFERENCE: %d kB  [OK]" % diff)
              return 0
          else:
              print(
                  "\033[0;31m"
                  + "DIFFERENCE: %d kB  [exceeds %d kB]"
                  % (diff, MERGE_SIZE_LIMIT)
                  + "\033[0m"
              )
              return 2
      finally:
          if os.path.isdir(workingDir):
              shutil.rmtree(workingDir)
  
imports: from contextlib import suppress
  import json
  import os
  import re
  import shutil
  import subprocess
  import sys
  from distutils import core
  from typing import Dict, Any
  from .generateChangelog import generateDebianChangelog
label_desc: Use image node_id 4 for calling a global function with example usage: checkMergeSize(sourceBranch, targetBranch, sourceRepo, targetRepo) and returns: int, int