merge - In Mercurial, move old file to location, move new files into old file location with same names -


this should simple, isn't quite right. here scenario , i'll give brief overview of commands i'm using. helps know have 3 specific dev areas, live, staging, , of course our own local dev areas.

i developed new "beta" area of site has gone live , had appropriate testing. i'm ready move beta directory, should , move out old. when locally, seems fine, when try merge local branch staging branch, doesn't seem map files correctly, , gives me bunch of use (c)hanged version, (d)elete, or leave (u)nresolved? prompts. problem comes when old directory has files named same beta directory (like index.php instance). here's quick example of mean:

currentdir/index.php currentdir/update.php currentdir/another_file.php  currentdir-beta/index.php currentdir-beta/update.php currentdir-beta/a_new_file.php currentdir-beta/another_new_file.php 

this process.

# creates new branch live branch hg branch new-branch-name  # move current directory somewhere else hg mv currentdir/* currentdir-old/  # commit... hg com -m "moved current -old"  # fine point  # move beta directory old 1 hg mv currentdir-beta/* currentdir/  # when run hg st, shows files being removed -beta directory , added new/old directory  # commit hg com -m "moved -beta currentdir"  # when commits when problems start happening.  # @ point when run next command, shows # currentdir/index.php , other common files "modified" instead of "added" hg st --rev "max(ancestors('new-branch-name') , branch(live)):'new-branch-name'"  # try merge staging hg staging hg merge new-branch-name  # errors happen "common" file names index.php. treats them though modified instead of added. 

even if ignored above "modified" quirk, when go merge new branch staging branch other changes programmers have done, complains "local has remote deleted". wouldn't care of throw live , new branches have change. thing care work done in currentdir-beta folder on "common" files other programmers no longer map new location. can copy/paste code , commit it, means branches hosed pertains keeping changes other programmers did on common files. give example of mean, when merge , type hg st might this.

m currentdir/index.php m currentdir/update.php m currentdir/a_new_file.php # why m? should right? m currentdir/another_new_file.php # why m? should right? m currentdir-old/another_file.php # why m? should right? r currentdir/another_file.php r currentdir-beta/index.php r currentdir-beta/update.php r currentdir-beta/a_new_file.php r currentdir-beta/another_new_file.php 

any suggestions on how around this? goal make existing code changes took place in currentdir-beta "forwarded" currentdir/ in staging environment. other "not common" file changes mapped, not these common files.

update

forgot mention, i'm using mercurial 3.9 on macos sierra.

i don't know

  • your version of mercurial
  • os

but on win-box mercurial-3.9.1 impressions (and results) differ

clean initial state (folders shortened due lazyness)

>hg st -a c current-beta\a_new_file.php c current-beta\another_new_file.php c current-beta\index.php c current-beta\update.php c current\another_file.php c current\index.php c current\update.php 

first rename

>hg mv current current-backup moving current\another_file.php current-backup\another_file.php moving current\index.php current-backup\index.php moving current\update.php current-backup\update.php 

...commit details skipped...

second rename

>hg mv current-beta current moving current-beta\a_new_file.php current\a_new_file.php moving current-beta\another_new_file.php current\another_new_file.php moving current-beta\index.php current\index.php moving current-beta\update.php current\update.php 

and working directory after (as expected)

>hg st current\a_new_file.php current\another_new_file.php current\index.php current\update.php r current-beta\a_new_file.php r current-beta\another_new_file.php r current-beta\index.php r current-beta\update.php 

...commit details skipped...

if want see how recorded mercurial: used such puzzling @ first glance log better interpreting of output

hg log -t "{rev}:{node|short}\n{if(file_adds,'\tadded: {join(file_adds,', ')}\n')}{if(file_copies,'\tcopied: {join(file_copies,', ')}\n')}{if(file_dels,'\tdeleted: {join(file_dels,', ')}\n')}{if(file_mods,'\tmodified: {join(file_mods,', ')}\n')}\n" 

and here it's result

2:98955fcb7e71         added: current/a_new_file.php, current/another_new_file.php, current/index.php, current/update.php         copied: current/a_new_file.php (current-beta/a_new_file.php), current/another_new_file.php (current-beta/another_new_file.php), current/index.php (current-beta/index.php), current/update.php (current-beta/update.php)         deleted: current-beta/a_new_file.php, current-beta/another_new_file.php, current-beta/index.php, current-beta/update.php  1:61068c6ba8a7         added: current-backup/another_file.php, current-backup/index.php, current-backup/update.php         copied: current-backup/another_file.php (current/another_file.php), current-backup/index.php (current/index.php), current-backup/update.php (current/update.php)         deleted: current/another_file.php, current/index.php, current/update.php   0:454486bc43e5         added: current-beta/a_new_file.php, current-beta/another_new_file.php, current-beta/index.php, current-beta/update.php, current/another_file.php, current/index.php, current/update.php 

as can see - no edits ("modified") @ (and here log /per changeset/ more correct aggregated status)

ps: couldn't see on fly purpose of revset in hg st , necessity of branching+merging

pps: ok, saw

>hg st --rev "0:" m current\index.php m current\update.php current-backup\another_file.php current-backup\index.php current-backup\update.php current\a_new_file.php current\another_new_file.php r current-beta\a_new_file.php r current-beta\another_new_file.php r current-beta\index.php r current-beta\update.php r current\another_file.php 

aggregated results in considering only boundary conditions (correctly, technically speaking) modified files files 1) in same location 2) same name 3) , changed content


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -