Skip to content
Snippets Groups Projects
Commit 75e7d4a0 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

record: access status fields by name rather than index

It is safe to pass the full status to patch.diff() since it does its
own slicing.
parent e049338d
No related branches found
No related tags found
No related merge requests found
...@@ -519,8 +519,8 @@ ...@@ -519,8 +519,8 @@
raise util.Abort(_('cannot partially commit a merge ' raise util.Abort(_('cannot partially commit a merge '
'(use "hg commit" instead)')) '(use "hg commit" instead)'))
changes = repo.status(match=match)[:3] status = repo.status(match=match)
diffopts = opts.copy() diffopts = opts.copy()
diffopts['nodates'] = True diffopts['nodates'] = True
diffopts['git'] = True diffopts['git'] = True
diffopts = patch.diffopts(ui, opts=diffopts) diffopts = patch.diffopts(ui, opts=diffopts)
...@@ -523,8 +523,8 @@ ...@@ -523,8 +523,8 @@
diffopts = opts.copy() diffopts = opts.copy()
diffopts['nodates'] = True diffopts['nodates'] = True
diffopts['git'] = True diffopts['git'] = True
diffopts = patch.diffopts(ui, opts=diffopts) diffopts = patch.diffopts(ui, opts=diffopts)
chunks = patch.diff(repo, changes=changes, opts=diffopts) chunks = patch.diff(repo, changes=status, opts=diffopts)
fp = cStringIO.StringIO() fp = cStringIO.StringIO()
fp.write(''.join(chunks)) fp.write(''.join(chunks))
fp.seek(0) fp.seek(0)
...@@ -544,9 +544,9 @@ ...@@ -544,9 +544,9 @@
except AttributeError: except AttributeError:
pass pass
changed = changes[0] + changes[1] + changes[2] changed = status.modified + status.added + status.removed
newfiles = [f for f in changed if f in contenders] newfiles = [f for f in changed if f in contenders]
if not newfiles: if not newfiles:
ui.status(_('no changes to record\n')) ui.status(_('no changes to record\n'))
return 0 return 0
...@@ -548,9 +548,9 @@ ...@@ -548,9 +548,9 @@
newfiles = [f for f in changed if f in contenders] newfiles = [f for f in changed if f in contenders]
if not newfiles: if not newfiles:
ui.status(_('no changes to record\n')) ui.status(_('no changes to record\n'))
return 0 return 0
modified = set(changes[0]) modified = set(status.modified)
# 2. backup changed files, so we can restore them in the end # 2. backup changed files, so we can restore them in the end
if backupall: if backupall:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment