merge compat-hg2.3
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 21 Nov 2012 11:03:39 +0100
branchcompat-hg2.3
changeset 615 148bf61583f4
parent 614 b082cbe8bd79 (current diff)
parent 611 bd0f49f2ec83 (diff)
child 616 279403a12565
child 619 f50f8da7a077
merge
--- a/hgext/evolve.py	Wed Nov 21 11:03:23 2012 +0100
+++ b/hgext/evolve.py	Wed Nov 21 11:03:39 2012 +0100
@@ -1884,7 +1884,7 @@
     [('A', 'addremove', None,
      _('mark new/missing files as added/removed before committing')),
     ('n', 'note', '', _('use text as commit message for this update')),
-    ('c', 'change', '', _('specifies the changesets to amend'), _('REV')),
+    ('c', 'change', '', _('specifies the changesets to amend (DEPRECATED)'), _('REV')),
     ('e', 'edit', False, _('invoke editor on commit messages')),
     ] + walkopts + commitopts + commitopts2,
     _('[OPTION]... [FILE]...'))
--- a/hgext/qsync.py	Wed Nov 21 11:03:23 2012 +0100
+++ b/hgext/qsync.py	Wed Nov 21 11:03:39 2012 +0100
@@ -67,64 +67,67 @@
     except error.RepoLookupError:
         parent = initqsubmit(mqrepo)
     store, data, touched = fillstore(repo, parent)
-    if not touched:
-        raise util.Abort('Nothing changed')
-    files = ['qsubmitdata', 'series'] + touched
-    # mark some as ready for review
-    message = 'qsubmit commit\n\n'
-    review_list = []
-    applied_list = []
-    if review:
-        olddata = get_old_data(parent)
-        oldfiles = dict([(name, bin(ctxhex)) for ctxhex, name in olddata])
+    try:
+        if not touched:
+            raise util.Abort('Nothing changed')
+        files = ['qsubmitdata', 'series'] + touched
+        # mark some as ready for review
+        message = 'qsubmit commit\n\n'
+        review_list = []
+        applied_list = []
+        if review:
+            olddata = get_old_data(parent)
+            oldfiles = dict([(name, bin(ctxhex)) for ctxhex, name in olddata])
 
-        for patch_name in touched:
-            try:
-                store.getfile(patch_name)
-                review_list.append(patch_name)
-            except IOError:
-                oldnode = oldfiles[patch_name]
-                evolve = extensions.find('evolve')
-                newnodes = evolve.successorssets(repo, oldnode)
-                if newnodes:
-                    newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing
-                if not newnodes:
-                    # changeset has been killed (eg. reject)
-                    pass
-                else:
-                    assert len(newnodes) == 1 # conflict!!!
-                    newnode = newnodes[0]
-                    assert len(newnode) == 1 # split unsupported for now
-                    newnode = list(newnode)[0]
-                    # XXX unmanaged case where a cs is obsoleted by an unavailable one
-                    #if newnode.node() not in repo.changelog.nodemap:
-                    #    raise util.Abort('%s is obsoleted by an unknown node %s'% (oldnode, newnode))
-                    ctx = repo[newnode]
-                    if ctx.phase() == phases.public:
-                        # applied
-                        applied_list.append(patch_name)
-                    elif ctx.phase() == phases.secret:
-                        # already exported changeset is now secret
-                        repo.ui.warn("An already exported changeset is now secret!!!")
+            for patch_name in touched:
+                try:
+                    store.getfile(patch_name)
+                    review_list.append(patch_name)
+                except IOError:
+                    oldnode = oldfiles[patch_name]
+                    evolve = extensions.find('evolve')
+                    newnodes = evolve.successorssets(repo, oldnode)
+                    if newnodes:
+                        newnodes = [n for n in newnodes if n and n[0] in repo] # remove killing
+                    if not newnodes:
+                        # changeset has been killed (eg. reject)
+                        pass
                     else:
-                        # draft
-                        assert False, "Should be exported"
+                        assert len(newnodes) == 1 # conflict!!!
+                        newnode = newnodes[0]
+                        assert len(newnode) == 1 # split unsupported for now
+                        newnode = list(newnode)[0]
+                        # XXX unmanaged case where a cs is obsoleted by an unavailable one
+                        #if newnode.node() not in repo.changelog.nodemap:
+                        #    raise util.Abort('%s is obsoleted by an unknown node %s'% (oldnode, newnode))
+                        ctx = repo[newnode]
+                        if ctx.phase() == phases.public:
+                            # applied
+                            applied_list.append(patch_name)
+                        elif ctx.phase() == phases.secret:
+                            # already exported changeset is now secret
+                            repo.ui.warn("An already exported changeset is now secret!!!")
+                        else:
+                            # draft
+                            assert False, "Should be exported"
 
-    if review:
-        if applied_list:
-            message += '\n'.join('* applied %s' % x for x in applied_list) + '\n'
-        if review_list:
-            message += '\n'.join('* %s ready for review' % x for x in review_list) + '\n'
-    memctx = patch.makememctx(mqrepo, (parent.node(), nullid),
-                              message,
-                              None,
-                              None,
-                              parent.branch(), files, store,
-                              editor=None)
-    if review == 'edit':
-        memctx._text = cmdutil.commitforceeditor(mqrepo, memctx, [])
-    mqrepo.savecommitmessage(memctx.description())
-    n = memctx.commit()
+        if review:
+            if applied_list:
+                message += '\n'.join('* applied %s' % x for x in applied_list) + '\n'
+            if review_list:
+                message += '\n'.join('* %s ready for review' % x for x in review_list) + '\n'
+        memctx = patch.makememctx(mqrepo, (parent.node(), nullid),
+                                  message,
+                                  None,
+                                  None,
+                                  parent.branch(), files, store,
+                                  editor=None)
+        if review == 'edit':
+            memctx._text = cmdutil.commitforceeditor(mqrepo, memctx, [])
+        mqrepo.savecommitmessage(memctx.description())
+        n = memctx.commit()
+    finally:
+        store.close()
     return 0
 
 
@@ -237,8 +240,9 @@
         # export data to ease futur work
         store.setfile('qsubmitdata', json.dumps(data, indent=True),
                       (False, False))
-    finally:
+    except:
         store.close()
+	raise
     return store, data, touched