mercurial/commands.py
changeset 289 266396e32006
parent 286 bd9d1e93f8d6
child 290 07c6cb9fd1c5
equal deleted inserted replaced
288:97c87ac6d7a4 289:266396e32006
   163     r = repo.file(relpath(repo, [file])[0])
   163     r = repo.file(relpath(repo, [file])[0])
   164     n = r.tip()
   164     n = r.tip()
   165     if rev: n = r.lookup(rev)
   165     if rev: n = r.lookup(rev)
   166     sys.stdout.write(r.read(n))
   166     sys.stdout.write(r.read(n))
   167 
   167 
   168 def commit(ui, repo, *files):
   168 def commit(ui, repo, *files, **opts):
   169     """commit the specified files or all outstanding changes"""
   169     """commit the specified files or all outstanding changes"""
   170     repo.commit(relpath(repo, files))
   170     text = opts['text']
       
   171     if not text and opts['logfile']:
       
   172         try: text = open(opts['logfile']).read()
       
   173         except IOError: pass
       
   174 
       
   175     repo.commit(relpath(repo, files), text)
   171 
   176 
   172 def debugaddchangegroup(ui, repo):
   177 def debugaddchangegroup(ui, repo):
   173     data = sys.stdin.read()
   178     data = sys.stdin.read()
   174     repo.addchangegroup(data)
   179     repo.addchangegroup(data)
   175 
   180 
   479                       ('n', 'number', None, 'show revision number'),
   484                       ('n', 'number', None, 'show revision number'),
   480                       ('c', 'changeset', None, 'show changeset')],
   485                       ('c', 'changeset', None, 'show changeset')],
   481                      'hg annotate [-u] [-c] [-n] [-r id] [files]'),
   486                      'hg annotate [-u] [-c] [-n] [-r id] [files]'),
   482     "branch|clone": (branch, [], 'hg branch [path]'),
   487     "branch|clone": (branch, [], 'hg branch [path]'),
   483     "cat|dump": (cat, [], 'hg cat <file> [rev]'),
   488     "cat|dump": (cat, [], 'hg cat <file> [rev]'),
   484     "commit|ci": (commit, [], 'hg commit [files]'),
   489     "commit|ci": (commit,
       
   490                   [('t', 'text', "", 'commit text'),
       
   491                    ('l', 'logfile', "", 'commit text file')],
       
   492                   'hg commit [files]'),
   485     "debugaddchangegroup": (debugaddchangegroup, [], 'debugaddchangegroup'),
   493     "debugaddchangegroup": (debugaddchangegroup, [], 'debugaddchangegroup'),
   486     "debugchangegroup": (debugchangegroup, [], 'debugchangegroup [roots]'),
   494     "debugchangegroup": (debugchangegroup, [], 'debugchangegroup [roots]'),
   487     "debugindex": (debugindex, [], 'debugindex <file>'),
   495     "debugindex": (debugindex, [], 'debugindex <file>'),
   488     "debugindexdot": (debugindexdot, [], 'debugindexdot <file>'),
   496     "debugindexdot": (debugindexdot, [], 'debugindexdot <file>'),
   489     "diff": (diff, [('r', 'rev', [], 'revision')],
   497     "diff": (diff, [('r', 'rev', [], 'revision')],