<div class="gmail_quote">On Mon, Sep 5, 2011 at 07:56, Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div id=":161">Just want to point out that the same thing should happen with 'hg<br>
update' - or with the alternative workflow to 'hg pull --rebase' i.e<br>
'hg pull; hg merge; hg commit'<br>
<br>
i.e in all the above cases - the working files get updated by<br>
mercurial underneath emacs.</div></blockquote></div><div><br></div><div>Suppose you have a repository like this</div><br><div><div><div>@  changeset:   2:c4d14c7899e5</div><div>|  tag:         tip</div><div>|  parent:      0:c2e4f2b285da</div>
<div>|  user:        Jed Brown <jed@59A2.org></div><div>|  date:        Mon Sep 05 09:39:37 2011 +0200</div><div>|  summary:     mine</div><div>|</div><div>| o  changeset:   1:3a3076850a53</div><div>|/   user:        Jed Brown <jed@59A2.org></div>
<div>|    date:        Mon Sep 05 09:38:05 2011 +0200</div><div>|    summary:     upstream</div><div>|</div><div>o  changeset:   0:c2e4f2b285da</div><div>   user:        Jed Brown <jed@59A2.org></div><div>   date:        Mon Sep 05 09:37:40 2011 +0200</div>
<div>   summary:     initial</div></div></div><div><br></div><div>and suppose r2 makes a modification to a file present in r0 that was not changed by r1. Then we could ask for rebase to not update mtime for this file. This is not the case:</div>
<div><br></div><div><div>$ stat a</div><div>  File: `a'</div><div>  Size: 8               Blocks: 8          IO Block: 4096   regular file</div><div>Device: 806h/2054d      Inode: 1439054     Links: 1</div><div>Access: (0644/-rw-r--r--)  Uid: ( 1000/     jed)   Gid: (  100/   users)</div>
<div>Access: 2011-09-05 09:43:07.743270567 +0200</div><div>Modify: 2011-09-05 09:42:53.809936424 +0200</div><div>Change: 2011-09-05 09:42:53.809936424 +0200</div><div> Birth: -</div></div><div><div>$ hg rebase -s 2 -d 1                                                                                                                                                         </div>
<div>saved backup bundle to /tmp/repo-hg/.hg/strip-backup/a00050fc43a7-backup.hg</div></div><div><div>$ stat a</div><div>  File: `a'</div><div>  Size: 8               Blocks: 8          IO Block: 4096   regular file</div>
<div>Device: 806h/2054d      Inode: 1439054     Links: 1</div><div>Access: (0644/-rw-r--r--)  Uid: ( 1000/     jed)   Gid: (  100/   users)</div><div>Access: 2011-09-05 09:43:18.689937868 +0200</div><div>Modify: 2011-09-05 09:43:18.689937868 +0200</div>
<div>Change: 2011-09-05 09:43:18.689937868 +0200</div><div> Birth: -</div></div><div><br></div><div><br></div><div>If instead we merge, mtime is not updated:</div><div><br></div><div><div>$ stat a</div><div>  File: `a'</div>
<div>  Size: 8               Blocks: 8          IO Block: 4096   regular file</div><div>Device: 806h/2054d      Inode: 1439054     Links: 1</div><div>Access: (0644/-rw-r--r--)  Uid: ( 1000/     jed)   Gid: (  100/   users)</div>
<div>Access: 2011-09-05 09:45:52.003280085 +0200</div><div>Modify: 2011-09-05 09:45:49.719946619 +0200</div><div>Change: 2011-09-05 09:45:49.719946619 +0200</div><div> Birth: -</div></div><div><div>$ hg merge 1</div><div>
1 files updated, 0 files merged, 0 files removed, 0 files unresolved</div><div>(branch merge, don't forget to commit)</div></div><div>$ hg commit -m merge</div><div><div>$ stat a</div><div>  File: `a'</div><div>  Size: 8               Blocks: 8          IO Block: 4096   regular file</div>
<div>Device: 806h/2054d      Inode: 1439054     Links: 1</div><div>Access: (0644/-rw-r--r--)  Uid: ( 1000/     jed)   Gid: (  100/   users)</div><div>Access: 2011-09-05 09:45:52.003280085 +0200</div><div>Modify: 2011-09-05 09:45:49.719946619 +0200</div>
<div>Change: 2011-09-05 09:45:49.719946619 +0200</div><div> Birth: -</div></div><div><br></div><div><br></div><div>Sean, I was wrong in our conversation in the parking lot. Git behaves the same way:</div><div><br></div><div>
<div>$ echo aaa > a</div><div>repo-git$ git add a</div><div>repo-git$ git commit -m initial</div><div>[master (root-commit) ec625c5] initial</div><div> 1 files changed, 1 insertions(+), 0 deletions(-)</div><div> create mode 100644 a</div>
<div>master repo-git$ echo bbb > b</div><div>repo-git$ git add b</div><div>repo-git$ git commit -m upstream</div><div>[master 740d68c] upstream</div><div> 1 files changed, 1 insertions(+), 0 deletions(-)</div><div> create mode 100644 b</div>
<div>repo-git$ git checkout -b mine HEAD^</div><div>Switched to a new branch 'mine'</div><div>repo-git$ echo ccc >> a</div><div>repo-git$ git commit -am mine</div><div>[mine 6f4c2d9] mine</div><div> 1 files changed, 1 insertions(+), 0 deletions(-)</div>
<div>$ git log master</div><div>commit 740d68ca145ec28b3cf936d65827a64fe6a6682f</div><div>Author: Jed Brown <jed@59A2.org></div><div>Date:   Mon Sep 5 09:47:32 2011 +0200</div><div><br></div><div>    upstream</div><div>
<br></div><div>commit ec625c5bbc19b13ded14643a9f79cd0e99829313</div><div>Author: Jed Brown <jed@59A2.org></div><div>Date:   Mon Sep 5 09:47:21 2011 +0200</div><div><br></div><div>    initial</div><div>repo-git$ git log</div>
<div>commit 6f4c2d9d5a8a632233fc0da0139e8d4ed52c6b23</div><div>Author: Jed Brown <jed@59A2.org></div><div>Date:   Mon Sep 5 09:48:11 2011 +0200</div><div><br></div><div>    mine</div><div><br></div><div>commit ec625c5bbc19b13ded14643a9f79cd0e99829313</div>
<div>Author: Jed Brown <jed@59A2.org></div><div>Date:   Mon Sep 5 09:47:21 2011 +0200</div><div><br></div><div>    initial</div></div><div><div>repo-git$ stat a</div><div>  File: `a'</div><div>  Size: 8               Blocks: 8          IO Block: 4096   regular file</div>
<div>Device: 806h/2054d      Inode: 1439111     Links: 1</div><div>Access: (0644/-rw-r--r--)  Uid: ( 1000/     jed)   Gid: (  100/   users)</div><div>Access: 2011-09-05 09:52:46.199970753 +0200</div><div>Modify: 2011-09-05 09:52:06.809968470 +0200</div>
<div>Change: 2011-09-05 09:52:06.809968470 +0200</div><div> Birth: -</div></div><div><div>$ git rebase master</div></div><div><div>First, rewinding head to replay your work on top of it...</div><div>Applying: mine</div></div>
<div><div>$ stat a</div><div>  File: `a'</div><div>  Size: 8               Blocks: 8          IO Block: 4096   regular file</div><div>Device: 806h/2054d      Inode: 1439111     Links: 1</div><div>Access: (0644/-rw-r--r--)  Uid: ( 1000/     jed)   Gid: (  100/   users)</div>
<div>Access: 2011-09-05 09:53:00.499971581 +0200</div><div>Modify: 2011-09-05 09:53:00.496638247 +0200</div><div>Change: 2011-09-05 09:53:00.496638247 +0200</div><div> Birth: -</div></div><div><br></div><div><br></div><div>
If you do the rebasing with an Emacs mode, it should track which files are changed and update them accordingly.</div><div><br></div><div>If you don't want to set global-auto-revert-mode, you can do something like this</div>
<div><br></div><div>(global-set-key (kbd "C-x T") '(lambda () (interactive) (revert-buffer nil t))) ; revert without query</div><div><br></div><div>to reduce the interruption caused by reverting files. It all depends how tightly you like buffers to be associated with files.</div>
<div><br></div>