Patchwork D6835: phabricator: don't abort if property writing fails during amending

login
register
mail settings
Submitter phabricator
Date Sept. 9, 2019, 9:18 p.m.
Message ID <differential-rev-PHID-DREV-frtfjr4vvn7axnwktzxv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41600/
State Superseded
Headers show

Comments

phabricator - Sept. 9, 2019, 9:18 p.m.
Kwan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Currently if one of the writediffproperty calls fails due to network issues
  during the amending of commit messages to include the Diff. Rev. line, the
  transaction is aborted and rolled back.  This means that the associations
  between the commits and the DREVs are lost for any already amended commits
  because the removal of the local tags isn't covered by the rollback.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6835

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -659,7 +659,12 @@ 
 
                     mapping[old.node()] = [newnode]
                     # Update diff property
-                    writediffproperties(unfi[newnode], diffmap[old.node()])
+                    # If it fails just warn and keep going, otherwise the DREV
+                    # associations will be lost
+                    try:
+                        writediffproperties(unfi[newnode], diffmap[old.node()])
+                    except util.urlerr.urlerror:
+                        ui.warn(b'Failed to update metadata for D%s\n' % drevid)
                 # Remove local tags since it's no longer necessary
                 tagname = b'D%d' % drevid
                 if tagname in repo.tags():