1 from stgit
.commands
.common
import DirectoryHasRepository
, git_commit
2 from stgit
.out
import out
5 Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see http://www.gnu.org/licenses/.
20 help = 'Print the git hash value of a StGit reference'
22 usage
= ['[options] [--] [<id>]']
24 Print the SHA1 value of a Git id (defaulting to HEAD). In addition to the
25 standard Git id's like heads and tags, this command also accepts
26 '[<branch>:]<patch>' for the id of a patch and '[<branch>:]\{base\}' for the
27 base of the stack. If no branch is specified, it defaults to the current one.
28 The bottom of a patch is accessible with the '[<branch>:]<patch>^' format."""
30 args
= ['applied_patches', 'unapplied_patches', 'hidden_patches']
33 directory
= DirectoryHasRepository()
36 def func(parser
, options
, args
):
37 """Show the applied patches"""
43 parser
.error('incorrect number of arguments')
45 out
.stdout(git_commit(id_str
, directory
.repository
).sha1
)