Ejemplo n.º 1
0
def parse_args():
  versionMessage = "%prog {0} (http://pypi.python.org/pypi/sapling/{0})".format(version())

  usage = """
    %prog (-dv --python-git-db) --list
    %prog (-dv --python-git-db) --split [splitname...]"""

  epilog = "Happy splitting!"

  parser = optparse.OptionParser(usage = usage, version = versionMessage, epilog = epilog)

  parser.add_option("-d", "--debug", dest = "debug", action = "store_true", default = False,
                    help = "Prints extra debugging information.")
  parser.add_option("-v", "--verbose", dest = "verbose", action = "store_true", default = False,
                    help = "Prints extra information.")
  parser.add_option("--python-git-db", dest = "native", action = "store_false", default = True,
                    help = "Specifies the python implementation of the git object database should "
                    "be used instead of the native one - can speed operations when repository has "
                    "few large files.")

  # TODO(jsirois): enforce mutual exclusivity of these option groups

  install = optparse.OptionGroup(parser, "Install sap as a git subcommand")
  install.add_option("--install",
                     dest = "subcommand",
                     action = "store_const",
                     const = "install",
                     help = "Installs the git sap command if not installed already.")
  install.add_option("-f", "--force",
                     dest = "force",
                     action = "store_true",
                     default = False,
                     help = "Forces a re-install of the git sap command.")
  install.add_option("-s", "--show",
                     dest = "show",
                     action = "store_true",
                     default = False,
                     help = "Does not perform an install, instead shows the path of the binary "
                     "git sap' calls into.")
  parser.add_option_group(install)

  list = optparse.OptionGroup(parser, "List configured splits for the current git repo")
  list.add_option("--list",
                    dest = "subcommand",
                    default = "list",
                    action = "store_const",
                    const = "list",
                    help = "Lists splits defined in .saplings if any.")
  parser.add_option_group(list)

  split = optparse.OptionGroup(parser, "Split new commits out that affect one or more splits")
  split.add_option("--split",
                    dest = "subcommand",
                    action = "store_const",
                    const = "split",
                    help = "Populates branches with commits intersecting the specified splits. "
                           "If a --branch is not specified, arguments are treated as split names "
                           "definied in the .saplings config.")
  split.add_option("-b", "--branch",
                    dest = "branch",
                    help = "Specifies a branch to split to, arguments are treated as the patterns "
                           "to split.")
  split.add_option("-n", "--dry-run",
                   dest = "dry_run",
                   action = "store_true",
                   default = False,
                   help = "Does not perform a split, instead just lists the commits that would be "
                   "split.")
  parser.add_option_group(split)

  (options, args) = parser.parse_args()
  return (options, args, parser.error)
Ejemplo n.º 2
0
def parse_args():
    versionMessage = "%prog {0} (http://pypi.python.org/pypi/sapling/{0})".format(
        version())

    usage = """
    %prog (-dv --python-git-db) --list
    %prog (-dv --python-git-db) --split [splitname...]"""

    epilog = "Happy splitting!"

    parser = optparse.OptionParser(usage=usage,
                                   version=versionMessage,
                                   epilog=epilog)

    parser.add_option("-d",
                      "--debug",
                      dest="debug",
                      action="store_true",
                      default=False,
                      help="Prints extra debugging information.")
    parser.add_option("-v",
                      "--verbose",
                      dest="verbose",
                      action="store_true",
                      default=False,
                      help="Prints extra information.")
    parser.add_option(
        "--python-git-db",
        dest="native",
        action="store_false",
        default=True,
        help=
        "Specifies the python implementation of the git object database should "
        "be used instead of the native one - can speed operations when repository has "
        "few large files.")

    # TODO(jsirois): enforce mutual exclusivity of these option groups

    install = optparse.OptionGroup(parser, "Install sap as a git subcommand")
    install.add_option(
        "--install",
        dest="subcommand",
        action="store_const",
        const="install",
        help="Installs the git sap command if not installed already.")
    install.add_option("-f",
                       "--force",
                       dest="force",
                       action="store_true",
                       default=False,
                       help="Forces a re-install of the git sap command.")
    install.add_option(
        "-s",
        "--show",
        dest="show",
        action="store_true",
        default=False,
        help="Does not perform an install, instead shows the path of the binary "
        "git sap' calls into.")
    parser.add_option_group(install)

    list = optparse.OptionGroup(
        parser, "List configured splits for the current git repo")
    list.add_option("--list",
                    dest="subcommand",
                    default="list",
                    action="store_const",
                    const="list",
                    help="Lists splits defined in .saplings if any.")
    parser.add_option_group(list)

    split = optparse.OptionGroup(
        parser, "Split new commits out that affect one or more splits")
    split.add_option(
        "--split",
        dest="subcommand",
        action="store_const",
        const="split",
        help=
        "Populates branches with commits intersecting the specified splits. "
        "If a --branch is not specified, arguments are treated as split names "
        "definied in the .saplings config.")
    split.add_option(
        "-b",
        "--branch",
        dest="branch",
        help=
        "Specifies a branch to split to, arguments are treated as the patterns "
        "to split.")
    split.add_option(
        "-n",
        "--dry-run",
        dest="dry_run",
        action="store_true",
        default=False,
        help=
        "Does not perform a split, instead just lists the commits that would be "
        "split.")
    parser.add_option_group(split)

    (options, args) = parser.parse_args()
    return (options, args, parser.error)
Ejemplo n.º 3
0
from setuptools import setup

from sapversion import version

setup(
    name = 'sapling',
    version = version(),

    author = 'John Sirois',
    author_email = '*****@*****.**',
    description = 'A git porcelain to manage bidirectional subtree syncing with foreign git '
                  'repositories',
    license = 'Apache License Version 2.0',
    url = 'http://github.com/jsirois/sapling',

    provides = 'sapling',
    install_requires = (
      'gitdb >= 0.5.1',
      'GitPython > 0.2, < 0.4',
    ),

    packages = [ 'saplib', 'sapversion' ],
    package_data = { 'sapversion': [ 'version.txt' ] },
    scripts = [ 'sapling.py' ],

    classifiers = [
      'Programming Language :: Python',
      'Programming Language :: Python :: 2.6',
      'Development Status :: 2 - Pre-Alpha',
      'Environment :: Console',
      'Intended Audience :: Developers',