hg pull & co mix uncommittd changes
Goffredo Baroncelli
kreijack at libero.it
Thu Jun 30 17:21:11 UTC 2005
On Thursday 30 June 2005 03:02, Matt Mackall wrote:
> On Thu, Jun 30, 2005 at 08:52:26AM +0800, Soh Tk-r28629 wrote:
>
> > I think 'hg pull' should check and fail if the current repo contain
> > uncommitted changes. Though we can also make 'hg update' do the
> > work, 'pull' might be in the better possition. Comment?
>
> hg pull has no effect on the working directory (there may not even be
> one) so it doesn't make sense there.
>
> hg pull -u and hg update already check whether there are uncommitted
> changes and prompt you to do -m.
hg bheaves so _ONLY_ if the merge is performed between differents branchs....
The patch below adds a check that prevents the merging if -m or -f are
not passed to hg update.
diff -r 2e9698a5c92c mercurial/hg.py
--- a/mercurial/hg.py Thu Jun 30 16:47:31 2005
+++ b/mercurial/hg.py Thu Jun 30 19:19:45 2005
@@ -1167,23 +1167,25 @@
get[f] = merge[f][1]
merge = {}
+ if merge and not allow and not force:
+ self.ui.status("this update spans a branch or local changes " +
+ "affecting the following files:\n")
+ fl = merge.keys() + get.keys()
+ fl.sort()
+ for f in fl:
+ cf = ""
+ if f in merge: cf = " (resolve)"
+ self.ui.status(" %s%s\n" % (f, cf))
+ self.ui.warn("aborting update!\n")
+ self.ui.status("(use update -m to perform a merge)\n")
+ self.ui.status("(use update -c to perform a clean merge)\n")
+ return 1
+
if linear_path:
# we don't need to do any magic, just jump to the new rev
mode = 'n'
p1, p2 = p2, nullid
else:
- if not allow:
- self.ui.status("this update spans a branch" +
- " affecting the following files:\n")
- fl = merge.keys() + get.keys()
- fl.sort()
- for f in fl:
- cf = ""
- if f in merge: cf = " (resolve)"
- self.ui.status(" %s%s\n" % (f, cf))
- self.ui.warn("aborting update spanning branches!\n")
- self.ui.status("(use update -m to perform a branch merge)\n")
- return 1
# we have to remember what files we needed to get/change
# because any file that's different from either one of its
# parents must be in the changeset
--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack at inwind.it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87 87C0 BB86 505C 6B2A CFF9
More information about the Mercurial
mailing list