StGit: kha/{safe,experimental} updated
kha/safe has improved version handling: "stg --version" will now present a detailed version number just like git does:
$ stg --version Stacked GIT 0.14.2.152.g77bd
kha/safe also has an improvement/bugfix to the emacs mode: it will automatically cd up to the root of your worktree, just like git's emacs mode has done since forever.
kha/experimental has a new command, stg redo. The combination undo + redo makes it easy to move back and forth in the patch stack history.
-+-
The following changes since commit d9b2f20a72706d6b4f553a8a8e25bd67f87ed616:
Karl Hasselström (1):
Use test_cmp instead of diff -u in the test suite
are available in the git repository at:
git://repo.or.cz/stgit/kha.git safe
Karl Hasselström (4):
Remove "stg" from start of log messages Import version to a separate namespace Better StGit version tracking
Emacs mode: automatically cd up to root of worktree
contrib/stgit.el | 13 ++++++++++- setup.py | 14 ++++++----- stgit/.gitignore | 1 + stgit/commands/clean.py | 2 +- stgit/commands/coalesce.py | 2 +- stgit/commands/commit.py | 2 +- stgit/commands/edit.py | 2 +- stgit/commands/goto.py | 2 +- stgit/commands/uncommit.py | 2 +- stgit/version.py | 52 +++++++++++++++++++++++++++++++++++++++++++- 10 files changed, 78 insertions(+), 14 deletions(-)
-+-
The following changes since commit 52144ce5f2bfb1268aee4a9999821987f8892dbf:
Karl Hasselström (1):
Emacs mode: automatically cd up to root of worktree
are available in the git repository at:
git://repo.or.cz/stgit/kha.git experimental
Karl Hasselström (20):
Disable patchlog test for "stg new"
Convert "stg new" to the new infrastructure Refactor --author/--committer options
Let "stg new" support more message options
Emacs mode: use "stg new --file"
Convert "stg delete" to the new infrastructure Emacs mode: delete patches
Prevent most commands from running when there are conflicts Add property with a list of all patch names Library functions for tree and blob manipulation Write to a stack log when stack is modified
Add utility function for reordering patches
New command: stg reset
Log conflicts separately
Log conflicts separately for all commands
Add a --hard flag to stg reset
Don't write a log entry if there were no changes Move stack reset function to a shared location New command: stg undo
New command: stg redo
contrib/stgit.el | 33 ++++-- stgit/commands/branch.py | 19 ++- stgit/commands/clean.py | 2 +- stgit/commands/coalesce.py | 6 +- stgit/commands/commit.py | 13 ++- stgit/commands/common.py | 41 +++---- stgit/commands/delete.py | 76 +++++-------- stgit/commands/diff.py | 2 +- stgit/commands/edit.py | 28 +---- stgit/commands/export.py | 2 +- stgit/commands/files.py | 2 +- stgit/commands/id.py | 2 +- stgit/commands/log.py | 2 +- stgit/commands/mail.py | 2 +- stgit/commands/new.py | 97 +++++++++------- stgit/commands/patches.py | 2 +- stgit/commands/redo.py | 52 +++++++++ stgit/commands/reset.py | 61 ++++++++++ stgit/commands/series.py | 2 +- stgit/commands/show.py | 2 +- stgit/commands/status.py | 3 +- stgit/commands/top.py | 2 +- stgit/commands/uncommit.py | 5 +- stgit/commands/undo.py | 49 ++++++++ stgit/lib/git.py | 154 +++++++++++++++++++++----- stgit/lib/log.py | 265 ++++++++++++++++++++++++++++++++++++++++++++ stgit/lib/stack.py | 8 ++ stgit/lib/transaction.py | 93 ++++++++++++--- stgit/main.py | 8 ++ stgit/utils.py | 50 ++++++++ t/t1400-patch-history.sh | 2 - t/t1600-delete-one.sh | 8 +- t/t3100-reset.sh | 151 +++++++++++++++++++++++++ t/t3101-reset-hard.sh | 56 +++++++++ t/t3102-undo.sh | 86 ++++++++++++++ t/t3103-undo-hard.sh | 56 +++++++++ t/t3104-redo.sh | 122 ++++++++++++++++++++ 37 files changed, 1339 insertions(+), 225 deletions(-) create mode 100644 stgit/commands/redo.py create mode 100644 stgit/commands/reset.py create mode 100644 stgit/commands/undo.py create mode 100644 stgit/lib/log.py create mode 100755 t/t3100-reset.sh create mode 100755 t/t3101-reset-hard.sh create mode 100755 t/t3102-undo.sh create mode 100755 t/t3103-undo-hard.sh create mode 100755 t/t3104-redo.sh
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
PATCH 1/2 Import version to a separate namespace
The set of names we need from the version module is about to get too large to list explicitly, but we don't want to pollute the local namespace with every name from version. So do a qualified import of the module.
---
setup.py | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
setup.py +6 -6
@@ -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):
@@ -29,18 +29,18 @@ def __check_python_version(): """Check the minimum Python version """ pyver = '.'.join(str(n) for n in 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 """ 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) # Check the minimum versions required
@@ -52,7 +52,7 @@ if sys.argv[1] in ['install', 'build']: old_mask = os.umask(0022) setup(name = 'stgit', - version = version, + version = version.version, license = 'GPLv2', author = 'Catalin Marinas', author_email = '[email protected]',
PATCH 2/2 Better StGit version tracking
In reply to Karl HasselströmInstead of claiming to be the latest released version (really, a hardcoded string that we hope is the latest released version), run git describe to figure out what version we are, just like git does. Fall back to a hardcoded value that is generated at install time, or supplied in a release tarball.
Currently, we have to give git describe the --tags flag, since StGit release tags are lightweight tags. This means we're going to pick up any lightweight tags the user makes, which isn't ideal. The solution is to start making annotated release tags, and then remove that flag.
---
Catalin, you might want to pay extra attention the first time you release something with this in it. Making sure that stgit/builtin_version.py is included in the tarball, for example.
setup.py | 2 ++ stgit/.gitignore | 1 + stgit/version.py | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 54 insertions(+), 1 deletions(-)
setup.py +2 -0
@@ -48,6 +48,8 @@ if sys.argv[1] in ['install', 'build']: __check_python_version() __check_git_version() +version.write_builtin_version() + # ensure readable template files old_mask = os.umask(0022)
stgit/.gitignore +1 -0
@@ -1 +1,2 @@ *.pyc +/builtin_version.py
stgit/version.py +51 -1
55 lines not on this page · raw message
PATCH 1/1 Emacs mode: automatically cd up to root of worktree
In reply to Karl Hasselströmgit's emacs mode automatically finds the root of the worktree, so that the user doesn't have to. Teach StGit's emacs mode the same trick by borrowing the git-get-top-dir function from git.
The borrowed code was written by Alexandre Julliard <[email protected]>.
---
David, would you sanity check this for me?
contrib/stgit.el | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
contrib/stgit.el +12 -1
@@ -12,9 +12,20 @@ (defun stgit (dir) "Manage stgit patches" (interactive "DDirectory: \n") - (switch-to-stgit-buffer dir) + (switch-to-stgit-buffer (git-get-top-dir dir)) (stgit-refresh)) +(defun git-get-top-dir (dir) + "Retrieve the top-level directory of a git tree." + (let ((cdup (with-output-to-string + (with-current-buffer standard-output + (cd dir) + (unless (eq 0 (call-process "git" nil t nil + "rev-parse" "--show-cdup")) + (error "cannot find top-level git tree for %s." dir)))))) + (expand-file-name (concat (file-name-as-directory dir) + (car (split-string cdup "\n")))))) + (defun switch-to-stgit-buffer (dir) "Switch to a (possibly new) buffer displaying StGit patches for DIR" (setq dir (file-name-as-directory dir))
Re: [StGit PATCH] Emacs mode: automatically cd up to root of worktree
Quoted 7 lines · Karl Hasselström
git's emacs mode automatically finds the root of the worktree, so that the user doesn't have to. Teach StGit's emacs mode the same trick by borrowing the git-get-top-dir function from git.
The borrowed code was written by Alexandre Julliard <[email protected]>.
Signed-off-by Karl Hasselström <[email protected]>
Excellent. It's an itch that I've been meaning to scratch for some time.
Signature · 1 line
David Kågedal
Re: [StGit PATCH] Emacs mode: automatically cd up to root of worktree
Quoted 6 lines · David Kågedal
Quoted 4 lines · Karl Hasselström
git's emacs mode automatically finds the root of the worktree, so that the user doesn't have to. Teach StGit's emacs mode the same trick by borrowing the git-get-top-dir function from git.
Quoted 6 lines
Quoted 4 lines
The borrowed code was written by Alexandre Julliard <[email protected]>.
Signed-off-by Karl Hasselström <[email protected]>Signed-off-by David Kågedal <[email protected]>
I guess you mean "Acked-by"?
Quoted 2 lines
Excellent. It's an itch that I've been meaning to scratch for some time.
Me too. I've gotten into the habit of running "C-x b *stgit*" to get to the StGit buffer, just so I don't have to give the right directory every time.
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
PATCH 1/1 New command: stg redo
In reply to Karl HasselströmCommand for undoing an undo.
---
stgit/commands/redo.py | 21 +++++++++------
stgit/lib/log.py | 19 ++++++++++----
stgit/main.py | 2 +
t/t3104-redo.sh | 66 +++++++++++++++++++++++++++++++++++++-----------
4 files changed, 79 insertions(+), 29 deletions(-)
copy stgit/commands/{undo.py => redo.py} (71%)
copy t/{t3102-undo.sh => t3104-redo.sh} (53%)stgit/commands/redo.py renamed from stgit/commands/undo.py +12 -9
@@ -19,28 +19,31 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from optparse import make_option from stgit.commands import common -from stgit.lib import git, log, transaction -from stgit.out import out +from stgit.lib import log, transaction -help = 'undo the last operation' +help = 'undo the last undo operation' usage = """%prog [options] -Reset the patch stack to the previous state. Consecutive invocations -of "stg undo" will take you ever further into the past.""" +If the last command was an undo, reset the patch stack to the state it +had before the undo. Consecutive invocations of "stg redo" will undo +the effects of consecutive invocations of "stg undo". + +It is an error to run "stg redo" if the last command was not an +undo.""" directory = common.DirectoryHasRepositoryLib() options = [make_option('-n', '--number', type = 'int', metavar = 'N', default = 1, - help = 'undo the last N commands'), + help = 'undo the last N undos'), make_option('--hard', action = 'store_true', help = 'discard changes in your index/worktree')] def func(parser, options, args): stack = directory.repository.current_stack if options.number < 1: - raise common.CmdException('Bad number of commands to undo') - state = log.undo_state(stack, options.number) - trans = transaction.StackTransaction(stack, 'undo %d' % options.number, + raise common.CmdException('Bad number of undos to redo') + state = log.undo_state(stack, -options.number) + trans = transaction.StackTransaction(stack, 'redo %d' % options.number, discard_changes = options.hard) try: log.reset_stack(trans, stack.repository.default_iw, state, [])
stgit/lib/log.py +14 -5
@@ -243,13 +243,22 @@ def reset_stack(trans, iw, state, only_patches): def undo_state(stack, undo_steps): ref = log_ref(stack.name) log = Log(stack.repository, ref, stack.repository.refs.get(ref)) - while undo_steps > 0: + while undo_steps != 0: msg = log.commit.data.message.strip() - m = re.match(r'^undo\s+(\d+)$', msg) - if m: - undo_steps += int(m.group(1)) + um = re.match(r'^undo\s+(\d+)$', msg) + if undo_steps > 0: + if um: + undo_steps += int(um.group(1)) + else: + undo_steps -= 1 else: - undo_steps -= 1 + rm = re.match(r'^redo\s+(\d+)$', msg) + if um: + undo_steps += 1 + elif rm: + undo_steps -= int(rm.group(1)) + else: + raise LogException('No more redo information available') if not log.parents: raise LogException('Not enough undo information available') log = Log(stack.repository, log.parents[0].sha1, log.parents[0])
stgit/main.py +2 -0
@@ -86,6 +86,7 @@ commands = Commands({ 'pull': 'pull', 'push': 'push', 'rebase': 'rebase', + 'redo': 'redo', 'refresh': 'refresh', 'rename': 'rename', 'repair': 'repair',
@@ -123,6 +124,7 @@ stackcommands = ( 'pull', 'push', 'rebase', + 'redo', 'repair', 'reset', 'series',
t/t3104-redo.sh renamed from t/t3102-undo.sh +51 -15
115 lines not on this page · raw message
Quoted 5 lines · Karl Hasselström
kha/safe has improved version handling: "stg --version" will now
present a detailed version number just like git does:$ stg --version Stacked GIT 0.14.2.152.g77bd
Thanks, I merged this patch. I create a similar patch some weeks ago (just some naming differences and only use the id of the HEAD) but went on holiday + a conference and forgot about it. Anyway, yours looks fine but I'll modify it slightly to use just 0.14.2 if a file named ".release" exists in the working directory. I did this with my patch to allow building of release tarballs without the git information. Do you have any better suggestion?
Signature · 1 line
Catalin
Quoted 8 lines · Catalin Marinas
Quoted 5 lines · Karl Hasselström
kha/safe has improved version handling: "stg --version" will now present a detailed version number just like git does:
$ stg --version Stacked GIT 0.14.2.152.g77bd
Quoted 7 lines
Thanks, I merged this patch. I create a similar patch some weeks ago (just some naming differences and only use the id of the HEAD) but went on holiday + a conference and forgot about it. Anyway, yours looks fine but I'll modify it slightly to use just 0.14.2 if a file named ".release" exists in the working directory. I did this with my patch to allow building of release tarballs without the git information. Do you have any better suggestion?
The system I built works like this at install time:
i1. Create stgit/builtin_version.py, populated with git-describe
output.
i2. Install as usual.
And at runtime:
r1. If we have a .git directory, ask git what version we are.
(Actually, we just try to run git describe and see if it succeeds.)
r2. Otherwise, go with the built-in version (only works if
stgit/builtin_version.py exists).
Now, as to released versions, you could simply plop a suitably prepared stgit/builtin_version.py in the tarball, and it'll all work. i1 should fail silently when run from an unpacked tarball, so i2 will pick up the builtin_version.py from the tarball. And at runtime, r1 will fail and we'll fall back to r2.
Oh, and please consider making annotated release tags in the future. As is, I had to ask git-describe to look at unannotated tags as well, which won't be so good in case a developer uses those as a scratch pad while developing.
( The reason to do r1 before r2 is that otherwise an StGit tree will
"stick" with the version it had at the time the last installation was run from that tree. We might fix that if we make sure to delete builtin_version.py immediately after the installation. That's desirable since any installed version of StGit currently runs git-describe unnecessarily. )
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
2008/5/20 Karl Hasselström <[email protected]>:
Quoted 6 lines
The system I built works like this at install time:
i1. Create
stgit/builtin_version.py, populated with git-describe
output.i2. Install as usual.
Fine (with some notes for releases, see below).
Quoted 8 lines
And at runtime:
r1. If we have a .git directory, ask git what version we are.
(Actually, we just try to run git describe and see if it succeeds.)r2. Otherwise, go with the built-in version (only works if
stgit/builtin_version.pyexists).
OK.
Quoted 5 lines
Now, as to released versions, you could simply plop a suitably prepared
stgit/builtin_version.pyin the tarball, and it'll all work. i1 should fail silently when run from an unpacked tarball, so i2 will pick up thebuiltin_version.pyfrom the tarball. And at runtime, r1 will fail and we'll fall back to r2.
I build release tarball from the directory under Git control and I always get a builtin_version.py generated. In my initial patch I had a check in setup.py for a .release file. I could add a check in write_builtin_version to ignore the extra .git stuff if I am making a release (only keep the tag name).
Another alternative is to check for the number of commits from the latest tag and, if this is 0, simply ignore the Git id.
BTW, Git seems to use 6 characters for the current commit id and StGIT
5. Should we change this for consistency?
Quoted 4 lines
Oh, and please consider making annotated release tags in the future. As is, I had to ask git-describe to look at unannotated tags as well, which won't be so good in case a developer uses those as a scratch pad while developing.
I always thought annotated tags are created by default. I'll do this from now on.
Signature · 1 line
Catalin
Quoted 28 lines · Catalin Marinas
2008/5/20 Karl Hasselström <[email protected]>:
Quoted 6 lines
The system I built works like this at install time:
i1. Create
stgit/builtin_version.py, populated with git-describe
output.i2. Install as usual.
Fine (with some notes for releases, see below).
Quoted 8 lines
And at runtime:
r1. If we have a .git directory, ask git what version we are.
(Actually, we just try to run git describe and see if it succeeds.)r2. Otherwise, go with the built-in version (only works if
stgit/builtin_version.pyexists).OK.
Quoted 5 lines
Now, as to released versions, you could simply plop a suitably prepared
stgit/builtin_version.pyin the tarball, and it'll all work. i1 should fail silently when run from an unpacked tarball, so i2 will pick up thebuiltin_version.pyfrom the tarball. And at runtime, r1 will fail and we'll fall back to r2.
Quoted 5 lines
I build release tarball from the directory under Git control and I always get a
builtin_version.pygenerated. In my initial patch I had a check insetup.pyfor a .release file. I could add a check inwrite_builtin_versionto ignore the extra .git stuff if I am making a release (only keep the tag name).
Nah, easier to just change the order of the checks (try r2 before r1) as I outlined. I'll whip up a patch.
Quoted 2 lines
Another alternative is to check for the number of commits from the latest tag and, if this is 0, simply ignore the Git id.
If you're exactly on a tagged commit, git-describe will return just the name of that tag, so you don't need to do anything extra.
Quoted 2 lines
BTW, Git seems to use 6 characters for the current commit id and StGIT 5. Should we change this for consistency?
Both git and we call git-describe with --abbrev=4, which I think means "describe the commit uniquely with as few digits as possible, but no less than four". So we'll get upgraded automatically when it becomes necessary.
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
PATCH 1/1 Try the built-in version string before git-describe
Try to get the built-in version string first, and fall back to git describe if there is no built-in string, instead of the other way around. This makes computing the version string much cheaper in the common case (whenever StGit is not run directly from a git-controlled tree).
In order for this to work when StGit _is_ run directly from a git-controlled tree, setup.py has to delete the builtin version file once the installation process is over. (Otherwise, the StGit version in a git-controlled tree would be frozen at whatever value it happened to have when setup.py was last run.)
---
Quoted 2 lines · Karl Hasselström
Nah, easier to just change the order of the checks (try r2 before r1) as I outlined. I'll whip up a patch.
setup.py | 45 +++++++++++++++++++++++++-------------------- stgit/.gitignore | 1 - stgit/version.py | 15 ++++++++++++--- 3 files changed, 37 insertions(+), 24 deletions(-)
setup.py +25 -20
@@ -43,34 +43,39 @@ def __check_git_version(): % (version.git_min_ver, gitver) sys.exit(1) +def __run_setup(): + setup(name = 'stgit', + version = version.version, + license = 'GPLv2', + author = 'Catalin Marinas', + author_email = '[email protected]', + 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() __check_git_version() -version.write_builtin_version() - # ensure readable template files old_mask = os.umask(0022) -setup(name = 'stgit', - version = version.version, - license = 'GPLv2', - author = 'Catalin Marinas', - author_email = '[email protected]', - 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'))] - ) +try: + version.write_builtin_version() + __run_setup() +finally: + version.delete_builtin_version() # restore the old mask os.umask(old_mask)
stgit/.gitignore +0 -1
@@ -1,2 +1 @@ *.pyc -/builtin_version.py
stgit/version.py +12 -3
@@ -1,6 +1,6 @@ from stgit.exception import StgException from stgit import run, utils -import os.path, re, sys +import os, os.path, re, sys class VersionUnavailable(StgException): pass
@@ -31,17 +31,26 @@ def builtin_version(): else: return bv.version +def _builtin_version_file(ext = 'py'): + return os.path.join(sys.path[0], 'stgit', 'builtin_version.%s' % ext) + def write_builtin_version(): try: v = git_describe_version() except VersionUnavailable: return - f = file(os.path.join(sys.path[0], 'stgit', 'builtin_version.py'), 'w') + f = file(_builtin_version_file(), 'w') f.write('# This file was generated automatically. Do not edit by hand.\n' 'version = %r\n' % v) +def delete_builtin_version(): + for ext in ['py', 'pyc', 'pyo']: + fn = _builtin_version_file(ext) + if os.path.exists(fn): + os.remove(fn) + def get_version(): - for v in [git_describe_version, builtin_version]: + for v in [builtin_version, git_describe_version]: try: return v() except VersionUnavailable:
Re: [StGit PATCH] Try the built-in version string before git-describe
Quoted 11 lines · Karl Hasselström
Try to get the built-in version string first, and fall back to git
describe if there is no built-in string, instead of the other way around. This makes computing the version string much cheaper in the common case (whenever StGit is not run directly from a git-controlled tree).In order for this to work when StGit _is_ run directly from a git-controlled tree,
setup.pyhas to delete the builtin version file once the installation process is over. (Otherwise, the StGit version in a git-controlled tree would be frozen at whatever value it happened to have whensetup.pywas last run.)
OK, I thought it was only the ordering change. With this change to setup.py, I'm OK with the patch. I'll merge your tree tonight.
Signature · 1 line
Catalin
Re: [StGit PATCH] Try the built-in version string before git-describe
Quoted 10 lines · Catalin Marinas
Quoted 5 lines · Karl Hasselström
In order for this to work when StGit _is_ run directly from a git-controlled tree,
setup.pyhas to delete the builtin version file once the installation process is over. (Otherwise, the StGit version in a git-controlled tree would be frozen at whatever value it happened to have whensetup.pywas last run.)OK, I thought it was only the ordering change. With this change to
setup.py, I'm OK with the patch. I'll merge your tree tonight.
The change to setup.py is actually tiny. I just had to reindent a gazillion line, which makes the patch less than perfectly readable...
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
2008/5/20 Karl Hasselström <[email protected]>:
Quoted 9 lines · Catalin Marinas
Quoted 5 lines
I build release tarball from the directory under Git control and I always get a
builtin_version.pygenerated. In my initial patch I had a check insetup.pyfor a .release file. I could add a check inwrite_builtin_versionto ignore the extra .git stuff if I am making a release (only keep the tag name).Nah, easier to just change the order of the checks (try r2 before r1) as I outlined. I'll whip up a patch.
[...]
Quoted 2 lines
If you're exactly on a tagged commit, git-describe will return just the name of that tag, so you don't need to do anything extra.
Now that you mentioned this (I didn't know), is there a need to reverse steps r2 and r1? I always build the release from the current tag and the version should be clean.
Quoted 7 lines
Quoted 2 lines
BTW, Git seems to use 6 characters for the current commit id and StGIT 5. Should we change this for consistency?
Both git and we call git-describe with --abbrev=4, which I think means "describe the commit uniquely with as few digits as possible, but no less than four". So we'll get upgraded automatically when it becomes necessary.
OK, I didn't know this either.
Signature · 1 line
Catalin
Quoted 11 lines · Catalin Marinas
2008/5/20 Karl Hasselström <[email protected]>:
Quoted 2 lines
Nah, easier to just change the order of the checks (try r2 before r1) as I outlined. I'll whip up a patch.
[...]
Quoted 2 lines
If you're exactly on a tagged commit, git-describe will return just the name of that tag, so you don't need to do anything extra.
Now that you mentioned this (I didn't know), is there a need to reverse steps r2 and r1? I always build the release from the current tag and the version should be clean.
The advantage is that step r1 involves running git-describe, which is relatively expensive. With the patch I just posted, we only have to pay that cost when it's really necessary (which is when running stg directly from a git tree).
Quoted 6 lines
Quoted 4 lines
Both git and we call git-describe with --abbrev=4, which I think means "describe the commit uniquely with as few digits as possible, but no less than four". So we'll get upgraded automatically when it becomes necessary.
OK, I didn't know this either.
I only found out when I wrote the first version patch.
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle