##// END OF EJS Templates
graft: reuse --user and --date values in `hg graft --continue` (BC)...
graft: reuse --user and --date values in `hg graft --continue` (BC) Reading the user and date information from graftstate during `hg graft --continue` will help us in preserving the user and date arguments passed when `hg graft` was called. This patch reads that information and reuses that while running `hg graft --continue`. So after this patch, --user and --date values are preserved even if conflicts occur and user don't need to pass them again. The test changes demonstrate the fix. This is a backward incompatible change but I think of this more as a bug fix. Also thinking about removing the line from `hg help graft` which says --continue does not reapply other flags but need to check what are the other flags which needs to be preserved. Differential Revision: https://phab.mercurial-scm.org/D3659

File last commit:

r31050:20653270 default
r38171:decdb587 default
Show More
txnutil.py
36 lines | 1.0 KiB | text/x-python | PythonLexer
# txnutil.py - transaction related utilities
#
# Copyright FUJIWARA Katsunori <foozy@lares.dti.ne.jp> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import errno
from . import (
encoding,
)
def mayhavepending(root):
'''return whether 'root' may have pending changes, which are
visible to this process.
'''
return root == encoding.environ.get('HG_PENDING')
def trypending(root, vfs, filename, **kwargs):
'''Open file to be read according to HG_PENDING environment variable
This opens '.pending' of specified 'filename' only when HG_PENDING
is equal to 'root'.
This returns '(fp, is_pending_opened)' tuple.
'''
if mayhavepending(root):
try:
return (vfs('%s.pending' % filename, **kwargs), True)
except IOError as inst:
if inst.errno != errno.ENOENT:
raise
return (vfs(filename, **kwargs), False)