# HG changeset patch # User mpm@selenic.com # Date 1120454080 28800 # Node ID 94744f6fe0e7c19b10fab7eb24249f3eeaa5489a # Parent ea4526f9b1a5928029ee1d391d83a84b9d883f7d [PATCH] Parse and use header data from an hg export'ed changeset -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Parse and use header data from an hg export'ed changeset From: Andrew Thompson This should make it easier to import changesets that are hg export'ed from other Mercurial users: Add a routine to catch the user from an hg export'ed changeset. Add user to commit call. Add trap for changelog snippet, which is promoted to the beginning of the commit text. manifest hash: cf5b068f4cec411ff8b9fa3db324ab44ed012778 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCyMXAywK+sNU5EO8RAqk5AJ9rC4ZwzcpDfxrNqIBrrTj6eL2mzQCgmZ5O wSkis2J9Xz2wOZAhjVcxIgQ= =32D+ -----END PGP SIGNATURE----- diff -r ea4526f9b1a5 -r 94744f6fe0e7 mercurial/commands.py --- a/mercurial/commands.py Sun Jul 03 20:52:41 2005 -0800 +++ b/mercurial/commands.py Sun Jul 03 21:14:40 2005 -0800 @@ -586,6 +586,20 @@ if l[:4] == "--- ": break text += l + # parse values that exist when importing the result of an hg export + hgpatch = user = snippet = None + ui.debug('text:\n') + for t in text.splitlines(): + ui.debug(t,'\n') + if t == '# HG changeset patch' or hgpatch == True: + hgpatch = True + if t[:7] == "# User ": + user = t[7:] + ui.debug('User: %s\n' % user) + if t[:2] <> "# " and t.strip() and not snippet: snippet = t + if snippet: text = snippet + '\n' + text + ui.debug('text:\n%s\n' % text) + # make sure text isn't empty if not text: text = "imported patch %s\n" % patch @@ -605,7 +619,7 @@ if len(files) > 0: addremove(ui, repo, *files) - repo.commit(files, text) + repo.commit(files, text, user) def init(ui, source=None): """create a new repository in the current directory"""