##// END OF EJS Templates
import: refactor nocommit and importbranch handling
timeless -
r27613:dffd2ed9 default
parent child Browse files
Show More
@@ -877,6 +877,8 b' def tryimportone(ui, repo, hunk, parents'
877 p1 = extractdata.get('p1')
877 p1 = extractdata.get('p1')
878 p2 = extractdata.get('p2')
878 p2 = extractdata.get('p2')
879
879
880 nocommit = opts.get('no_commit')
881 importbranch = opts.get('import_branch')
880 update = not opts.get('bypass')
882 update = not opts.get('bypass')
881 strip = opts["strip"]
883 strip = opts["strip"]
882 prefix = opts["prefix"]
884 prefix = opts["prefix"]
@@ -931,7 +933,7 b' def tryimportone(ui, repo, hunk, parents'
931 if p2 != parents[1]:
933 if p2 != parents[1]:
932 repo.setparents(p1.node(), p2.node())
934 repo.setparents(p1.node(), p2.node())
933
935
934 if opts.get('exact') or opts.get('import_branch'):
936 if opts.get('exact') or importbranch:
935 repo.dirstate.setbranch(branch or 'default')
937 repo.dirstate.setbranch(branch or 'default')
936
938
937 partial = opts.get('partial', False)
939 partial = opts.get('partial', False)
@@ -946,7 +948,7 b' def tryimportone(ui, repo, hunk, parents'
946 rejects = True
948 rejects = True
947
949
948 files = list(files)
950 files = list(files)
949 if opts.get('no_commit'):
951 if nocommit:
950 if message:
952 if message:
951 msgs.append(message)
953 msgs.append(message)
952 else:
954 else:
@@ -977,7 +979,7 b' def tryimportone(ui, repo, hunk, parents'
977 finally:
979 finally:
978 repo.ui.restoreconfig(allowemptyback)
980 repo.ui.restoreconfig(allowemptyback)
979 else:
981 else:
980 if opts.get('exact') or opts.get('import_branch'):
982 if opts.get('exact') or importbranch:
981 branch = branch or 'default'
983 branch = branch or 'default'
982 else:
984 else:
983 branch = p1.branch()
985 branch = p1.branch()
@@ -1002,7 +1004,7 b' def tryimportone(ui, repo, hunk, parents'
1002 n = memctx.commit()
1004 n = memctx.commit()
1003 finally:
1005 finally:
1004 store.close()
1006 store.close()
1005 if opts.get('exact') and opts.get('no_commit'):
1007 if opts.get('exact') and nocommit:
1006 # --exact with --no-commit is still useful in that it does merge
1008 # --exact with --no-commit is still useful in that it does merge
1007 # and branch bits
1009 # and branch bits
1008 ui.warn(_("warning: can't check exact import with --no-commit\n"))
1010 ui.warn(_("warning: can't check exact import with --no-commit\n"))
General Comments 0
You need to be logged in to leave comments. Login now