-from stgit import stack, git
-
-
-help = 'pull the changes from the remote repository'
-usage = """%prog [options] [<repository>] [<refspec>]
-
-Pull the latest changes from the given repository (defaulting to
-'origin'). This command works by popping all the patches from the
-stack, pulling the changes in the parent repository, setting the base
-of the stack to the latest parent HEAD and pushing the patches back
-(unless '--nopush' is specified). The 'push' operation can fail if
-there are conflicts. They need to be resolved and the patch pushed
-again.
-
-Check the 'git pull' documentation for the <repository> and <refspec>
-format."""
-
-options = [make_option('-n', '--nopush',
- help = 'do not push the patches back after pulling',
- action = 'store_true'),
- make_option('-m', '--merged',
- help = 'check for patches merged upstream',
- action = 'store_true')]
+from stgit.out import *
+from stgit.config import GitConfigException
+from stgit import argparse, stack, git
+
+help = 'Pull changes from a remote repository'
+kind = 'stack'
+usage = ['[options] [<repository>]']
+description = """
+Pull the latest changes from the given remote repository (defaulting
+to branch.<name>.remote, or 'origin' if not set). This command works
+by popping all the patches from the stack, pulling the changes in the
+parent repository, setting the base of the stack to the latest parent
+HEAD and pushing the patches back (unless '--nopush' is specified).
+The 'push' operation can fail if there are conflicts. They need to be
+resolved and the patch pushed again.
+
+Check the 'git fetch' documentation for the <repository> format."""
+
+args = [argparse.repo]
+options = [
+ opt('-n', '--nopush', action = 'store_true',
+ short = 'Do not push the patches back after pulling'),
+ opt('-m', '--merged', action = 'store_true',
+ short = 'Check for patches merged upstream')]
+
+directory = DirectoryGotoToplevel(log = True)