Please help me merge the heads that I didn't want in the first place:
C:\Users\hg\>hg push
pushing to https://usernm#bitbucket.org/zzz/yyy
http authorization required
realm: Bitbucket.org HTTP
user:
password:
searching for changes
abort: push creates new remote head 841acfa3a36b!
(merge or see "hg help push" for details about pushing new heads)
C:\Users\hg\m>hg merge
abort: uncommitted changes
(use 'hg status' to list changes)
C:\Users\hg\>
C:\Users\hg>hg commit -m " merge"
nothing changed (12 missing files, see 'hg status')
C:\Users\hg\>hg status
! montaoproject\common\__init__.pyc
! montaoproject\common\templatefilters.pyc
! montaoproject\conf\__init__.pyc
! montaoproject\conf\settings.pyc
! montaoproject\static\img\github.png
! montaoproject\static\img\index_in2.png
! montaoproject\static\img\openid.png
! montaoproject\static\pakistan-reg_files\wikimedia-button.png
! montaoproject\wtforms\ext\__init__.pyc
! montaoproject\wtforms\ext\appengine\__init__.pyc
! montaoproject\wtforms\ext\appengine\db.pyc
! montaoproject\wtforms\ext\appengine\fields.pyc
? .idea\.name
outstanding uncommitted changes in repository C:/Users/hg/, not merging with pulled head
abort: uncommitted changes
Tells you in clean English: you must commit before merge
Try this:
hg push -f -r Number_Rev
Related
I created new branch BRANCH1 from default. Made some changes. And i can not hg push --new-branch. How to push it ? Without using hg push -f ?
That is the error
$ hg push --new-branch
pushing to ssh://hg#bitbucket.org/BLABLA
searching for changes
abort: push creates new remote head 124786qssdvfsd12 on branch 'BRANCH2'!
(merge or see "hg help push" for details about pushing new heads)
Not sure what is the issue exactly, but I suggest that you try to push the head from the earlier message:
hg push -r 124786qssdvfsd12
If this command runs successfully, then you should try again:
hg push --new-branch
The problem here is that hg' workflow apparently leads in a circle:
hg pull, get another head
hg merge, get warned of outstanding
uncommitted changes
hg commit -m "pre merge commit", get message
saying nothing changed
go to 2 hg status, see output like the
following:
! #foo.py#
? junk.out
? junk2.out
If foo.py is in your list of .hg-ignore'd files try specifying it explicity on the command line when you commit.
e.g.
hg commit -m "commit message" ./#foo.py
edit: looking more closely at your error: the file has been deleted (! in the status list), but hg hasn't tracked the deletion. You need to tell hg about the deletion using:
hg rm -A ./foo.py
The -A / --after means record the removal after it actually occured
I'm new to Mercurial. I did hg status and I saw the files that changed since the last commit have M in front. I then tried hg update -C. Is there any way I can get back the version of the files with M before I did hg update -C? Or am I pretty much screwed? :( since hg update -C discards any changes since the last commit
Unfortunately, it's right there in hg help update:
options:
-C --clean discard uncommitted changes (no backup)
The proper workflow would have been to commit your outstanding changes (which would presumably create a new head) and merge your commit with the revisions you wanted to import.
If you don't like having to commit a half-baked set of changes, check out the shelve extension, which is designed exactly for this: It temporarily puts aside all or some of your uncommitted changes, allowing you to run hg operations before you bring them back again. (shelve is not distributed with mercurial, but I think tortoisehg may include it).
Well, let's take a look:
PS C:\dev> hg init foo
PS C:\dev> cd .\foo
PS C:\dev\foo> echo ":)" > file.txt
PS C:\dev\foo> hg add
adding file.txt
PS C:\dev\foo> hg com -m ":D"
PS C:\dev\foo> echo "DDDD" >> .\file.txt
PS C:\dev\foo> hg sta
M file.txt
PS C:\dev\foo> hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
PS C:\dev\foo> hg sta
PS C:\dev\foo> dir
Directory: C:\dev\foo
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 5/14/2013 4:06 PM .hg
-a--- 5/14/2013 4:06 PM 10 file.txt
PS C:\dev\foo> type .\file.txt
:)
It's gone. :( Sorry for the bad news!
Some IDE's, like Intellij will separate from version control keep track of "Local History" I would check for that in a case like this.
Quite late answer for Jason, but may help the others.
We had the same problem and FOUND A SOLUTION here...
In brief:
type hg heads - you will see head of your changes is stil somewhere in the repository
copy ID of your head and type hg update <id_of_your_head>
For those of you that use Mercurial with the MQ extension:
This is the second time I accidentally submit changes to the central repository (hg push) instead of applying a patch to my working directory (hg qpush).
I think this is very unfortunate, because it is a very simple error to make and has very severe consequences (the least having to do a hg backout and an extra hg push for each submitted change in order to generate a new commit that "undoes" the las one to the central repository, but the history becomes convoluted and unpleasant.
My goal is to configure some alias or something in my environment in orden to make hg push harder to do by accident.
Do you have any suggestions? I was thinking something like:
[alias]
push= <-- how to NOP the push command??
pushtoserver=push
As this is a completely subjective question, this goes as community wiki.
thanks!
some vague ideas:
you could remove the default push location from your repo
you could write a "did you mean qpush? yes, no" pre-push hook
This hook (bash command line) asks for confirmation before pushing changes to the remote (tested with mercurial 1.4):
[hooks]
preoutgoing.confirm = read -p 'Are you sure you want to push to remote? (y/n): '; echo $REPLY | grep -q 'y'
you could alias push to qpush and alias pushtoserver to push (i think this works but can't try it now)
Put the following in your .hgrc:
[alias]
pushtoserver = push
push = 'Did you mean qpush or pushtoserver?'
Works like this:
$ hg push
alias 'push' resolves to unknown command 'Did you mean qpush or pushtoserver?'
$ hg pushtoserver
abort: repository default-push not found!
See also the alias section of the hgrc manpage.
I just started my first Mercurial project.
I did a 'cd' into my source directory.
Then I did this:
hg init myproject
But next I did
hg commit -m "first commit"
And all it reports is:
nothing changed
But when I do
hg status
It lists all of the source code in my project.
What am I doing wrong here?
I think the output of the hg status command is probably telling you that you have a lot of files in your working directory that are not being tracked by Mercurial. You should be able to fix this by running the command
hg addremove
Then you can make your first commit:
hg commit -m "first commit"
Alternatively, you can do this all in one command with
hg commit -A -m "first commit"
Try hg push then refresh the repository some times It changes inspite of saying nothing changed