Discussion:
hg import when there are uncommitted changes
Dan Christensen
2005-07-17 01:54:19 UTC
Permalink
I was a bit surprised to find that if I have uncommitted changes in
the working directory, and I run "hg import file.patch", my
uncommitted changes are committed along with the changes in the
patch. I expected behaviour more like "hg pull", which applies the
changes to the repository, so I would then have to "hg update" and
the merge would get recorded as a separate piece of history.

Alternatively, "hg import" could just abort if there are uncommitted
changes, unless given a "--force" flag.

Is the current "hg import" behaviour intentional?

Dan
Kevin Smith
2005-07-17 03:25:22 UTC
Permalink
Post by Dan Christensen
I was a bit surprised to find that if I have uncommitted changes in
the working directory, and I run "hg import file.patch", my
uncommitted changes are committed along with the changes in the
patch. I expected behaviour more like "hg pull", which applies the
changes to the repository, so I would then have to "hg update" and
the merge would get recorded as a separate piece of history.
Alternatively, "hg import" could just abort if there are uncommitted
changes, unless given a "--force" flag.
Strong agreement here. I think I would prefer the latter option, but I
don't have enough experience to be sure.

Kevin
Matt Mackall
2005-07-17 04:05:13 UTC
Permalink
Post by Kevin Smith
Post by Dan Christensen
I was a bit surprised to find that if I have uncommitted changes in
the working directory, and I run "hg import file.patch", my
uncommitted changes are committed along with the changes in the
patch. I expected behaviour more like "hg pull", which applies the
changes to the repository, so I would then have to "hg update" and
the merge would get recorded as a separate piece of history.
Alternatively, "hg import" could just abort if there are uncommitted
changes, unless given a "--force" flag.
Strong agreement here. I think I would prefer the latter option, but I
don't have enough experience to be sure.
Well we pretty much depend on running patch for import, so it has to
be against the working directory. But yes, this probably needs a force
switch.
--
Mathematics is the supreme nostalgia of our time.
Mark Williamson
2005-07-17 23:21:20 UTC
Permalink
Post by Matt Mackall
Well we pretty much depend on running patch for import, so it has to
be against the working directory. But yes, this probably needs a force
switch.
Would it be possible to create a temporary checkout of the last changeset in
some temp directory, then patch and commit that?

Alternatively, there could be a "Current changes exist" warning when doing an
import.

Cheers,
Mark
Matt Mackall
2005-07-18 04:16:27 UTC
Permalink
Post by Mark Williamson
Post by Matt Mackall
Well we pretty much depend on running patch for import, so it has to
be against the working directory. But yes, this probably needs a force
switch.
Would it be possible to create a temporary checkout of the last changeset in
some temp directory, then patch and commit that?
Yes. With hg clone.
--
Mathematics is the supreme nostalgia of our time.
TK Soh
2005-07-17 04:11:07 UTC
Permalink
Post by Kevin Smith
Post by Dan Christensen
I was a bit surprised to find that if I have uncommitted changes in
the working directory, and I run "hg import file.patch", my
uncommitted changes are committed along with the changes in the
patch. I expected behaviour more like "hg pull", which applies the
changes to the repository, so I would then have to "hg update" and
the merge would get recorded as a separate piece of history.
Alternatively, "hg import" could just abort if there are uncommitted
changes, unless given a "--force" flag.
Strong agreement here. I think I would prefer the latter option, but I
don't have enough experience to be sure.
I feel that import should also behave like the pull command, which only adds
the changesets without updating the working files unless -u is specified.

I probably won't mind if someone bank in the money for me without tell me, but
not with my changes ;-)




____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
Matt Mackall
2005-08-20 07:08:45 UTC
Permalink
Post by Dan Christensen
I was a bit surprised to find that if I have uncommitted changes in
the working directory, and I run "hg import file.patch", my
uncommitted changes are committed along with the changes in the
patch. I expected behaviour more like "hg pull", which applies the
changes to the repository, so I would then have to "hg update" and
the merge would get recorded as a separate piece of history.
Alternatively, "hg import" could just abort if there are uncommitted
changes, unless given a "--force" flag.
Done.
--
Mathematics is the supreme nostalgia of our time.
Loading...