chiark / gitweb /
Merge branch 'stable'
authorKarl Hasselström <kha@treskal.com>
Wed, 23 Jul 2008 21:24:57 +0000 (23:24 +0200)
committerKarl Hasselström <kha@treskal.com>
Thu, 24 Jul 2008 19:41:09 +0000 (21:41 +0200)
Conflicts:

setup.py

1  2 
setup.py
t/t2701-refresh-p.sh

diff --combined setup.py
index 8d8f7a84041f3776e851e22a94b8597a70dfc318,10b3715737e995456f1e336cc65e4c5fe60d3e65..54c2593f2b257c7a0298a6aaac50780f3575bf3a
+++ b/setup.py
@@@ -3,8 -3,7 +3,7 @@@
  import sys, glob, os
  from distutils.core import setup
  
 -from stgit.version import version, git_min_ver, python_min_ver
 +from stgit import version
- from stgit.run import Run
  
  def __version_to_list(version):
      """Convert a version string to a list of numbers or strings
@@@ -28,41 -27,22 +27,42 @@@ def __check_min_version(min_ver, ver)
  def __check_python_version():
      """Check the minimum Python version
      """
-     pyver = '.'.join(str(n) for n in sys.version_info)
+     pyver = '.'.join(map(lambda x: str(x), sys.version_info))
 -    if not __check_min_version(python_min_ver, pyver):
 +    if not __check_min_version(version.python_min_ver, pyver):
          print >> sys.stderr, 'Python version %s or newer required. Found %s' \
 -              % (python_min_ver, pyver)
 +              % (version.python_min_ver, pyver)
          sys.exit(1)
  
  def __check_git_version():
      """Check the minimum GIT version
      """
+     from stgit.run import Run
      gitver = Run('git', '--version').output_one_line().split()[2]
 -    if not __check_min_version(git_min_ver, gitver):
 +    if not __check_min_version(version.git_min_ver, gitver):
          print >> sys.stderr, 'GIT version %s or newer required. Found %s' \
 -              % (git_min_ver, gitver)
 +              % (version.git_min_ver, gitver)
          sys.exit(1)
  
 +def __run_setup():
 +    setup(name = 'stgit',
 +          version = version.version,
 +          license = 'GPLv2',
 +          author = 'Catalin Marinas',
 +          author_email = 'catalin.marinas@gmail.com',
 +          url = 'http://www.procode.org/stgit/',
 +          description = 'Stacked GIT',
 +          long_description = 'Push/pop utility on top of GIT',
 +          scripts = ['stg'],
 +          packages = ['stgit', 'stgit.commands', 'stgit.lib'],
 +          data_files = [
 +            ('share/stgit/templates', glob.glob('templates/*.tmpl')),
 +            ('share/stgit/examples', glob.glob('examples/*.tmpl')),
 +            ('share/stgit/examples', ['examples/gitconfig']),
 +            ('share/stgit/contrib', ['contrib/diffcol.sh',
 +                                     'contrib/stgbashprompt.sh',
 +                                     'contrib/stgit-completion.bash']),
 +            ('share/doc/stgit', glob.glob('doc/*.txt'))])
 +
  # Check the minimum versions required
  if sys.argv[1] in ['install', 'build']:
      __check_python_version()
  # ensure readable template files
  old_mask = os.umask(0022)
  
 -setup(name = 'stgit',
 -      version = version,
 -      license = 'GPLv2',
 -      author = 'Catalin Marinas',
 -      author_email = 'catalin.marinas@gmail.com',
 -      url = 'http://www.procode.org/stgit/',
 -      description = 'Stacked GIT',
 -      long_description = 'Push/pop utility on top of GIT',
 -      scripts = ['stg'],
 -      packages = ['stgit', 'stgit.commands'],
 -      data_files = [('share/stgit/templates', glob.glob('templates/*.tmpl')),
 -                    ('share/stgit/examples', glob.glob('examples/*.tmpl')),
 -                    ('share/stgit/examples', ['examples/gitconfig']),
 -                    ('share/stgit/contrib', ['contrib/diffcol.sh',
 -                                             'contrib/stgbashprompt.sh',
 -                                             'contrib/stgit-completion.bash']),
 -                    ('share/doc/stgit', glob.glob('doc/*.txt'))]
 -      )
 +try:
 +    version.write_builtin_version()
 +    __run_setup()
 +finally:
 +    version.delete_builtin_version()
  
  # restore the old mask
  os.umask(old_mask)
diff --combined t/t2701-refresh-p.sh
index 0000000000000000000000000000000000000000,d42e90f4a9b35dbd667900ea61bd31df79b700b1..6fb735212cb838e14246bfd19421218aa5497b36
mode 000000,100755..100755
--- /dev/null
@@@ -1,0 -1,46 +1,46 @@@
 -    diff -u expected0.txt status1.txt &&
+ #!/bin/sh
+ test_description='Run "stg refresh -p"'
+ . ./test-lib.sh
+ # Ignore our own temp files.
+ cat >> .git/info/exclude <<EOF
+ expected*.txt
+ files*.txt
+ status*.txt
+ EOF
+ test_expect_success 'Initialize StGit stack' '
+     stg init &&
+     for i in 1 2; do
+         echo x > $i.txt &&
+         git add $i.txt &&
+         stg new p$i -m "Patch $i" &&
+         stg refresh
+     done
+ '
+ touch expected0.txt
+ cat > expected1.txt <<EOF
+ A 1.txt
+ A new.txt
+ EOF
+ cat > expected2.txt <<EOF
+ A 2.txt
+ EOF
+ test_expect_failure 'Add new file to non-top patch' '
+     stg status > status1.txt &&
 -    diff -u expected0.txt status2.txt &&
++    test_cmp expected0.txt status1.txt &&
+     echo y > new.txt &&
+     git add new.txt &&
+     stg refresh -p p1 &&
+     stg status > status2.txt &&
 -    diff -u expected1.txt files1.txt &&
++    test_cmp expected0.txt status2.txt &&
+     stg files p1 > files1.txt &&
 -    diff -u expected2.txt files2.txt
++    test_cmp expected1.txt files1.txt &&
+     stg files p2 > files2.txt &&
++    test_cmp expected2.txt files2.txt
+ '
+ test_done