Ticket #52773: stg-up.diff
File stg-up.diff, 5.8 KB (added by umka-sev, 8 years ago) |
---|
-
Portfile
diff -urNp stgit.old/Portfile stgit/Portfile
old new PortSystem 1.0 5 5 PortGroup python 1.0 6 6 7 7 name stgit 8 version 0.15 9 revision 4 8 version 0.17.1 10 9 categories devel python 11 10 license GPL-2 12 11 platforms darwin … … long_description StGIT is a Python ap 30 29 homepage http://www.procode.org/stgit/ 31 30 master_sites http://homepage.ntlworld.com/cmarinas/stgit/ \ 32 31 http://download.gna.org/stgit/ 33 checksums md5 a4721b2a5f529cf5450109f9fcb4db19\34 sha1 8f18e3079014d907237aeffa6b851074422b7f27\35 rmd160 3779091ed8639c825f053c66031b4569a6ffbdea32 checksums md5 12e10e73276fa865098a23f032effd9b \ 33 sha1 5918fd983919ab70ab191868b84e917a06556cc2 \ 34 rmd160 74cfb72865b3c290613ca355d360b47baa1c8351 36 35 37 36 depends_run port:git 38 37 39 38 python.default_version 27 40 39 41 # ticket #27778 42 patchfiles tutorial.txt.patch 40 patch.pre_args -p1 41 42 # gerrit integration patch 43 patchfiles f82a2263.diff template.patch 43 44 44 45 set stgdocs "${worksrcpath}/Documentation/\\\[a-z\\\]*.txt" 45 46 set stgman "" 46 47 47 48 post-build { 49 reinplace "s|@@PREFIX@@|${prefix}|g" \ 50 ${worksrcpath}/stgit/templates.py 48 51 system -W ${worksrcpath} "PYTHON=${prefix}/bin/python2.7 make all" 49 52 } 50 53 -
files/f82a2263.diff
diff -urNp stgit.old/files/f82a2263.diff stgit/files/f82a2263.diff
old new 1 From f82a2263762a955518e2efb7616f7d58a300819c Mon Sep 17 00:00:00 2001 2 From: Jamie Madill <jmadill@chromium.org> 3 Date: Wed, 27 Nov 2013 13:20:27 -0500 4 Subject: [PATCH] Honor commit-msg hook for 'new' and 'edit'. 5 6 The commit-msg hook is important for gerrit users, where it 7 generates a Change-Id. 8 9 Change-Id: Ic1fde9e13e5e903ac8807be37feb7a88a9844dce 10 --- 11 12 diff --git a/stgit/commands/new.py b/stgit/commands/new.py 13 index 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 34 diff --git a/stgit/lib/edit.py b/stgit/lib/edit.py 35 index 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 1 diff -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.orig2 +++ Documentation/tutorial.txt3 @@ -1,5 +1,5 @@4 StGit tutorial5 -##############6 +==============7 8 StGit is a command-line application that provides functionality9 similar to link:http://savannah.nongnu.org/projects/quilt/[Quilt]