hgext/evolve.py
branchstable
changeset 716 4c0f6d555032
parent 715 070bbbb0e6f2
child 722 4e7e7a7d8500
--- a/hgext/evolve.py	Mon Feb 11 09:21:11 2013 +0000
+++ b/hgext/evolve.py	Mon Feb 11 09:21:22 2013 +0000
@@ -829,6 +829,13 @@
 #############################
 cmdtable = {}
 command = cmdutil.command(cmdtable)
+metadataopts = [
+    ('d', 'date', '',
+     _('record the specified date in metadata'), _('DATE')),
+    ('u', 'user', '',
+     _('record the specified user in metadata'), _('USER')),
+]
+
 
 @command('^evolve|stabilize|solve',
     [('n', 'dry-run', False, 'do not perform actions, print what to be done'),
@@ -1272,15 +1279,26 @@
     marks.write()
     ui.write(_("bookmark '%s' deleted\n") % mark)
 
+
+
+def _getmetadata(**opts):
+    metadata = {}
+    date = opts.get('date')
+    user = opts.get('user')
+    if date and '0 0' != date:
+        metadata['date'] = '%i %i' % util.parsedate(date)
+    if user:
+        metadata['user'] = user
+    return metadata
+
+
 @command('^prune|obsolete|kill',
     [('n', 'new', [], _("successor changeset (DEPRECATED)")),
      ('s', 'succ', [], _("successor changeset")),
      ('r', 'rev', [], _("revisions to prune")),
      ('B', 'bookmark', '', _("remove revs only reachable from given"
-                             " bookmark"))],
+                             " bookmark"))] + metadataopts,
     _('[OPTION] [-r] REV...'))
-    # -d --date
-    # -u --user
     # -U  --noupdate option to prevent wc update and or bookmarks update ?
 def cmdprune(ui, repo, *revs, **opts):
     """get rid of changesets by marking them obsolete
@@ -1299,6 +1317,7 @@
     revs = set(scmutil.revrange(repo, list(revs) + opts.get('rev')))
     succs = opts['new'] + opts['succ']
     bookmark = opts.get('bookmark')
+    metadata = _getmetadata(**opts)
 
     if bookmark:
         marks,revs = _reachablefrombookmark(repo, revs, bookmark)
@@ -1332,7 +1351,8 @@
             msg = "Can't use multiple successors for multiple precursors"
             raise util.Abort(msg)
         # create markers
-        createmarkers(repo, [(p, sucs) for p in precs])
+        createmarkers(repo, [(p, sucs) for p in precs], metadata=metadata)
+
         # informs that changeset have been pruned
         ui.status(_('%i changesets pruned\n') % len(precs))
         # update to an unkilled parent
@@ -1383,6 +1403,7 @@
 
     # determine updates to subsume
     old = scmutil.revsingle(repo, '.')
+    metadata = _getmetadata(**opts)
 
     lock = repo.lock()
     try: