Add "stg id" support for "{public}" ref
[stgit] / stgit / commands / id.py
index 3819acc..654ff72 100644 (file)
@@ -15,24 +15,28 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 """
 
-from optparse import OptionParser, make_option
-
 from stgit.out import out
 from stgit.commands import common
 from stgit.lib import stack
-
-help = 'print the GIT hash value of a StGIT reference'
-usage = """%prog [options] [id]
-
-Print the SHA1 value of a Git id (defaulting to HEAD). In addition to
-the standard Git id's like heads and tags, this command also accepts
-'[<branch>:]<patch>' and '[<branch>:]{base}' showing the id of a patch
-or the base of the stack. If no branch is specified, it defaults to the
-current one. The bottom of a patch is accessible with the
-'[<branch>:]<patch>^' format."""
+from stgit import argparse
+
+help = 'Print the git hash value of a StGit reference'
+kind = 'repo'
+usage = ['[options] [id]']
+description = """
+Print the SHA1 value of a Git id (defaulting to HEAD). In addition to the
+standard Git id's like heads and tags, this command also accepts
+'[<branch>:]<patch>' for the id of a patch, '[<branch>:]\{base\}' for the base
+of the stack and '[<branch>:]\{public\}' for the public branch corresponding
+to the stack (see the 'publish' command for details). If no branch is
+specified, it defaults to the current one. The bottom of a patch is accessible
+with the '[<branch>:]<patch>^' format."""
+
+args = [argparse.applied_patches, argparse.unapplied_patches,
+        argparse.hidden_patches]
+options = []
 
 directory = common.DirectoryHasRepositoryLib()
-options = []
 
 def func(parser, options, args):
     """Show the applied patches