Skip to content
Snippets Groups Projects
  • Katsunori FUJIWARA's avatar
    0332b8fa
    bookmarks: check HG_PENDING strictly · 0332b8fa
    Katsunori FUJIWARA authored
    Before this patch, checking HG_PENDING in bookmarks.py might cause
    unintentional reading unrelated '.hg/bookmarks.pending' in, because it
    just examines existence of HG_PENDING environment variable.
    
    This patch uses txnutil.trypending() to check HG_PENDING strictly.
    
    This patch also changes share extension.
    
    Enabling share extension (+ bookmark sharing) makes
    bookmarks._getbkfile() receive repo to be shared (= "srcrepo"). On the
    other hand, HG_PENDING always refers current working repo (=
    "currepo"), and bookmarks.pending is written only into currepo.
    
    Therefore, we should try to read .hg/bookmarks.pending of currepo in
    at first. If it doesn't exist, we try to read .hg/bookmarks of srcrepo
    in.
    
    Even after this patch, an external hook spawned in currepo can't see
    pending changes in currepo via srcrepo, even though such changes
    become visible after closing transaction, because there is no easy and
    cheap way to know existence of pending changes in currepo via srcrepo.
    
    Please see https://www.mercurial-scm.org/wiki/SharedRepository, too.
    
    BTW, this patch may cause failure of bisect in the repository of
    Mercurial itself, if examination at bisecting assumes that an external
    hook can see all pending changes while nested transactions across
    repositories.
    
    This invisibility issue will be fixed by subsequent patch, which
    allows HG_PENDING to refer multiple repositories.
    0332b8fa
    History
    bookmarks: check HG_PENDING strictly
    Katsunori FUJIWARA authored
    Before this patch, checking HG_PENDING in bookmarks.py might cause
    unintentional reading unrelated '.hg/bookmarks.pending' in, because it
    just examines existence of HG_PENDING environment variable.
    
    This patch uses txnutil.trypending() to check HG_PENDING strictly.
    
    This patch also changes share extension.
    
    Enabling share extension (+ bookmark sharing) makes
    bookmarks._getbkfile() receive repo to be shared (= "srcrepo"). On the
    other hand, HG_PENDING always refers current working repo (=
    "currepo"), and bookmarks.pending is written only into currepo.
    
    Therefore, we should try to read .hg/bookmarks.pending of currepo in
    at first. If it doesn't exist, we try to read .hg/bookmarks of srcrepo
    in.
    
    Even after this patch, an external hook spawned in currepo can't see
    pending changes in currepo via srcrepo, even though such changes
    become visible after closing transaction, because there is no easy and
    cheap way to know existence of pending changes in currepo via srcrepo.
    
    Please see https://www.mercurial-scm.org/wiki/SharedRepository, too.
    
    BTW, this patch may cause failure of bisect in the repository of
    Mercurial itself, if examination at bisecting assumes that an external
    hook can see all pending changes while nested transactions across
    repositories.
    
    This invisibility issue will be fixed by subsequent patch, which
    allows HG_PENDING to refer multiple repositories.