Commits

Jason Harris committed 4a51382

- Add --message option to specify the combined message so the collapse extension can be
used in an non-interactive mode by GUI clients.

Comments (0)

Files changed (1)

hgext/collapse.py

     collapsed = None
     
     try:
-        collapsed = makecollapsed(ui, repo, parent, revs)
+        collapsed = makecollapsed(ui, repo, parent, revs, opts)
         movemap[max(revs)] = collapsed
         movedescendants(ui, repo, collapsed, tomove, movemap)
     except:
 
     ui.status(_('collapse completed\n'))
 
-def makecollapsed(ui, repo, parent, revs):
+def makecollapsed(ui, repo, parent, revs, opts):
     'Creates the collapsed revision on top of parent'
 
     last = max(revs)
     ui.debug(_('reverting to revision %d\n') % last)
     commands.revert(ui, repo, rev=last, all=True, date=None)
     msg = ''
-
-    first = True
-    for r in revs:
-        if not first:
-            msg += '----------------\n'
-        first = False
-        msg += repo[r].description() + "\n"
-
-    msg += "\nHG: Enter commit message.  Lines beginning with 'HG:' are removed.\n"
-    msg += "HG: Remove all lines to abort the collapse operation.\n"
-
-    msg = ui.edit(msg, ui.username())
+    if opts['message'] != "" :
+		msg = opts['message']
+    else:
+		first = True
+		for r in revs:
+			if not first:
+				msg += '----------------\n'
+			first = False
+			msg += repo[r].description() + "\n"
+	
+		msg += "\nHG: Enter commit message.  Lines beginning with 'HG:' are removed.\n"
+		msg += "HG: Remove all lines to abort the collapse operation.\n"
+	
+		msg = ui.edit(msg, ui.username())
 
     if not msg:
         raise util.Abort(_('empty commit message, collapse won\'t proceed'))
         [
         ('r', 'rev', [], _('revisions to collapse')),
         ('', 'keep', False, _('keep original revisions')),
-        ('f', 'force', False, _('force collapse of changes from different users'))
+        ('f', 'force', False, _('force collapse of changes from different users')),
+        ('m', 'message', "", _('use <text> as combined commit message'))
         ],
         _('hg collapse -r REVS [--keep | --keepbranches]')),
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.