Commits

Josh VanderLinden committed aac0b0d

Created a new extension that allows you to push to all of the paths in a repo's config

  • Participants
  • Parent commits 6462103

Comments (0)

Files changed (2)

+from mercurial import commands
+
+def multi_push(ui, repo, **opts):
+    """Pushes changesets out to all repos listed in the [paths] section of the config"""
+
+    for name, location in ui.configitems('paths'):
+        commands.push(ui, repo, location, **opts)
+
+cmdtable = {
+    '^mpush': (multi_push, 
+    commands.table['^push'][1], 
+    commands.table['^push'][2].replace('[DEST]', ''))
+}
 
 LOG_KEY = '^log|history'
 SERVE_KEY = '^serve'
+PUSH_KEY = '^push'
 
 def_prop = lambda k, i: commands.table[k][i]
 
     q = qrepo(ui, repo)
     commands.log(ui, q, **opts)
 
+def pushq(ui, repo, dest=None, **opts):
+    """Runs the hg push command for the patch queue repo of a regular repo"""
+
+    q = qrepo(ui, repo)
+    commands.push(ui, hg.repository(q.path), dest, **opts)
+
 def qserve(ui, repo, **opts):
     """Runs hg serve for the patch queue repository of a regular repo"""
     q = qrepo(ui, repo)
 
 cmdtable = {
     'qlog': (qlog, def_prop(LOG_KEY, 1), def_prop(LOG_KEY, 2)),
+    'pushq': (pushq, def_prop(PUSH_KEY, 1), def_prop(PUSH_KEY, 2)),
     'qserve': (qserve, def_prop(SERVE_KEY, 1), def_prop(SERVE_KEY, 2)),
     'qreorder': (qreorder, [], 'hg qreorder NEW_POSITION [PATCH]'),
 }