Ticket #52773: stg-up.diff

File stg-up.diff, 5.8 KB (added by umka-sev, 8 years ago)

stgit update

  • Portfile

    diff -urNp stgit.old/Portfile stgit/Portfile
    old new PortSystem 1.0 
    55PortGroup           python 1.0
    66
    77name                stgit
    8 version             0.15
    9 revision            4
     8version             0.17.1
    109categories          devel python
    1110license             GPL-2
    1211platforms           darwin
    long_description StGIT is a Python ap 
    3029homepage            http://www.procode.org/stgit/
    3130master_sites        http://homepage.ntlworld.com/cmarinas/stgit/ \
    3231                    http://download.gna.org/stgit/
    33 checksums           md5     a4721b2a5f529cf5450109f9fcb4db19 \
    34                     sha1    8f18e3079014d907237aeffa6b851074422b7f27 \
    35                     rmd160  3779091ed8639c825f053c66031b4569a6ffbdea
     32checksums           md5     12e10e73276fa865098a23f032effd9b \
     33                    sha1    5918fd983919ab70ab191868b84e917a06556cc2 \
     34                    rmd160  74cfb72865b3c290613ca355d360b47baa1c8351
    3635
    3736depends_run         port:git
    3837
    3938python.default_version 27
    4039
    41 # ticket #27778
    42 patchfiles          tutorial.txt.patch
     40patch.pre_args  -p1
     41
     42# gerrit integration patch
     43patchfiles          f82a2263.diff template.patch
    4344
    4445set stgdocs         "${worksrcpath}/Documentation/\\\[a-z\\\]*.txt"
    4546set stgman          ""
    4647
    4748post-build {
     49    reinplace "s|@@PREFIX@@|${prefix}|g" \
     50        ${worksrcpath}/stgit/templates.py
    4851    system -W ${worksrcpath} "PYTHON=${prefix}/bin/python2.7 make all"
    4952}
    5053
  • files/f82a2263.diff

    diff -urNp stgit.old/files/f82a2263.diff stgit/files/f82a2263.diff
    old new  
     1From f82a2263762a955518e2efb7616f7d58a300819c Mon Sep 17 00:00:00 2001
     2From: Jamie Madill <jmadill@chromium.org>
     3Date: Wed, 27 Nov 2013 13:20:27 -0500
     4Subject: [PATCH] Honor commit-msg hook for 'new' and 'edit'.
     5
     6The commit-msg hook is important for gerrit users, where it
     7generates a Change-Id.
     8
     9Change-Id: Ic1fde9e13e5e903ac8807be37feb7a88a9844dce
     10---
     11
     12diff --git a/stgit/commands/new.py b/stgit/commands/new.py
     13index d5c5382..3328042 100644
     14--- a/stgit/commands/new.py
     15+++ b/stgit/commands/new.py
     16@@ -20,6 +20,7 @@
     17 from stgit.commands import common
     18 from stgit.lib import git as gitlib, transaction
     19 from stgit.config import config
     20+from stgit.lib import edit
     21 
     22 help = 'Create a new, empty patch'
     23 kind = 'patch'
     24@@ -69,6 +70,9 @@
     25         author = gitlib.Person.author(), committer = gitlib.Person.committer())
     26     cd = common.update_commit_data(cd, options)
     27 
     28+    # run the commit-msg hook
     29+    cd = cd.set_message(edit.run_commit_msg_hook(stack.repository, cd.message))
     30+
     31     if options.save_template:
     32         options.save_template(cd.message)
     33         return utils.STGIT_SUCCESS
     34diff --git a/stgit/lib/edit.py b/stgit/lib/edit.py
     35index c8d29f6..5993754 100644
     36--- a/stgit/lib/edit.py
     37+++ b/stgit/lib/edit.py
     38@@ -3,6 +3,31 @@
     39 from stgit import utils
     40 from stgit.commands import common
     41 from stgit.lib import git
     42+from stgit import run
     43+from tempfile import NamedTemporaryFile
     44+import os
     45+
     46+def run_commit_msg_hook(repo, message):
     47+    """Run the commit-msg git hook manually when editing a patch.
     48+
     49+    Return the edited commit message, or the original message if there
     50+    is no commit-msg hook."""
     51+
     52+    hook_path = os.path.join(repo.directory, 'hooks', 'commit-msg')
     53+
     54+    if not os.access(hook_path, os.X_OK):
     55+        return message
     56+
     57+    # message hook exists, make a temporary file and run on the temp file
     58+    tf = NamedTemporaryFile("w", delete=False)
     59+    tf.write(message)
     60+    tf.close()
     61+
     62+    run.Run('bash', hook_path, tf.name).run()
     63+    new_msg = open(tf.name, 'r').read()
     64+    os.remove(tf.name)
     65+
     66+    return new_msg
     67 
     68 def update_patch_description(repo, cd, text, contains_diff):
     69     """Update the given L{CommitData<stgit.lib.git.CommitData>} with the
     70@@ -19,7 +44,7 @@
     71                         (git.Date.maybe(authdate), 'set_date')]:
     72         if val != None:
     73             a = getattr(a, setter)(val)
     74-    cd = cd.set_message(message).set_author(a)
     75+    cd = cd.set_message(run_commit_msg_hook(repo, message)).set_author(a)
     76     failed_diff = None
     77     if diff:
     78         tree = repo.apply(cd.parent.data.tree, diff, quiet = False)
  • files/template.patch

    diff -urNp stgit.old/files/template.patch stgit/files/template.patch
    old new  
     1diff -urNp stgit-0.17.1.orig/stgit/templates.py stgit-0.17.1/stgit/templates.py
     2--- stgit-0.17.1.orig/stgit/templates.py        2006-07-11 12:21:38.000000000 +0300
     3+++ stgit-0.17.1/stgit/templates.py     2016-11-01 19:01:47.000000000 +0300
     4@@ -31,7 +31,9 @@ def get_template(tfile):
     5                   os.path.join(os.path.expanduser('~'), '.stgit', 'templates',
     6                                tfile),
     7                   os.path.join(sys.prefix, 'share', 'stgit', 'templates',
     8-                               tfile) ]
     9+                               tfile),
     10+                  os.path.join("@@PREFIX@@", 'share', 'stgit', 'templates',
     11+                               tfile)]
     12 
     13     tmpl = None
     14     for t in tmpl_list:
  • files/tutorial.txt.patch

    diff -urNp stgit.old/files/tutorial.txt.patch stgit/files/tutorial.txt.patch
    old new  
    1 --- Documentation/tutorial.txt.orig
    2 +++ Documentation/tutorial.txt
    3 @@ -1,5 +1,5 @@
    4  StGit tutorial
    5 -##############
    6 +==============
    7  
    8  StGit is a command-line application that provides functionality
    9  similar to link:http://savannah.nongnu.org/projects/quilt/[Quilt]